Skip to content

Commit 80cc3a4

Browse files
committed
WIP adding EDSH vars
1 parent 790c8cf commit 80cc3a4

File tree

134 files changed

+2054
-338
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+2054
-338
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
map "https://aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPDeath" = "CoreFHIR2OMOPDeath"
2+
3+
/// name = 'CoreFHIR2OMOPDeath'
4+
/// title = 'Mapping FHIR Patient resource to OMOP Death'
5+
/// status = 'draft'
6+
7+
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source
8+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/OMOPDeath" alias DeathTable as target
9+
10+
group Death(source src: Patient, target tgt: DeathTable) {
11+
src.deceased : dateTime as srcDeceased then {
12+
srcDeceased -> tgt.death_datetime = srcDeceased "setDeathDT";
13+
srcDeceased -> tgt.death_date =
14+
// cast(srcDeceased, 'Date')
15+
// (%srcDeceased.toDate())
16+
(%srcDeceased.toString().substring(0, 10))
17+
"setDeathD";
18+
} "SetDeathDate";
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
map "https://aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPLocation" = "CoreFHIR2OMOPLocation"
2+
3+
/// name = 'CoreFHIR2OMOPLocation'
4+
/// title = 'Mapping Patient resource to Location OMOP Domain'
5+
/// status = 'draft'
6+
7+
uses "http://hl7.org/fhir/StructureDefinition/Address" alias Address as source
8+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/OMOPLocation" alias LocationTable as target
9+
10+
group Location(source src: Address, target tgt: LocationTable) {
11+
src.line first as srcLine1 -> tgt.address_1 = srcLine1 "setLineOne";
12+
src.line not_first as srcLine2 -> tgt.address_2 = srcLine2 "setLineTwo";
13+
src.city as srcCity -> tgt.city = srcCity "setCity";
14+
src.postalCode as srcZip -> tgt.zip = srcZip "setZip";
15+
src.country as srcCountry -> tgt.country_source_value = srcCountry "setCountry";
16+
src.text as srcText -> tgt.location_source_value = truncate(srcText, 50) "setVerbatim";
17+
src.extension as geolocation where (url = 'http://hl7.org/fhir/StructureDefinition/geolocation') then {
18+
geolocation.extension as latitude where (url = 'latitude') -> tgt.latitude = (%latitude.value) "setLatitude";
19+
geolocation.extension as longitude where (url = 'longitude') -> tgt.longitude = (%longitude.value) "setLongitude";
20+
} "setGeolocation";
21+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
map "https://aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPMeasurement" = "CoreFHIR2OMOPMeasurement"
2+
3+
/// name = 'CoreFHIR2OMOPMeasurement'
4+
/// title = 'Mapping Observation laboratory resources to Measurement OMOP Domain'
5+
/// status = 'draft'
6+
7+
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias LabObs as source
8+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/LogicalBundle" alias LogicalBundle as target
9+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/OMOPMeasurement" alias MeasurementTable as target
10+
11+
imports "https://aphp.fr/ig/fhir/dm/StructureMap/CoreSimpleObservation2OMOPMeasurement"
12+
// imports "https://aphp.fr/ig/fhir/dm/StructureMap/ComplexMeasurement"
13+
// imports "https://aphp.fr/ig/fhir/dm/StructureMap/*Measurement"
14+
15+
group Observation(source src: LabObs, target tgtBundle : LogicalBundle) {
16+
src -> tgtBundle.id = uuid() "setId";
17+
src -> tgtBundle.type = 'transaction' "setType";
18+
src where code.coding.code in ('14682-9'|'22664-7'|'77147-7') -> tgtBundle.entry as newEntry then {
19+
src -> newEntry.measurement = create("MeasurementTable") as newMeasurement then {
20+
src then SimpleObservation(src, newMeasurement) "transformSimpleObservation";
21+
} "createSimpleObservation";
22+
} "newEntrySimpleObservation";
23+
24+
/*
25+
src where code.coding.code in ('50197-3') -> tgtBundle.entry as newEntry then {
26+
src -> newEntry.measurement = create("MeasurementTable") as newMeasurement then {
27+
src then ComplexMeasurement(src, newMeasurement) "transformComplexMeasurement";
28+
} "createComplexMeasurement";
29+
} "newEntryComplexMeasurement";
30+
*/
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
map "https://aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPPerson" = "CoreFHIR2OMOPPerson"
2+
3+
/// name = 'CoreFHIR2OMOPPerson'
4+
/// title = 'Mapping FHIR Patient resource to OMOP Person'
5+
/// status = 'draft'
6+
7+
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source
8+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/OMOPPerson" alias PersonTable as target
9+
10+
group Person(source src: Patient, target tgt : PersonTable) {
11+
src.id as srcId -> tgt.person_source_value = srcId;
12+
src.gender as srcGender then {
13+
srcGender -> tgt.gender_concept_id = create('Reference') as tgtReference then {
14+
srcGender -> translate(srcGender, 'https://aphp.fr/ig/fhir/dm/ConceptMap/hl7Gender2OhdsiGender', 'code') as genderCode,
15+
tgtReference.reference = append('Concept/', genderCode) "ref";
16+
} "refConcept";
17+
srcGender -> tgt.gender_source_value = srcGender "sourceGender";
18+
} "gender";
19+
src.birthDate as srcBirthDate then {
20+
srcBirthDate -> tgt.birth_datetime = srcBirthDate "dateTime";
21+
srcBirthDate -> tgt.year_of_birth = (%srcBirthDate.toString().substring(0, 4).toInteger()) "year";
22+
srcBirthDate -> tgt.month_of_birth = (%srcBirthDate.toString().substring(5, 2).toInteger()) "month";
23+
srcBirthDate -> tgt.day_of_birth = (%srcBirthDate.toString().substring(8, 2).toInteger()) "day";
24+
} "birthDate";
25+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
map "https://aphp.fr/ig/fhir/dm/StructureMap/CoreFHIRPatient2OMOP" = "CoreFHIRPatient2OMOP"
2+
3+
/// name = 'CoreFHIRPatient2OMOP'
4+
/// title = 'FHIR Patient resource to Tables CDM OMOP'
5+
/// description = 'Cette ressource présente les spécifications de l\'alignement entre la ressource `Patient` vers les tables correspodantes du CDM OMOP.'
6+
/// status = 'draft'
7+
8+
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source
9+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/LogicalBundle" alias LogicalBundle as target
10+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/OMOPPerson" alias PersonTable as target
11+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/OMOPLocation" alias LocationTable as target
12+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/OMOPDeath" alias DeathTable as target
13+
14+
imports "https://aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPPerson"
15+
imports "https://aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPLocation"
16+
imports "https://aphp.fr/ig/fhir/dm/StructureMap/CoreFHIR2OMOPDeath"
17+
18+
group Patient(source src: Patient, target tgtBundle : LogicalBundle) {
19+
src -> tgtBundle.id = uuid() "setId";
20+
src -> tgtBundle.type = 'transaction' "setType";
21+
src -> tgtBundle.entry as newEntry then {
22+
src -> newEntry.person = create("PersonTable") as newPerson then {
23+
src then Person(src, newPerson) "transformPerson";
24+
} "createPerson";
25+
} "newEntryPerson";
26+
src.address as srcAddress where use = 'home' and period.end.empty() -> tgtBundle.entry as newEntry then {
27+
srcAddress -> newEntry.location = create("LocationTable") as newLocation then {
28+
srcAddress then Location(srcAddress, newLocation) "transformLocation";
29+
} "createLocation";
30+
} "newEntryLocation";
31+
src where deceased.is(System.DateTime) or deceased.is(System.Boolean) -> tgtBundle.entry as newEntry then {
32+
src -> newEntry.death = create("DeathTable") as newDeath then {
33+
src then Death(src, newDeath) "transformDeath";
34+
} "createDeath";
35+
} "newEntryDeath";
36+
}

input/fml/usages/core/StructureMap-CorePhysical2FHIR.fml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ map "https://aphp.fr/ig/fhir/dm/StructureMap/CorePhysical2FHIR" = "CorePhysical2
88

99
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/CoreDataSet" alias DataSet as source
1010
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/CorePatient" alias PatientTable as source
11-
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/CoreEncounter" alias EncounterTable as source
11+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/CoreSejour" alias SejourTable as source
1212
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/CoreBiology" alias BiologyTable as source
1313
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/CoreClinical" alias ClinicalTable as source
1414
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationAdm" alias MedicationAdmTable as source
@@ -17,14 +17,15 @@ uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias FHIRBundle as target
1717
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias FHIRPatient as target
1818
uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias FHIREncounter as target
1919
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias FHIRObservation as target
20+
uses "http://hl7.org/fhir/StructureDefinition/Meta" alias FHIRMeta as target
2021

2122
group dataSet(source srcDataSet : DataSet, target tgtBundle : FHIRBundle) <<types>> {
2223
srcDataSet -> tgtBundle.id = uuid() "setId";
2324
srcDataSet.patient as srcPatient -> tgtBundle.entry as tgtEntry, tgtEntry.resource = create("Patient") as newPatient then {
2425
srcPatient then patient(srcPatient, newPatient) "setPatient";
25-
srcDataSet.encounter as srcEncounter -> tgtBundle.entry as tgtEntry, tgtEntry.resource = create("Encounter") as newEncounter then {
26-
srcEncounter then encounter(srcEncounter, newPatient, newEncounter) "setEncounter";
27-
srcDataSet.biology as srcBiology where encounterNi.reference = ('EncounterCore/' + %srcEncounter.encounterNi.toString()) -> tgtBundle.entry as tgtEntry, tgtEntry.resource = create("Observation") as newObservation then {
26+
srcDataSet.sejour as srcSejour -> tgtBundle.entry as tgtEntry, tgtEntry.resource = create("Encounter") as newEncounter then {
27+
srcSejour then encounter(srcSejour, newPatient, newEncounter) "setEncounter";
28+
srcDataSet.biology as srcBiology where sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString()) -> tgtBundle.entry as tgtEntry, tgtEntry.resource = create("Observation") as newObservation then {
2829
srcBiology then observation(srcBiology, newPatient, newEncounter, newObservation) "setBiology";
2930
} "createObservation";
3031
} "createEncounter";
@@ -39,7 +40,7 @@ group patient(source srcPatient : PatientTable, target tgtPatient : FHIRPatient)
3940
srcPatient.birthDate as srcPatientBirthDate -> tgtPatient.birthDate = srcPatientBirthDate "setBirthDate"; // copie la valeur du champ birthDate de la table Patient dans l'élément birthDate de la ressource FHIR Patient
4041
}
4142

42-
group setPatientMeta(source srcNi, target tgtMeta) {
43+
group setPatientMeta(source srcNi, target tgtMeta : FHIRMeta) {
4344
srcNi -> tgtMeta.source = ('https://aphp.fr/fhir/Endpoint/dpi/PatientTable' + '/' + srcNi.toString()) "setSource";
4445
}
4546

@@ -50,21 +51,21 @@ group setHumainName(source srcPatient : PatientTable, target tgtPatientName) {
5051
srcPatient.firstName as srcPatientFirstName -> tgtPatientName.given = srcPatientFirstName "setFirstName";
5152
}
5253

53-
group encounter(source srcEncounter : EncounterTable, source srcPatient : FHIRPatient, target tgtEncounter : FHIREncounter) {
54-
srcEncounter -> tgtEncounter.id = uuid() "setId";
55-
srcEncounter.encounterNi as srcNi -> tgtEncounter.meta as tgtMeta then setEncounterMeta(srcNi, tgtMeta) "setMeta"; // copie la valeur du champ patientNi de la table Patient dans l'élément id de la ressource FHIR Patient
56-
srcEncounter -> tgtEncounter.status = c('http://hl7.org/fhir/encounter-status', 'completed') "setStatus";
57-
srcEncounter.encounterType as srcEncounterType -> tgtEncounter.type = translate(srcEncounterType, 'https://aphp.fr/ig/fhir/dm/ConceptMap/DpiEncounterType2SemanticLayerEncounterType', 'CodeableConcept') "setEncounterType";
54+
group encounter(source srcSejour : SejourTable, source srcPatient : FHIRPatient, target tgtEncounter : FHIREncounter) {
55+
srcSejour -> tgtEncounter.id = uuid() "setId";
56+
srcSejour.sejourNi as srcNi -> tgtEncounter.meta as tgtMeta then setEncounterMeta(srcNi, tgtMeta) "setMeta"; // copie la valeur du champ patientNi de la table Patient dans l'élément id de la ressource FHIR Patient
57+
srcSejour -> tgtEncounter.status = c('http://hl7.org/fhir/encounter-status', 'completed') "setStatus";
58+
srcSejour.sejourType as srcSejourType -> tgtEncounter.type = translate(srcSejourType, 'https://aphp.fr/ig/fhir/dm/ConceptMap/DpiEncounterType2SemanticLayerEncounterType', 'CodeableConcept') "setEncounterType";
5859
srcPatient.id as patientId -> tgtEncounter.subject = create("Reference") as newSubject then setSubjectReference(patientId, newSubject) "setSubjectReference";
59-
srcEncounter.patientNi "patientNi";// fk vers le patient
60-
srcEncounter -> tgtEncounter.period = create("Period") as newActualPeriod then {
61-
srcEncounter.encounterStart as srcPeriodStart -> newActualPeriod.start = srcPeriodStart "setStart";
62-
srcEncounter.encounterEnd as srcPeriodEnd -> newActualPeriod.end = srcPeriodEnd "setEnd";
60+
srcSejour.patientNi "patientNi";// fk vers le patient
61+
srcSejour -> tgtEncounter.period = create("Period") as newActualPeriod then {
62+
srcSejour.sejourStart as srcPeriodStart -> newActualPeriod.start = srcPeriodStart "setStart";
63+
srcSejour.sejourEnd as srcPeriodEnd -> newActualPeriod.end = srcPeriodEnd "setEnd";
6364
} "setPeriod";
6465
}
6566

66-
group setEncounterMeta(source srcNi, target tgtMeta) {
67-
srcNi -> tgtMeta.source = ('https://aphp.fr/fhir/Endpoint/dpi/EncounterTable' + '/' + srcNi.toString()) "setSource";
67+
group setEncounterMeta(source srcNi, target tgtMeta : FHIRMeta) {
68+
srcNi -> tgtMeta.source = ('https://aphp.fr/fhir/Endpoint/dpi/SejourTable' + '/' + srcNi.toString()) "setSource";
6869
}
6970

7071
group setSubjectReference(source srcPatientId , target newSubject) {
@@ -84,7 +85,7 @@ group observation(source srcBiology : BiologyTable, source srcPatient : FHIRPati
8485
} "setQuantity";
8586
}
8687

87-
group setBiologyMeta(source srcNi, target tgtMeta) {
88+
group setBiologyMeta(source srcNi, target tgtMeta : FHIRMeta) {
8889
srcNi -> tgtMeta.source = ('https://aphp.fr/fhir/Endpoint/dpi/BiologyTable' + '/' + srcNi.toString()) "setSource";
8990
}
9091

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
map "https://aphp.fr/ig/fhir/dm/StructureMap/CoreSimpleObservation2OMOPMeasurement" = "CoreSimpleObservation2OMOPMeasurement"
2+
3+
/// name = 'CoreSimpleObservation2OMOPMeasurement'
4+
/// title = 'Mapping simple Observation laboratory resources to Measurement OMOP Domain'
5+
/// status = 'draft'
6+
7+
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias LabObs as source
8+
uses "https://aphp.fr/ig/fhir/dm/StructureDefinition/OMOPMeasurement" alias MeasurementTable as target
9+
10+
group SimpleObservation(source src: LabObs, target tgt : MeasurementTable) {
11+
src.subject as srcSubject -> tgt.person_id = srcSubject "setSubject"; // reference impropre dans le monde OMOP mais permet d'illustrer l'information qui doit être utilisée pour retrouver la bonne OMOPPerson
12+
src.code as srcCode -> tgt.measurement_concept_id = create('Reference') as tgtReference then {
13+
srcCode.coding as srcCoding -> translate(srcCoding, 'https://aphp.fr/ig/fhir/dm/ConceptMap/LabAnalyses', 'code') as measurementCode,
14+
tgtReference.reference = append('Concept/', measurementCode) "setMeasurementConcept";
15+
} "createMeasurementConcept";
16+
src.effective : dateTime as srcDateTime then {
17+
srcDateTime -> tgt.measurement_datetime = srcDateTime "setDateTime";
18+
srcDateTime -> tgt.measurement_date = (%srcDateTime.toString().substring(0, 10)) "setDateNotTime";
19+
} "SetDate";
20+
src.value : Quantity as srcValueQuantity then {
21+
srcValueQuantity.value as srcResultValue-> tgt.value_as_number = srcResultValue "setResultValue";
22+
srcValueQuantity -> tgt.operator_concept_id = create('Reference') as tgtReference then {
23+
srcValueQuantity.comparator as srcValueComparator -> translate(srcValueComparator, 'https://aphp.fr/ig/fhir/dm/ConceptMap/LabComparator', 'code') as comparatorCode,
24+
tgtReference.reference = append('Concept/', comparatorCode) "setComparatorConcept";
25+
} "createComparatorConcept";
26+
srcValueQuantity -> tgt.unit_concept_id = create('Reference') as tgtReference then {
27+
srcValueQuantity.code as srcValueCode -> translate(srcValueCode, 'https://aphp.fr/ig/fhir/dm/ConceptMap/LabUnit', 'code') as unitCode,
28+
tgtReference.reference = append('Concept/', unitCode) "createUnitConcept";
29+
} "setUnitConcept";
30+
srcValueQuantity.code as srcValueCode -> tgt.unit_source_value = srcValueCode "setUnitSourceValue";
31+
} "SetValue";
32+
src.referenceRange as srcRange then {
33+
srcRange.low as srcRangeLow then {
34+
srcRangeLow.value as srcRangeLowValue -> tgt.range_low = srcRangeLowValue "setRangeLow1";
35+
} "setRangeLow0";
36+
srcRange.high as srcRangeHigh then {
37+
srcRangeHigh.value as srcRangeHighValue -> tgt.range_high = srcRangeHighValue "setRangeHigh1";
38+
} "setRangeHigh0";
39+
} "setRange";
40+
src.performer as srcPerformer -> tgt.provider_id = srcPerformer "setPerformer"; // reference impropre dans le monde OMOP mais permet d'illustrer l'information qui doit être utilisée pour retrouver le bon OMOPProvider
41+
}
42+
43+
44+
// measurement_type_concept_id ?

0 commit comments

Comments
 (0)