diff --git a/backend/.envrc.default b/backend/.envrc.default index e9523d2709..17eab6e04c 100644 --- a/backend/.envrc.default +++ b/backend/.envrc.default @@ -1,3 +1,3 @@ -layout pyenv 3.10.12 +layout pyenv 3.11.8 dotenv diff --git a/backend/batch.Dockerfile b/backend/batch.Dockerfile index ebd35d2210..82e94d5066 100644 --- a/backend/batch.Dockerfile +++ b/backend/batch.Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/lambda/python:3.10 AS base +FROM public.ecr.aws/lambda/python:3.11 AS base # Create a non-root user with a specific UID and GID RUN mkdir -p /home/appuser && \ echo 'appuser:x:1001:1001::/home/appuser:/sbin/nologin' >> /etc/passwd && \ diff --git a/backend/lambda.Dockerfile b/backend/lambda.Dockerfile index 21d5fc28e2..75179734be 100644 --- a/backend/lambda.Dockerfile +++ b/backend/lambda.Dockerfile @@ -1,4 +1,4 @@ -FROM public.ecr.aws/lambda/python:3.10 as base +FROM public.ecr.aws/lambda/python:3.11 as base # Create a non-root user with a specific UID and GID RUN mkdir -p /home/appuser && \ diff --git a/backend/poetry.lock b/backend/poetry.lock index 3222b360b9..4ab45250a8 100644 --- a/backend/poetry.lock +++ b/backend/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. [[package]] name = "aws-lambda-typing" @@ -1446,5 +1446,5 @@ files = [ [metadata] lock-version = "2.1" -python-versions = "~3.10" -content-hash = "bb04af9e54855ae250f05a537cce4d5f0513c4297aa10f34ebd22f531612e670" +python-versions = "~3.11" +content-hash = "29cc8557d5a111b3f6ecc9f58d694ebf1e940b9481b3683c71c9b6582645263e" diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 1168a39342..49f61f90c8 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -7,7 +7,7 @@ readme = "README.md" packages = [{include = "src"}] [tool.poetry.dependencies] -python = "~3.10" +python = "~3.11" "fhir.resources" = "~7.0.2" boto3 = "~1.26.90" boto3-stubs-lite = {extras = ["dynamodb"], version = "~1.26.90"} diff --git a/delta_backend/tests/sample_data/fhir_sample.json b/delta_backend/tests/sample_data/fhir_sample.json index ddb1e7f2fa..b6531a6883 100644 --- a/delta_backend/tests/sample_data/fhir_sample.json +++ b/delta_backend/tests/sample_data/fhir_sample.json @@ -1,30 +1,19 @@ + { + "resourceType": "Immunization", "contained": [ { + "resourceType": "Practitioner", "id": "Pract1", "name": [ { "family": "Nightingale", - "given": [ - "Florence" - ] + "given": ["Florence"] } - ], - "resourceType": "Practitioner" + ] }, { - "address": [ - { - "city": "London", - "line": [ - "123 High Street" - ], - "postalCode": "SW1A 1AA", - "use": "home" - } - ], - "birthDate": "2026-03-10", - "gender": "other", + "resourceType": "Patient", "id": "Pat1", "identifier": [ { @@ -35,90 +24,44 @@ "name": [ { "family": "Taylor", - "given": [ - "Sarah" - ] + "given": ["Sarah"] } ], - "resourceType": "Patient" + "gender": "other", + "birthDate": "2026-03-10", + "address": [ + { + "use": "home", + "line": ["123 High Street"], + "city": "London", + "postalCode": "SW1A 1AA" + } + ] } ], - "doseQuantity": { - "code": "ml", - "system": "http://unitsofmeasure.org", - "unit": "milliliter", - "value": 0.5 - }, - "expirationDate": "2024-10-05", "extension": [ { "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-VaccinationProcedure", "valueCodeableConcept": { - "coding": [ - { - "code": "1324681000000104", - "display": "Administration of first dose 111 of severe acute respiratory syndrome coronavirus 2 vaccine (procedure)", - "extension": [ - { - "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescDisplay", - "valueString": "Test Value string 123456 COVID19 vaccination" - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid", - "valueId": "1 - 5306706018" - } - ], - "system": "http://snomed.info/test" - }, - { - "code": "1324681000000101", - "display": "Administration of first dose 222 of severe acute respiratory syndrome coronavirus 2 vaccine (procedure)", - "extension": [ + "coding": [ { - "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescDisplay", - "valueString": "Test Value string 99996 COVID19 vaccination" + "code": "956951000000105", + "display": "Seasonal influenza vaccination (procedure)", + "system": "http://snomed.info/test" }, { - "url": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid", - "valueId": "5306706019" - } - ], - "system": "http://snomed.info/sct" - }, - { - "code": "1324681000000103", - "display": "Administration of first dose 333 of severe acute respiratory syndrome coronavirus 2 vaccine (procedure)", - "extension": [ - { - "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescDisplay", - "valueString": "Test Value string 464645 COVID19 vaccination" + "code": "956951000000104", + "display": "Seasonal influenza vaccination (procedure)", + "system": "http://snomed.info/sct" }, { - "url": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid", - "valueId": "5306706018" + "code": "NEG", + "display": "Seasonal influenza vaccination (procedure)", + "system": "https://acme.lab/resultcodes" } - ], - "system": "http://snomed.info/sct" - }, - { - "code": "1324681000000222", - "display": "Administration of first dose 333 of severe acute respiratory syndrome coronavirus 2 vaccine (procedure)", - "extension": [ - { - "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescDisplay", - "valueString": "Test Value string 19874 COVID19 vaccination" - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid", - "valueId": "5306706019" - } - ], - "system": "http://snomed.info/sct" - } - ], - "text": "Negative RSV for Chlamydia Trachomatis rRNA" + ] + } } - } ], "identifier": [ { @@ -126,20 +69,63 @@ "value": "ACME-vacc123456" } ], + "status": "completed", + "vaccineCode": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "39114911000001104", + "display": "COVID-19 Vaccine Vaxzevria (ChAdOx1 S [recombinant]) not less than 2.5x100,000,000 infectious units/0.5ml dose suspension for injection multidose vials (AstraZeneca UK Ltd) (product)" + }, + { + "system": "http://snomed.info/sct", + "code": "39114911000001105", + "display": "COVID-19 Vaccine Vaxzevria (ChAdOx1 S [recombinant]) not less than 2.5x100,000,000 infectious units/0.5ml dose suspension for injection multidose vials (AstraZeneca UK Ltd) (product)" + } + ] + }, + "patient": { + "reference": "#Pat1" + }, + "occurrenceDateTime": "2025-04-06T13:28:17.271+02:00", + "recorded": "2025-01-01T00:00:00.000000", + "primarySource": "True", + "manufacturer": { + "display": "AstraZeneca Ltd" + }, "location": { + "type": "Location", "identifier": { - "system": "https://fhir.nhs.uk/Id/ods-organization-code", - "value": "X99999" - }, - "type": "Location" + "value": "X99999", + "system": "https://fhir.nhs.uk/Id/ods-organization-code" + } }, "lotNumber": "4120Z001", - "manufacturer": { - "display": "AstraZeneca Ltd" + "expirationDate": "2024-10-05", + + "site": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "368208006", + "display": "Left upper arm structure (body structure)" + } + ] }, - "occurrenceDateTime": "2021-05-07T12:24:37+00:00", - "patient": { - "reference": "#Pat1" + "route": { + "coding": [ + { + "system": "http://snomed.info/sct", + "code": "78421000", + "display": "Intramuscular route (qualifier value)" + } + ] + }, + "doseQuantity": { + "value": 0.5, + "unit": "milliliter", + "system": "http://unitsofmeasure.org", + "code": "ml" }, "performer": [ { @@ -149,121 +135,38 @@ }, { "actor": { + "type": "Organization", "identifier": { "system": "https://fhir.hl7.org.uk/Id/urn-school-number", "value": "B0C4P" - }, - "type": "Organization" + } } } ], - "primarySource": "True", + "reasonCode": [ + { + "coding": [ + { + "code": "443684005", + "system": "http://snomed.info/sct" + } + ] + } + ], "protocolApplied": [ { - "doseNumberPositiveInt": 2, "targetDisease": [ { "coding": [ { + "system": "http://snomed.info/sct", "code": "840539006", - "display": "Disease caused by severe acute respiratory syndrome coronavirus 2", - "system": "http://snomed.info/sct" + "display": "Disease caused by severe acute respiratory syndrome coronavirus 2" } ] } - ] - } - ], - "reasonCode": [ - { - "coding": [ - { - "code": "443684005", - "display": "Disease outbreak (event)", - "system": "http://snomed.info/test" - }, - { - "code": "543684005", - "display": "Disease outbreak (event)", - "system": "http://snomed.info/sct" - }, - { - "code": "643684005", - "display": "Disease outbreak (event)", - "system": "http://snomed.info/sct" - } - ] + ], + "doseNumberPositiveInt": 2 } - ], - "recorded": "2025-01-01T00:00:00.000000", - "resourceType": "Immunization", - "route": { - "coding": [ - { - "code": "78421000", - "display": "Intramuscular route (qualifier value)", - "system": "http://snomed.info/sct" - } - ] - }, - "site": { - "coding": [ - { - "code": "368208006", - "display": "Left upper arm structure (body structure)", - "system": "http://snomed.info/sct" - } - ] - }, - "status": "completed", - "vaccineCode": { - "coding": [ - { - "code": "39114911000001105", - "display": "COVID-19 Vaccine 111 Vaxzevria (ChAdOx1 S [recombinant]) not less than 2.5x100,000,000 infectious units/0.5ml dose suspension for injection multidose vials (AstraZeneca UK Ltd) (product)", - "extension": [ - { - "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescDisplay", - "valueString": "Test Value string vaccineCode 12" - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid", - "valueId": "5306706018" - } - ], - "system": "http://snomed.info/test" - }, - { - "code": "39114911000001106", - "display": "COVID-19 Vaccine 222 Vaxzevria (ChAdOx1 S [recombinant]) not less than 2.5x100,000,000 infectious units/0.5ml dose suspension for injection multidose vials (AstraZeneca UK Ltd) (product)", - "extension": [ - { - "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescDisplay", - "valueString": "Test Value string vaccineCode 12" - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid", - "valueId": "5306706018" - } - ], - "system": "http://snomed.info/sct" - }, - { - "code": "39114911000001107", - "display": "COVID-19 Vaccine 333 Vaxzevria (ChAdOx1 S [recombinant]) not less than 2.5x100,000,000 infectious units/0.5ml dose suspension for injection multidose vials (AstraZeneca UK Ltd) (product)", - "extension": [ - { - "url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-CodingSCTDescDisplay", - "valueString": "Test Value string vaccineCode 12" - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/coding-sctdescid", - "valueId": "5306706018" - } - ], - "system": "http://snomed.info/sct" - } - ], - "text": "Test String for VaccineCode" - } + ] } \ No newline at end of file diff --git a/sandbox/immunisation-fhir-api.json b/sandbox/immunisation-fhir-api.json index 3de15bf575..7bf2c5bd46 100644 --- a/sandbox/immunisation-fhir-api.json +++ b/sandbox/immunisation-fhir-api.json @@ -415,12 +415,12 @@ "system": { "description": "The system which defines the location. Typically this will be https://fhir.nhs.uk/Id/ods-organization-code for a health setting (ODS use) or https://fhir.hl7.org.uk/Id/urn-school-number for an education setting (URN use). ", "type": "string", - "example": "urn:iso:std:iso:3166" + "example": "https://fhir.nhs.uk/Id/ods-organization-code" }, "value": { "description": "The ODS or URN code of the location where the vaccination was administered. \n1. For occupational health vaccinations administered in a hospital trust by an independent healthcare provider, this SHALL be the ODS code of the hospital trust. \n2. For school vaccinations administered by a School Aged Immunisation Service provider, this SHALL be the URN of the school where the vaccination was administered. \n3. For roving teams on care home visits, this SHALL be the ODS code of the care home, where known. \n4. For any other vaccinations, populate with the same code as provided for `performer` ODS code. \n\nWhere the ODS/URN code is unavailable, a default value of `X99999` MUST be used.", "type": "string", - "example": "GB" + "example": "X99999" } }, "required": [ @@ -772,8 +772,8 @@ }, "location": { "identifier": { - "value": "X99999", - "system": "https://fhir.nhs.uk/Id/ods-organization-code" + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "X99999" } }, "lotNumber": "4120Z001", @@ -1238,12 +1238,12 @@ "system": { "description": "The system which defines the location. Typically this will be https://fhir.nhs.uk/Id/ods-organization-code for a health setting or https://fhir.hl7.org.uk/Id/urn-school-number for an education setting.", "type": "string", - "example": "urn:iso:std:iso:3166" + "example": "https://fhir.nhs.uk/Id/ods-organization-code" }, "value": { "description": "A code from the system to represent the location. An ODS code of X99999 represents a location where a code is not available.", "type": "string", - "example": "GB" + "example": "X99999" } }, "required": [ @@ -1671,8 +1671,8 @@ "primarySource": true, "location": { "identifier": { - "system": "urn:iso:std:iso:3166", - "value": "GB" + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "X99999" } }, "manufacturer": { @@ -3122,12 +3122,12 @@ "system": { "description": "The system which defines the location. Typically this will be https://fhir.nhs.uk/Id/ods-organization-code for a health setting or https://fhir.hl7.org.uk/Id/urn-school-number for an education setting.", "type": "string", - "example": "urn:iso:std:iso:3166" + "example": "https://fhir.nhs.uk/Id/ods-organization-code" }, "value": { "description": "A code from the system to represent the location. An ODS code of X99999 represents a location where a code is not available.", "type": "string", - "example": "GB" + "example": "X99999" } }, "required": [ @@ -3505,8 +3505,8 @@ "primarySource": true, "location": { "identifier": { - "system": "urn:iso:std:iso:3166", - "value": "GB" + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "X99999" } }, "manufacturer": { @@ -3549,7 +3549,7 @@ "type": "Organization", "identifier": { "system": "https://fhir.nhs.uk/Id/ods-organization-code", - "value": "N2N9I" + "value": "B0C4P" } } } diff --git a/specification/immunisation-fhir-api.json b/specification/immunisation-fhir-api.json index 3de15bf575..7bf2c5bd46 100644 --- a/specification/immunisation-fhir-api.json +++ b/specification/immunisation-fhir-api.json @@ -415,12 +415,12 @@ "system": { "description": "The system which defines the location. Typically this will be https://fhir.nhs.uk/Id/ods-organization-code for a health setting (ODS use) or https://fhir.hl7.org.uk/Id/urn-school-number for an education setting (URN use). ", "type": "string", - "example": "urn:iso:std:iso:3166" + "example": "https://fhir.nhs.uk/Id/ods-organization-code" }, "value": { "description": "The ODS or URN code of the location where the vaccination was administered. \n1. For occupational health vaccinations administered in a hospital trust by an independent healthcare provider, this SHALL be the ODS code of the hospital trust. \n2. For school vaccinations administered by a School Aged Immunisation Service provider, this SHALL be the URN of the school where the vaccination was administered. \n3. For roving teams on care home visits, this SHALL be the ODS code of the care home, where known. \n4. For any other vaccinations, populate with the same code as provided for `performer` ODS code. \n\nWhere the ODS/URN code is unavailable, a default value of `X99999` MUST be used.", "type": "string", - "example": "GB" + "example": "X99999" } }, "required": [ @@ -772,8 +772,8 @@ }, "location": { "identifier": { - "value": "X99999", - "system": "https://fhir.nhs.uk/Id/ods-organization-code" + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "X99999" } }, "lotNumber": "4120Z001", @@ -1238,12 +1238,12 @@ "system": { "description": "The system which defines the location. Typically this will be https://fhir.nhs.uk/Id/ods-organization-code for a health setting or https://fhir.hl7.org.uk/Id/urn-school-number for an education setting.", "type": "string", - "example": "urn:iso:std:iso:3166" + "example": "https://fhir.nhs.uk/Id/ods-organization-code" }, "value": { "description": "A code from the system to represent the location. An ODS code of X99999 represents a location where a code is not available.", "type": "string", - "example": "GB" + "example": "X99999" } }, "required": [ @@ -1671,8 +1671,8 @@ "primarySource": true, "location": { "identifier": { - "system": "urn:iso:std:iso:3166", - "value": "GB" + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "X99999" } }, "manufacturer": { @@ -3122,12 +3122,12 @@ "system": { "description": "The system which defines the location. Typically this will be https://fhir.nhs.uk/Id/ods-organization-code for a health setting or https://fhir.hl7.org.uk/Id/urn-school-number for an education setting.", "type": "string", - "example": "urn:iso:std:iso:3166" + "example": "https://fhir.nhs.uk/Id/ods-organization-code" }, "value": { "description": "A code from the system to represent the location. An ODS code of X99999 represents a location where a code is not available.", "type": "string", - "example": "GB" + "example": "X99999" } }, "required": [ @@ -3505,8 +3505,8 @@ "primarySource": true, "location": { "identifier": { - "system": "urn:iso:std:iso:3166", - "value": "GB" + "system": "https://fhir.nhs.uk/Id/ods-organization-code", + "value": "X99999" } }, "manufacturer": { @@ -3549,7 +3549,7 @@ "type": "Organization", "identifier": { "system": "https://fhir.nhs.uk/Id/ods-organization-code", - "value": "N2N9I" + "value": "B0C4P" } } }