-
Notifications
You must be signed in to change notification settings - Fork 38
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(api): added patient matching on the outbound pd response #1743
base: develop
Are you sure you want to change the base?
Conversation
const results = await Promise.all( | ||
pdResults.map(async pd => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How may entries we might have on pdResults
? We should probably use executeAsynchronously
and limit to <20 queries to the DB in parallel?
baseErrorResponseSchema, | ||
externalGatewayPatientSchema, | ||
XCPDGatewaySchema, | ||
} from "../shared"; | ||
|
||
// TODO: Test that this schema is correct for the patientResource in the IHE response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a left-over or are you still testing this?
I was going to ask about name, to make sure the array is always present, but we should test all fields yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I was still testing it. Fixed in this PR - https://github.com/metriport/metriport/pull/1747/files
if (!firstName || !lastName || !dob || !genderAtBirth) return; | ||
if (!addresses.length) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's no address we don't want to store/use what we have?
And I'm assuming the other fields are required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, all those fields are required for patient matching
return { | ||
patientId: id, | ||
systemId: system, | ||
oid: pd.gateway.oid, | ||
url, | ||
id: pd.gateway.id, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about storing the patient demographics returned w/ the link here, no? Or was it on the response table?
@@ -90,3 +91,44 @@ export interface Patient extends BaseDomain, PatientCreate {} | |||
export function getStatesFromAddresses(patient: Patient): USState[] { | |||
return patient.data.address.map(getState); | |||
} | |||
|
|||
export function patientDataFromResource(patientResource: PatientResource): PatientData | undefined { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only noticed this now: this function works w/ a type from the SDK, so in theory it should not be on the domain layer - reference.
A way to look into this is:
- if something on the domain imports something from other places, then the domain depends on those;
- the domain should have the least external dependencies as possible;
- we can have folders for these external dependencies (its fine for them to depend on the domain).
We could store it on a folder like ./external/ihe-sdk/...
or ./external/ihe/...
refs. metriport/metriport-internal#1350
Description
Testing
Results:
- Innovar returns a patient with different demos -> no match and we don't DQ them
- Epic returns correct demos -> match and successful DQ
Release Plan