Skip to content

Commit

Permalink
Add additional provider details to ecr viewer (#2591)
Browse files Browse the repository at this point in the history
* change encounter reference to be practitioner role rather than only practitioner

* remove org information from practitioner

* add additional provider information to evalute provider function

* add .5 rem to right padding

* update data
  • Loading branch information
BobanL authored Sep 25, 2024
1 parent 6159ae4 commit 1226b9c
Show file tree
Hide file tree
Showing 15 changed files with 441 additions and 322 deletions.
242 changes: 121 additions & 121 deletions containers/ecr-viewer/seed-scripts/sql/data.sql

Large diffs are not rendered by default.

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 @@ -54,10 +54,9 @@ facilityState: "Bundle.entry.resource.where(resourceType = 'Location')[0].addres
facilityStreetAddress: "Bundle.entry.resource.where(resourceType = 'Location')[0].address.line[0]"
facilityType: "Bundle.entry.resource.where(resourceType = 'Encounter')[0].location[0].extension.where(url = 'http://build.fhir.org/ig/HL7/case-reporting/StructureDefinition-us-ph-location-definitions.html#Location.type').valueCodeableConcept.coding[0].display"
facilityZipCode: "Bundle.entry.resource.where(resourceType = 'Location')[0].address.postalCode"
providerContact: "Bundle.entry.resource.where(resourceType = 'Practitioner')[0].telecom.where(system = 'phone')[0].value"
providerFamilyName: "Bundle.entry.resource.where(resourceType = 'Practitioner')[0].name[1].family"
providerGivenName: "Bundle.entry.resource.where(resourceType = 'Practitioner')[0].name[1].given"
providerName: "idk"

compositionEncounterRef: "Bundle.entry.resource.where(resourceType = 'Composition').encounter.reference"
encounterIndividualRef: "Encounter.participant.where(type.coding.code = 'ATND').individual.reference"

rrDetails: "Bundle.entry.resource.where(meta.profile = 'http://hl7.org/fhir/us/ecr/StructureDefinition/rr-reportability-information-observation')"
rrDisplayNames: "Bundle.entry.resource.where(meta.profile = 'http://hl7.org/fhir/us/ecr/StructureDefinition/rr-reportability-information-observation').valueCodeableConcept.coding.display"
Expand Down
75 changes: 71 additions & 4 deletions containers/ecr-viewer/src/app/services/evaluateFhirDataService.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import {
Bundle,
CodeableConcept,
Encounter,
Identifier,
Location,
Organization,
Practitioner,
PractitionerRole,
Quantity,
} from "fhir/r4";
import { evaluate } from "@/app/view-data/utils/evaluate";
import * as dateFns from "date-fns";
import { PathMappings, evaluateData } from "../view-data/utils/utils";
import {
formatAddress,
formatContactPoint,
formatName,
formatPhoneNumber,
formatStartEndDateTime,
Expand Down Expand Up @@ -386,21 +391,83 @@ export const evaluateProviderData = (
fhirBundle: Bundle,
mappings: PathMappings,
) => {
const encounterRef: string | undefined = evaluate(
fhirBundle,
mappings["compositionEncounterRef"],
)[0];
const encounter: Encounter = evaluateReference(
fhirBundle,
mappings,
encounterRef ?? "",
);
const encounterParticipantRef: string | undefined = evaluate(
encounter,
mappings["encounterIndividualRef"],
)[0];
const practitionerRole: PractitionerRole | undefined = evaluateReference(
fhirBundle,
mappings,
encounterParticipantRef ?? "",
);
const practitioner: Practitioner | undefined = evaluateReference(
fhirBundle,
mappings,
practitionerRole?.practitioner?.reference ?? "",
);
const organization: Organization | undefined = evaluateReference(
fhirBundle,
mappings,
practitionerRole?.organization?.reference ?? "",
);

const providerData = [
{
title: "Provider Name",
value: formatName(
evaluate(fhirBundle, mappings["providerGivenName"]),
evaluate(fhirBundle, mappings["providerFamilyName"])[0],
practitioner?.name?.[0].given,
practitioner?.name?.[0].family,
practitioner?.name?.[0].prefix,
practitioner?.name?.[0].suffix,
),
},
{
title: "Provider Address",
value: practitioner?.address?.map((address) =>
formatAddress(
address.line ?? [],
address.city ?? "",
address.state ?? "",
address.postalCode ?? "",
address.country ?? "",
),
),
},
{
title: "Provider Contact",
value: formatPhoneNumber(
evaluate(fhirBundle, mappings["providerContact"])[0],
value: formatContactPoint(practitioner?.telecom).join("\n"),
},
{
title: "Provider Facility Name",
value: organization?.name,
},
{
title: "Provider Facility Address",
value: organization?.address?.map((address) =>
formatAddress(
address.line ?? [],
address.city ?? "",
address.state ?? "",
address.postalCode ?? "",
address.country ?? "",
),
),
},
{
title: "Provider ID",
value: practitioner?.identifier?.map((id) => id.value).join("\n"),
},
];

return evaluateData(providerData);
};

Expand Down
Loading

0 comments on commit 1226b9c

Please sign in to comment.