-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(imaging): add new diagnostic report linkage for doc ref (#1082)
- Loading branch information
1 parent
dcd0426
commit 31dca18
Showing
7 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import { | |
Binary, | ||
Claim, | ||
Condition, | ||
DiagnosticReport, | ||
DocumentReference, | ||
Encounter, | ||
ImagingStudy, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getConfig } from 'config' | ||
import { CohortImaging } from 'types' | ||
import { getApiResponseResources } from 'utils/apiHelpers' | ||
import { fetchDiagnosticReport } from './callApi' | ||
import { ImagingStudy } from 'fhir/r4' | ||
|
||
export const linkToDiagnosticReport = async ( | ||
imagingList: ImagingStudy[], | ||
signal?: AbortSignal | ||
): Promise<CohortImaging[]> => { | ||
const config = getConfig() | ||
if (!config.features.diagnosticReport.enabled || !config.features.diagnosticReport.useStudyParam) { | ||
return Promise.resolve(imagingList) | ||
} | ||
const diagnosticReports = getApiResponseResources( | ||
await fetchDiagnosticReport({ | ||
study: imagingList.map((study) => study.id as string), | ||
signal | ||
}) | ||
) | ||
return imagingList.map((imaging) => ({ | ||
...imaging, | ||
diagnosticReport: diagnosticReports?.find((report) => | ||
report.imagingStudy?.find((study) => study.reference === `ImagingStudy/${imaging.id}`) | ||
) | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters