Skip to content

Commit

Permalink
Fix ordering of notes/comments (#2900)
Browse files Browse the repository at this point in the history
* fix: move things to fhir converter, unify make and docker

* ci: remove dotnet testing

* fix: undo debugging docker changes

* fix: more debugging clenaup

* docs: update README with current dev guidance and pointing to the fork

* feat: allow passing the converter tool path as an environment variable

* fix: rename environment variable

* fix: point to converter pr

* fix: sanitize and map the incoming original inner tex

* test: add unit tests

* fix: use valueString when available

* test: update snapshot

* docs: add section header comment

* test: update snapshot

* test: more snapshot updating

* fix: gender identity fhirpath, parsing lab notes

* fix: point to corresponding FHIR-Converter branch

* fix: update to v7.0-skylight-7 release

* refactor: move selection logic into fhirpath

* fix: escape div

* test: make sure tests cover the changes

* Update containers/fhir-converter/Dockerfile
  • Loading branch information
mcmcgrath13 authored Nov 15, 2024
1 parent 86b63e1 commit 6e86ee7
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 14 deletions.
7 changes: 3 additions & 4 deletions containers/ecr-viewer/src/app/api/fhirPath.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,16 @@ activeProblemsDisplay: "Condition.code.coding.display.first()"
activeProblemsOnsetDate: "Condition.onsetDateTime"
activeProblemsOnsetAge: "Condition.onsetAge.value"
activeProblemsComments: "Condition.note[0].text"
historyOfPresentIllness: "Bundle.entry.resource.where(resourceType = 'Composition').section.where(code.coding.code = '10164-2').text"
historyOfPresentIllness: "Bundle.entry.resource.where(resourceType = 'Composition').section.where(code.coding.code = '10164-2').text.`div`.first()"

# Treatment Details
planOfTreatment: "Bundle.entry.resource.section.where(title = 'Plan of Treatment').text"
planOfTreatment: "Bundle.entry.resource.section.where(title = 'Plan of Treatment').text.first().`div`"
plannedProcedures: "Bundle.entry.resource.where(resourceType = 'CarePlan').activity"
plannedProcedureName: "detail.code.coding[0].display"
plannedProcedureOrderedDate: "extension.where(url = 'dibbs.orderedDate').valueString"
plannedProcedureScheduledDate: "detail.scheduledString"

# Administered Medications
administeredMedications: "Bundle.entry.resource.section.where(code.coding[0].code = '29549-3').text"
adminMedicationsRefs: "Bundle.entry.resource.section.where(code.coding[0].code = '29549-3').entry.reference"

## Care Team
Expand All @@ -126,7 +125,7 @@ procedureReason: "Procedure.reason.display"
# Lab Info
diagnosticReports: "Bundle.entry.resource.where(resourceType = 'DiagnosticReport')"
observations: "Bundle.entry.resource.where(resourceType = 'Observation')"
labResultDiv: "Bundle.entry.resource.section.where(code.coding[0].code = '30954-2').text"
labResultDiv: "Bundle.entry.resource.section.where(code.coding[0].code = '30954-2').text.`div`.first()"
specimenCollectionTime: "Observation.extension[0].extension.where(url = 'specimen collection time').valueDateTime"
specimenReceivedTime: "Observation.extension[0].extension.where(url = 'specimen receive time').valueDateTime"
specimenSource: "Observation.extension[0].extension.where(url = 'specimen source').valueString"
Expand Down
4 changes: 2 additions & 2 deletions containers/ecr-viewer/src/app/services/labsService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const getLabJsonObject = (
const observationRefVal = [...new Set(observationRefValsArray)].join(", "); // should only be 1

// Get lab reports HTML String (for all lab reports) & convert to JSON
const labsString = evaluate(fhirBundle, mappings["labResultDiv"])[0].div;
const labsString = evaluateValue(fhirBundle, mappings["labResultDiv"]);
const labsJson = formatTablesToJSON(labsString);

// Get specified lab report (by reference value)
Expand Down Expand Up @@ -341,7 +341,7 @@ export const evaluateDiagnosticReportData = (
infoPath: "observationDeviceReference",
applyToValue: (ref) => {
const device = evaluateReference(fhirBundle, mappings, ref) as Device;
return device.deviceName?.[0]?.name;
return parse(sanitizeAndMap(device.deviceName?.[0]?.name ?? ""));
},
className: "minw-10 width-20",
},
Expand Down
2 changes: 1 addition & 1 deletion containers/ecr-viewer/src/app/tests/assets/BundleLab.json
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@
"valueString": "Acinetobacter baumannii",
"note": [
{
"text": "Lab comment"
"text": "<paragraph>Lab comment</paragraph>"
}
],
"effectiveDateTime": "2022-04-18T19:57:02Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,9 @@ NASHVILLE, TN
class="hideableData p-list"
colspan="5"
>
Lab comment
<p>
Lab comment
</p>
</td>
</tr>
</tbody>
Expand Down
7 changes: 4 additions & 3 deletions containers/ecr-viewer/src/app/view-data/components/common.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
calculatePatientAge,
evaluateReference,
evaluateValue,
} from "@/app/services/evaluateFhirDataService";
import EvaluateTable, {
BuildHeaders,
Expand Down Expand Up @@ -255,8 +256,8 @@ export const returnPlanOfTreatmentContent = (
fhirBundle: Bundle,
mappings: PathMappings,
) => {
const bundle = evaluate(fhirBundle, mappings["planOfTreatment"]);
const rawTables = formatTablesToJSON(bundle[0]?.div);
const bundle = evaluateValue(fhirBundle, mappings["planOfTreatment"]);
const rawTables = formatTablesToJSON(bundle);
const tables = rawTables
.map((rawTable) => returnPlanOfTreatmentTable(rawTable))
.filter((t) => !!t);
Expand Down Expand Up @@ -500,7 +501,7 @@ export const evaluateClinicalData = (
title: "Miscellaneous Notes",
value: parse(
sanitizeAndMap(
evaluate(fhirBundle, mappings["historyOfPresentIllness"])[0]?.div,
evaluateValue(fhirBundle, mappings["historyOfPresentIllness"]),
) || "",
),
},
Expand Down
2 changes: 1 addition & 1 deletion containers/fhir-converter/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

# Download FHIR-Converter
RUN git clone https://github.com/skylight-hq/FHIR-Converter.git --branch v7.0-skylight-7 --single-branch /build/FHIR-Converter
RUN git clone https://github.com/skylight-hq/FHIR-Converter.git --branch v7.0-skylight-8 --single-branch /build/FHIR-Converter

WORKDIR /build/FHIR-Converter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7543,7 +7543,7 @@
}),
'note': list([
dict({
'text': '<paragraph styleCode="xcellHeader" xmlns="urn:hl7-org:v3">Last Assessment &amp; Plan: </paragraph><content xmlns="urn:hl7-org:v3"><content styleCode="xLabel">Formatting of this note might be different from the original.</content><br />This is my note about this problem.</content><br xmlns="urn:hl7-org:v3" />',
'text': '<content xmlns="urn:hl7-org:v3">A note:</content><paragraph styleCode="xcellHeader" xmlns="urn:hl7-org:v3">Last Assessment &amp; Plan: </paragraph><content xmlns="urn:hl7-org:v3"><content styleCode="xLabel">Formatting of this note might be different from the original.</content><br />This is my note about this problem.</content><br xmlns="urn:hl7-org:v3" />',
}),
]),
'onsetDateTime': '2019-04-16',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@
</tr>
<tr styleCode="xRowAlt xMergeUp">
<td ID="problem14comment" colspan="2" styleCode="xallIndent">
<content>A note:</content>
<paragraph styleCode="xcellHeader">Last Assessment &amp;
Plan: </paragraph>
<content><content styleCode="xLabel">Formatting of this note
Expand Down Expand Up @@ -5784,4 +5785,4 @@
</component>
</structuredBody>
</component>
</ClinicalDocument>
</ClinicalDocument>

0 comments on commit 6e86ee7

Please sign in to comment.