Skip to content

Commit fe5ce48

Browse files
committed
debug
1 parent e8f92e9 commit fe5ce48

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

backend/src/a.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"statusCode": 200, "headers": {"Content-Type": "application/fhir+json"},
3+
"body": {
4+
"resourceType": "Bundle", "type": "searchset",
5+
"link":
6+
[
7+
{"relation": "self", "url": "https://internal-dev.api.service.nhs.uk/immunisation-fhir-api-pr-721/Immunization?immunization.target=RSV&patient.identifier=https%3A%2F%2Ffhir.nhs.uk%2FId%2Fnhs-number%7C9693632109"}
8+
],
9+
"entry":
10+
[
11+
{"fullUrl": "https://api.service.nhs.uk/immunisation-fhir-api/Immunization/5ecf759a-be0f-47ce-bcea-1b35dec6427a",
12+
"resource": {"resourceType": "Immunization", "id": "5ecf759a-be0f-47ce-bcea-1b35dec6427a", "extension":
13+
[{"url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-VaccinationProcedure", "valueCodeableConcept": {"coding":
14+
[{"system": "http://snomed.info/sct", "code": "1324681000000101", "display": "Administration of first dose of severe acute respiratory syndrome coronavirus 2 vaccine (procedure)"}]}}],
15+
"identifier": [{"use": "official", "system": "https://supplierABC/identifiers/vacc", "value": "efedd295-9867-4f31-833f-0340654930ad"}], "status": "completed", "vaccineCode": {"coding": [{"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": "urn:uuid:e40603e8-3097-4bda-bcfd-39a57311dab6", "type": "Patient",
16+
"identifier": {"system": "https://fhir.nhs.uk/Id/nhs-number", "value": "9693632109"}}, "occurrenceDateTime": "2021-02-07T13:28:17+00:00", "recorded": "2021-02-07T13:28:17+00:00", "primarySource": true, "location": {"type": "Location", "identifier": {"system": "https://fhir.nhs.uk/Id/ods-organization-code", "value": "X99999"}}, "manufacturer": {"display": "AstraZeneca Ltd"}, "lotNumber": "4120Z001", "expirationDate": "2021-07-02", "site": {"coding": [{"system": "http://snomed.info/sct", "code": "368208006", "display": "Left upper arm structure (body structure)"}]}, "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": [{"actor": {"type": "Organization", "identifier": {"system": "https://fhir.hl7.org.uk/Id/urn-school-number", "value": "B0C4P"}}}], "reasonCode": [{"coding": [{"system": "http://snomed.info/sct", "code": "443684005"}]}], "protocolApplied": [{"targetDisease": [{"coding": [{"system": "http://snomed.info/sct", "code": "55735004", "display": "Respiratory syncytial virus infection (disorder)"}]}], "doseNumberPositiveInt": 1}]}, "search": {"mode": "match"}}, {"fullUrl": "https://api.service.nhs.uk/immunisation-fhir-api/Immunization/e1e10dc6-aaca-41dc-aa22-ea9484d253b3", "resource": {"resourceType": "Immunization", "id": "e1e10dc6-aaca-41dc-aa22-ea9484d253b3", "extension": [{"url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-VaccinationProcedure", "valueCodeableConcept": {"coding": [{"system": "http://snomed.info/sct", "code": "1324681000000101", "display": "Administration of first dose of severe acute respiratory syndrome coronavirus 2 vaccine (procedure)"}]}}], "identifier": [{"use": "official", "system": "https://supplierABC/identifiers/vacc", "value": "b3df6474-ed75-46d2-a3bd-3ceff23f3164"}], "status": "completed", "vaccineCode": {"coding": [{"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": "urn:uuid:e40603e8-3097-4bda-bcfd-39a57311dab6", "type": "Patient",
17+
"identifier": {"system": "https://fhir.nhs.uk/Id/nhs-number", "value": "9693632109"}}, "occurrenceDateTime": "2021-02-07T13:28:17+00:00", "recorded": "2021-02-07T13:28:17+00:00", "primarySource": true, "location": {"type": "Location", "identifier": {"system": "https://fhir.nhs.uk/Id/ods-organization-code", "value": "X99999"}}, "manufacturer": {"display": "AstraZeneca Ltd"}, "lotNumber": "4120Z001", "expirationDate": "2021-07-02", "site": {"coding": [{"system": "http://snomed.info/sct", "code": "368208006", "display": "Left upper arm structure (body structure)"}]}, "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": [{"actor": {"type": "Organization", "identifier": {"system": "https://fhir.hl7.org.uk/Id/urn-school-number", "value": "B0C4P"}}}], "reasonCode": [{"coding": [{"system": "http://snomed.info/sct", "code": "443684005"}]}], "protocolApplied": [{"targetDisease": [{"coding": [{"system": "http://snomed.info/sct", "code": "55735004", "display": "Respiratory syncytial virus infection (disorder)"}]}], "doseNumberPositiveInt": 1}]}, "search": {"mode": "match"}}, {"fullUrl": "urn:uuid:e40603e8-3097-4bda-bcfd-39a57311dab6", "resource": {"resourceType": "Patient", "id": "9693632109",
18+
"identifier": [{"system": "https://fhir.nhs.uk/Id/nhs-number", "value": "9693632109"}
19+
]},
20+
"search": {"mode": "include"}}],
21+
"total": 2
22+
}

backend/src/fhir_service.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ def search_immunizations(
288288
Finds all instances of Immunization(s) for a specified patient which are for the specified vaccine type(s).
289289
Bundles the resources with the relevant patient resource and returns the bundle.
290290
"""
291-
logger.info("SAW: search_immunizations for nhs_number: %s, vaccine_types: %s, date_from: %s, date_to: %s",)
291+
logger.info("SAW: search_immunizations for nhs_number: %s, vaccine_types: %s, date_from: %s, date_to: %s",
292+
nhs_number, vaccine_types, date_from, date_to)
292293
# TODO: is disease type a mandatory field? (I assumed it is)
293294
# i.e. Should we provide a search option for getting Patient's entire imms history?
294295

@@ -332,6 +333,10 @@ def search_immunizations(
332333

333334

334335
logger.info("SAW: entries created for bundle: %d", len(entries))
336+
337+
for entry in entries:
338+
logger.debug("SAW: entry: %s", entry.resource.json(indent=2))
339+
335340
# Add patient resource if there is at least one immunization resource
336341
if len(resources) > 0:
337342
entries.append(

backend/src/search_imms_handler.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ def search_imms(event: events.APIGatewayProxyEventV1, controller: FhirController
6262
logger.info("SAW: Searching by immunization")
6363
response = controller.search_immunizations(event)
6464

65+
logger.info("SAW: Searched by immunization")
66+
6567
result_json = json.dumps(response)
68+
logger.info("SAW: Search result: %s", result_json)
69+
logger.info("SAW: Search result size: %d bytes", len(result_json.encode("utf-8")))
6670
result_size = len(result_json.encode("utf-8"))
6771

6872
if result_size > 6 * 1024 * 1024:
@@ -73,6 +77,7 @@ def search_imms(event: events.APIGatewayProxyEventV1, controller: FhirController
7377
diagnostics="Search returned too many results. Please narrow down the search",
7478
)
7579
return FhirController.create_response(400, exp_error)
80+
logger.info("SAW: return response with size: %d bytes", result_size)
7681
return response
7782
except Exception: # pylint: disable = broad-exception-caught
7883
logger.exception("Unhandled exception")

0 commit comments

Comments
 (0)