Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions containers/message-parser/app/default_schemas/extended.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"reference_lookup": "Bundle.entry.resource.where(resourceType = 'Composition').encounter.reference"
},
"reason_for_visit": {
"fhir_path": "Bundle.entry.resource.where(resourceType= 'Composition' ).section.where(code.coding.code='29299-5').extension.where(url='http://hl7.org/fhir/cda/ccda/StructureDefinition/2.16.840.1.113883.10.20.22.2.12').valueString",
"fhir_path": "Bundle.entry.resource.where(resourceType= 'Composition' ).section.where(code.coding.code='29299-5').text.`div`",
"data_type": "string",
"nullable": true
},
Expand Down Expand Up @@ -298,8 +298,12 @@
"nullable": true
},
"specimen_type": {
"fhir_path": "Observation.extension.where(url='http://hl7.org/fhir/R4/specimen.html').extension.where(url='specimen source').valueString",
"fhir_path": "Bundle.entry.resource.where(resourceType = 'Specimen' and id = %ref).type.coding.display",
"data_type": "string",
"reference_lookup": [
"Observation.id",
"Bundle.entry.resource.where(resourceType = 'DiagnosticReport').where(result.where(reference.endsWith(%ref)).exists()).specimen.reference"
],
"nullable": true
},
"performing_lab": {
Expand All @@ -308,8 +312,12 @@
"nullable": true
},
"specimen_collection_date": {
"fhir_path": "Observation.extension.where(url='http://hl7.org/fhir/R4/specimen.html').extension.where(url='specimen collection time').valueDateTime",
"fhir_path": "Bundle.entry.resource.where(resourceType = 'Specimen' and id = %ref).collection.collectedPeriod.start | Bundle.entry.resource.where(resourceType = 'Specimen' and id = %ref).collection.collectedDateTime",
"data_type": "datetime",
"reference_lookup": [
"Observation.id",
"Bundle.entry.resource.where(resourceType = 'DiagnosticReport').where(result.where(reference.endsWith(%ref)).exists()).specimen.reference"
],
"nullable": true
}
}
Expand Down
9 changes: 4 additions & 5 deletions containers/message-parser/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,10 @@ def _get_reference(self, field_parser, current_message):
curr_ref = fhirpathpy.evaluate(message, ref_parser)

if len(curr_ref) == 0:
self.response.status_code = status.HTTP_400_BAD_REQUEST
raise ValueError(
"Provided `reference_lookup` location does not point to a "
"referencing identifier"
)
# No matching reference was found. Treat as missing data and
# propagate an empty reference so the downstream lookup resolves to
# a null value instead of failing the entire parse.
curr_ref.append("")
# Future refactor: Each reference_parser can only refer to one reference
elif len(curr_ref) > 1:
self.response.status_code = status.HTTP_400_BAD_REQUEST
Expand Down