Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: filter out generic patient IDs #2947

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
2 changes: 1 addition & 1 deletion containers/ecr-viewer/src/app/api/fhirPath.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ patientPhoneNumbers: "Bundle.entry.resource.where(resourceType = 'Patient').tele
patientEmails: "Bundle.entry.resource.where(resourceType = 'Patient').telecom.where(system = 'email')"
patientCounty: "Bundle.entry.resource.where(resourceType = 'Patient').address.first().county"

patientIds: "Bundle.entry.resource.where(resourceType = 'Patient').identifier"
patientIds: "Bundle.entry.resource.where(resourceType = 'Patient').identifier.where(system != 'urn:ietf:rfc:3986').value.join('\n')"
patientDOB: "Bundle.entry.resource.where(resourceType = 'Patient').birthDate"
patientVitalStatus: "Bundle.entry.resource.where(resourceType = 'Patient').deceasedBoolean"
patientDOD: "Bundle.entry.resource.where(resourceType = 'Patient').deceasedDate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
CodeableConcept,
Condition,
Encounter,
Identifier,
Location,
Organization,
PatientContact,
Expand Down Expand Up @@ -350,7 +349,7 @@ export const evaluateDemographicsData = (
title: "Patient IDs",
toolTip:
"Unique patient identifier(s) from their medical record. For example, a patient's social security number or medical record number.",
value: evaluateIdentifiers(fhirBundle, mappings.patientIds),
value: evaluateValue(fhirBundle, mappings.patientIds),
},
];
return evaluateData(demographicsData);
Expand Down Expand Up @@ -621,22 +620,6 @@ export const evaluateValue = (entry: Element, path: string): string => {
return value.trim();
};

/**
* Evaluate the identifiers string and return in a formatted list.
* @param fhirBundle The FHIR resource to evaluate.
* @param path The path within the resource to extract the value from.
* @returns Formatted string of identifiers
*/
export const evaluateIdentifiers = (fhirBundle: Bundle, path: string) => {
const identifiers = evaluate(fhirBundle, path) as Identifier[];

return identifiers
.map((identifier) => {
return `${identifier.value}`;
})
.join("\n");
};

/**
* Find facility ID based on the first encounter's location
* @param fhirBundle - The FHIR bundle containing resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
{
"system": "urn:oid:2.16.840.1.113883.3.3316.100",
"value": "10308625"
},
{
"system": "urn:ietf:rfc:3986",
"value": "urn:uuid:2.16.840.1.114222.4.3.4.52.2"
}
],
"name": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { loadYamlConfig } from "@/app/api/utils";
import {
evaluateEncounterId,
evaluateFacilityId,
evaluateIdentifiers,
evaluatePatientRace,
evaluatePatientEthnicity,
evaluatePractitionerRoleReference,
Expand Down Expand Up @@ -97,7 +96,7 @@ describe("evaluate value", () => {

describe("Evaluate Identifier", () => {
it("should return the Identifier value", () => {
const actual = evaluateIdentifiers(
const actual = evaluateValue(
BundleWithPatient as unknown as Bundle,
mappings.patientIds,
);
Expand Down
Loading