|
1 | | -import { Bundle, Medication, MedicationAdministration, Reference } from "@fhir-typescript/r4b-core/dist/fhir"; |
| 1 | +import { |
| 2 | + Bundle, |
| 3 | + Medication, |
| 4 | + MedicationAdministration, |
| 5 | + Observation, |
| 6 | + Reference, |
| 7 | +} from "@fhir-typescript/r4b-core/dist/fhir"; |
2 | 8 | import { IVIData, IVIMedication, IVIRegimen } from "./ivi-data.ts"; |
3 | 9 | import { snomed } from "./tonometry-to-fhir.ts"; |
4 | | -import { MedicationAdminStatusCodes } from "@fhir-typescript/r4b-core/dist/valueSetCodes"; |
| 10 | +import { MedicationAdminStatusCodes, ObservationStatusCodes } from "@fhir-typescript/r4b-core/dist/valueSetCodes"; |
5 | 11 | import { isValidMedicationAdmin } from "./ivi-component.ts"; |
| 12 | +import { PresenceStatus2Fhir } from "./funduscopy-to-fhir.ts"; |
| 13 | +import { PresenceStatus } from "./funduscopy-data.ts"; |
6 | 14 |
|
7 | 15 | const Medication2Fhir = { |
8 | 16 | [IVIMedication.Af2]: "", |
@@ -60,9 +68,26 @@ export async function ivi2Fhir(data: IVIData): Promise<Bundle[]> { |
60 | 68 | }, |
61 | 69 | }); |
62 | 70 |
|
| 71 | + let visusLeft = new Observation({ |
| 72 | + status: ObservationStatusCodes.Final, |
| 73 | + category: [ |
| 74 | + { coding: [{ system: "http://terminology.hl7.org/CodeSystem/observation-category", code: "exam" }] }, |
| 75 | + ], |
| 76 | + code: { |
| 77 | + coding: [snomed("260295004", "Sees hand movements (finding)")], |
| 78 | + }, |
| 79 | + effectiveDateTime: new Date(data.recordedDate).toISOString(), |
| 80 | + valueCodeableConcept: { |
| 81 | + coding: PresenceStatus2Fhir[data.leftEye.visus ? PresenceStatus.Present : PresenceStatus.Absent], |
| 82 | + }, |
| 83 | + bodySite: { |
| 84 | + coding: [snomed("1290041000", "Entire left eye proper (body structure)")], |
| 85 | + }, |
| 86 | + }); |
| 87 | + |
63 | 88 | let left = new Bundle({ |
64 | 89 | type: "collection", |
65 | | - entry: [{ resource: medReqLeft }, { resource: medicationLeft }], |
| 90 | + entry: [{ resource: medReqLeft }, { resource: medicationLeft }, { resource: visusLeft }], |
66 | 91 | }); |
67 | 92 |
|
68 | 93 | result.push(left); |
@@ -101,9 +126,26 @@ export async function ivi2Fhir(data: IVIData): Promise<Bundle[]> { |
101 | 126 | }, |
102 | 127 | }); |
103 | 128 |
|
| 129 | + let visusRight = new Observation({ |
| 130 | + status: ObservationStatusCodes.Final, |
| 131 | + category: [ |
| 132 | + { coding: [{ system: "http://terminology.hl7.org/CodeSystem/observation-category", code: "exam" }] }, |
| 133 | + ], |
| 134 | + code: { |
| 135 | + coding: [snomed("260295004", "Sees hand movements (finding)")], |
| 136 | + }, |
| 137 | + effectiveDateTime: new Date(data.recordedDate).toISOString(), |
| 138 | + valueCodeableConcept: { |
| 139 | + coding: PresenceStatus2Fhir[data.rightEye.visus ? PresenceStatus.Present : PresenceStatus.Absent], |
| 140 | + }, |
| 141 | + bodySite: { |
| 142 | + coding: [snomed("1290043002", "Entire right eye proper (body structure)")], |
| 143 | + }, |
| 144 | + }); |
| 145 | + |
104 | 146 | let right = new Bundle({ |
105 | 147 | type: "collection", |
106 | | - entry: [{ resource: medReqRight }, { resource: medicationRight }], |
| 148 | + entry: [{ resource: medReqRight }, { resource: medicationRight }, { resource: visusRight }], |
107 | 149 | }); |
108 | 150 |
|
109 | 151 | result.push(right); |
|
0 commit comments