Skip to content

Commit

Permalink
Added Source Columns
Browse files Browse the repository at this point in the history
Added source columns to the goal, condition, medication and service requests
  • Loading branch information
Sean committed Jan 6, 2025
1 parent 768a7a7 commit d8020b7
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
4 changes: 1 addition & 3 deletions source/lib/condition/condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export const getSupplementalConditions = async (launchURL: string, sdsClient: Cl
if (sdsClient) {
try {
const linkages = await sdsClient.request('Linkage?item=Patient/' + sdsClient.patient.id);
console.log("patientId +linkages " + JSON.stringify(linkages));
const urlSet = new Set();

urlSet.add(launchURL)
Expand All @@ -101,9 +100,8 @@ export const getSupplementalConditions = async (launchURL: string, sdsClient: Cl
// Process third-party goals
const thirdPartyGoals: Condition[] = resourcesFrom(response) as Condition[];
thirdPartyGoals.forEach(condition => {
condition.code.text = condition.code.text + "(" + item2.resource.extension[0].valueUrl + ")"
condition.recorder = {
display: "(" + item2.resource.extension[0].valueUrl + ")"
display: item2.resource.extension[0].valueUrl
};
allThirdPartyMappedConditions.push(condition);
});
Expand Down
4 changes: 3 additions & 1 deletion source/lib/goal/goal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export const getSupplementalData = async (launchURL: string, sdsClient: Client):
const thirdPartyMappedGoals: MccGoalSummary[] = thirdPartyGoals.map(transformToMccGoalSummary);

thirdPartyMappedGoals.forEach(goal => {
goal.expressedBy = (goal.expressedBy ? goal.expressedBy : '') + ' (' + item2.resource.extension[0].valueUrl + ')';
goal.expressedBy = (goal.expressedBy ? goal.expressedBy : '');

goal.source = item2.resource.extension[0].valueUrl
allThirdPartyMappedGoals.push(goal);
});
}
Expand Down
3 changes: 2 additions & 1 deletion source/lib/goal/goal.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export const transformToMccGoalSummary = (goal: MccGoal): MccGoalSummary => {
})) || [];
// const useStartConcept = !!goal.startCodeableConcept
const fhirid = goal.id || '';
// const source = goal.

return {
priority,
Expand All @@ -290,6 +291,6 @@ export const transformToMccGoalSummary = (goal: MccGoal): MccGoalSummary => {
expressedBy,
targets,
// useStartConcept,
fhirid,
fhirid
};
}
8 changes: 4 additions & 4 deletions source/lib/medication-request/medication-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const getSupplementalData = async (launchURL: string, sdsClient: Client): Promis
try {

const linkages = await sdsClient.request('Linkage?item=Patient/' + sdsClient.patient.id);
console.log("patientId +linkages " + JSON.stringify(linkages));
const urlSet = new Set();
urlSet.add(launchURL)
// Loop through second set of linkages
Expand All @@ -60,7 +59,7 @@ const getSupplementalData = async (launchURL: string, sdsClient: Client): Promis
const thirdPartyMccMedication: MccMedication[] = resourcesFromObjectArray(response) as MccMedication[];
thirdPartyMccMedication.forEach(mccMedication => {
mccMedication.recorder = {
display: "(" + item2.resource.extension[0].valueUrl + ")"
display: item2.resource.extension[0].valueUrl
};
allThirdPartyMccMedicationSummary.push(mccMedication);
});
Expand Down Expand Up @@ -109,11 +108,12 @@ export const getSummaryMedicationRequests = async (sdsURL: string, authURL: stri
status: mc.status,
medication: mc.medicationCodeableConcept ? mc.medicationCodeableConcept.text : mc.medicationReference ? mc.medicationReference.display : 'missing',
dosages: mc.dosageInstruction ? mc.dosageInstruction[0].text : '',
requestedBy: mc.requester ? mc.requester.display + where : where,
requestedBy: mc.requester ? mc.requester.display : '',
reasons: condition ? getConceptDisplayString(condition.code) : '',
effectiveDate: mc.authoredOn ? displayDate(mc.authoredOn) : '',
refillsPermitted: 'Unknown',
notes: mc.note ? convertNoteToString(mc.note) : ''
notes: mc.note ? convertNoteToString(mc.note) : '',
source: where
}
}))

Expand Down
2 changes: 1 addition & 1 deletion source/lib/service-request/service-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const getSupplementalData = async (launchURL: string, sdsClient: Client): Promis
thirdPartyServiceRequests.forEach(serviceRequest => {

serviceRequest.locationReference.push({
display: "(" + item2.resource.extension[0].valueUrl + ")"
display: item2.resource.extension[0].valueUrl
});
allThirdPartyServiceRequests.push(serviceRequest);
});
Expand Down
3 changes: 2 additions & 1 deletion source/lib/service-request/service-request.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export const transformToServiceRequest = function (serviceRequest: ServiceReques
status: serviceRequest.status,
displayDate: serviceRequest.occurrenceTiming ? displayTiming(serviceRequest.occurrenceTiming) : (serviceRequest.occurrencePeriod ? displayPeriod(serviceRequest.occurrencePeriod) : (serviceRequest.occurrenceDateTime ? displayDate(serviceRequest.occurrenceDateTime) : serviceRequest.intent.charAt(0).toUpperCase() + serviceRequest.intent.slice(1))),
reasons: serviceRequest.reasonCode ? getConceptDisplayString(serviceRequest.reasonCode[0]) : (serviceRequest.reasonReference ? referenceDisplay.get(serviceRequest.reasonReference[0].reference) : 'Unknown'),
performer: serviceRequest.performer ? serviceRequest.performer[0].display : where
performer: serviceRequest.performer ? serviceRequest.performer[0].display : '',
source: where
};
}

Expand Down
3 changes: 3 additions & 0 deletions source/types/mcc-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ export type MccGoalSummary = {
relatedGoals?: Array<MccGoalRelationship>;
notes?: Array<string>;
mostrecentresult?: string;
source?: string
}

export type MccMedicationSummary = {
Expand All @@ -309,6 +310,7 @@ export type MccMedicationSummary = {
effectiveDate: string;
refillsPermitted: string;
notes: string;
source: string;
}

export type MccMedicationSummaryList = {
Expand Down Expand Up @@ -378,6 +380,7 @@ export type MccServiceRequestSummary = {
performer?: string;
reasons?: string;
fhirid?: string;
source?: string
}


Expand Down

0 comments on commit d8020b7

Please sign in to comment.