-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from kairos-fhir/custom-import-mii
created first draft for Transformation of FHIR MII KDS -> CXX FHIR
- Loading branch information
Showing
5 changed files
with
347 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/main/groovy/customimport/patient.groovy → ...roovy/customimport/example/patient.groovy
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
102 changes: 102 additions & 0 deletions
102
src/main/groovy/customimport/mii/modulperson/example-message-patient.json
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,102 @@ | ||
{ | ||
"resourceType": "Bundle", | ||
"type": "transaction", | ||
"entry": [ | ||
{ | ||
"fullUrl": "Patient/3365", | ||
"resource":{ | ||
"resourceType": "Patient", | ||
"id": "ExamplePatientPatientMinimal", | ||
"meta": { | ||
"profile": [ | ||
"https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient" | ||
] | ||
}, | ||
"identifier": [ | ||
{ | ||
"use": "usual", | ||
"type": { | ||
"coding": [ | ||
{ | ||
"system": "http://terminology.hl7.org/CodeSystem/v2-0203", | ||
"code": "MR" | ||
} | ||
] | ||
}, | ||
"system": "https://www.example.org/fhir/sid/patienten", | ||
"value": "42285243", | ||
"assigner": { | ||
"display": "Charité – Universitätsmedizin Berlin", | ||
"identifier": { | ||
"system": "http://fhir.de/NamingSystem/arge-ik/iknr", | ||
"value": "261101015" | ||
} | ||
} | ||
}, | ||
{ | ||
"use": "official", | ||
"type": { | ||
"coding": [ | ||
{ | ||
"system": "http://fhir.de/CodeSystem/identifier-type-de-basis", | ||
"code": "GKV" | ||
} | ||
] | ||
}, | ||
"system": "http://fhir.de/NamingSystem/gkv/kvid-10", | ||
"value": "A999999999", | ||
"assigner": { | ||
"identifier": { | ||
"use": "official", | ||
"system": "http://fhir.de/NamingSystem/arge-ik/iknr", | ||
"value": "260326822" | ||
} | ||
} | ||
} | ||
], | ||
"name": [ | ||
{ | ||
"use": "official", | ||
"family": "Van-der-Dussen", | ||
"given": [ | ||
"Maja", | ||
"Julia" | ||
] | ||
} | ||
], | ||
"address": [ | ||
{ | ||
"type": "both", | ||
"line": [ | ||
"Teststraße 2" | ||
], | ||
"city": "Köln", | ||
"postalCode": "50823", | ||
"country": "DE" | ||
} | ||
], | ||
"gender": "other", | ||
"_gender": { | ||
"extension": [ | ||
{ | ||
"url": "http://fhir.de/StructureDefinition/gender-amtlich-de", | ||
"valueCoding": { | ||
"system": "http://fhir.de/CodeSystem/gender-amtlich-de", | ||
"code": "D", | ||
"display": "divers" | ||
} | ||
} | ||
] | ||
}, | ||
"birthDate": "1998-09-19", | ||
"managingOrganization": { | ||
"reference": "Organization/Charite-Universitaetsmedizin-Berlin" | ||
} | ||
}, | ||
"request": { | ||
"method": "POST", | ||
"url": "Patient/575" | ||
} | ||
} | ||
] | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/groovy/customimport/mii/modulperson/masterdata_patient.xml
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,49 @@ | ||
<CentraXXDataExchange xmlns="http://www.kairos-med.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kairos-med.de ../CentraXXExchange.xsd"> | ||
<Source>CENTRAXX</Source> | ||
<SourceVersion>2024.2.0-SNAPSHOT</SourceVersion> | ||
<ExportDate>2024-03-01T19:11:17.057+01:00</ExportDate> | ||
<CatalogueData> | ||
<IdType> | ||
<Code>PATIENTID</Code> | ||
<Name>Pat. ID</Name> | ||
<Editable>true</Editable> | ||
<Kind>PATIENT</Kind> | ||
<Decisive>false</Decisive> | ||
<Pseudonym>false</Pseudonym> | ||
<Mandatory>false</Mandatory> | ||
<SyncId>9AA837FD-89EB-41C3-8B32-1154C9F61536</SyncId> | ||
<UserEntries assignStrict="true"> | ||
<Systemwide>true</Systemwide> | ||
</UserEntries> | ||
<Uniqueness>ORGANIZATION</Uniqueness> | ||
</IdType> | ||
<IdType> | ||
<Code>GKV</Code> | ||
<Name>Versichterten ID GKV</Name> | ||
<Editable>true</Editable> | ||
<Kind>PATIENT</Kind> | ||
<Decisive>true</Decisive> | ||
<Pseudonym>false</Pseudonym> | ||
<Mandatory>false</Mandatory> | ||
<SyncId>e8f9fb88-eed7-4f4e-a358-2fc49eb3277b</SyncId> | ||
<UserEntries assignStrict="true"> | ||
<Systemwide>true</Systemwide> | ||
</UserEntries> | ||
<Uniqueness>SYSTEM</Uniqueness> | ||
</IdType> | ||
<IdType> | ||
<Code>PKV</Code> | ||
<Name>Versicherten ID PKV</Name> | ||
<Editable>true</Editable> | ||
<Kind>PATIENT</Kind> | ||
<Decisive>true</Decisive> | ||
<Pseudonym>false</Pseudonym> | ||
<Mandatory>false</Mandatory> | ||
<SyncId>9f9bf668-3802-4fb3-aa7a-329744283fb7</SyncId> | ||
<UserEntries assignStrict="true"> | ||
<Systemwide>true</Systemwide> | ||
</UserEntries> | ||
<Uniqueness>SYSTEM</Uniqueness> | ||
</IdType> | ||
</CatalogueData> | ||
</CentraXXDataExchange> |
195 changes: 195 additions & 0 deletions
195
src/main/groovy/customimport/mii/modulperson/patient.groovy
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,195 @@ | ||
package customimport.mii.modulperson | ||
|
||
import de.kairos.centraxx.fhir.r4.utils.FhirUrls | ||
import org.hl7.fhir.r4.model.Address | ||
import org.hl7.fhir.r4.model.Bundle | ||
import org.hl7.fhir.r4.model.Extension | ||
import org.hl7.fhir.r4.model.HumanName | ||
import org.hl7.fhir.r4.model.Identifier | ||
import org.hl7.fhir.r4.model.Patient | ||
import org.hl7.fhir.r4.model.ResourceType | ||
import org.hl7.fhir.r4.model.codesystems.NameUse | ||
|
||
bundle { | ||
|
||
// filter for patient entries | ||
context.bundles.each { final def bundle -> | ||
bundle.getEntry().findAll { it.getResource().getResourceType() == ResourceType.Patient } | ||
.each { | ||
final Patient sourcePatient = it.getResource() as Patient | ||
|
||
// get bundle request to set to entries. Could also transform it here. | ||
final Bundle.BundleEntryRequestComponent requestToSet = it.getRequest() | ||
|
||
|
||
entry { | ||
request = requestToSet | ||
resource { | ||
patient { | ||
id = sourcePatient.getId() | ||
|
||
final Identifier gkv = sourcePatient.identifier.find { | ||
it.type?.codingFirstRep?.system == "http://fhir.de/CodeSystem/identifier-type-de-basis" && it.type?.codingFirstRep?.code == "GKV" | ||
} | ||
|
||
if (gkv) { | ||
identifier { | ||
type { | ||
coding { | ||
system = FhirUrls.System.IdContainerType.BASE_URL | ||
code = "GKV" | ||
} | ||
} | ||
value = gkv.value | ||
} | ||
} | ||
|
||
final Identifier pid = sourcePatient.identifier.find { | ||
it.type?.codingFirstRep?.system == "http://terminology.hl7.org/CodeSystem/v2-0203" && it.type?.codingFirstRep?.code == "MR" | ||
} | ||
|
||
if (pid) { | ||
identifier { | ||
type { | ||
coding { | ||
system = FhirUrls.System.IdContainerType.BASE_URL | ||
code = "PATIENTID" | ||
} | ||
} | ||
value = pid.value | ||
} | ||
} | ||
|
||
final Identifier pkv = sourcePatient.identifier.find { | ||
it.type?.codingFirstRep?.system == "http://fhir.de/CodeSystem/identifier-type-de-basis" && it.type?.codingFirstRep?.code == "PKV" | ||
} | ||
|
||
if (pkv) { | ||
identifier { | ||
type { | ||
coding { | ||
system = FhirUrls.System.IdContainerType.BASE_URL | ||
code = "PKV" | ||
} | ||
} | ||
value = pkv.value | ||
} | ||
} | ||
|
||
/** | ||
* For import the mandatory system Ids must be set. | ||
* TODO: Figure something out here that makes sense. | ||
*/ | ||
final Identifier notNull = [pkv, gkv, pid].find{it != null} | ||
|
||
identifier { | ||
type { | ||
coding { | ||
system = FhirUrls.System.IdContainerType.BASE_URL | ||
code = "SID" | ||
} | ||
} | ||
value = notNull.value | ||
} | ||
|
||
/** | ||
* Names | ||
* Currently we only import given and last name | ||
* CXX supports title, affix, birthname | ||
*/ | ||
|
||
final HumanName firstSourceName = sourcePatient.name.find { | ||
it.use.toCode() == NameUse.OFFICIAL.toCode() | ||
} | ||
|
||
if (firstSourceName) { | ||
humanName { | ||
firstSourceName.given.each { | ||
given.add(it.getValue()) | ||
} | ||
|
||
family = firstSourceName.family | ||
} | ||
} | ||
|
||
final HumanName firstSourceBirthName = sourcePatient.name.find { | ||
it.use.toCode() == NameUse.MAIDEN.toCode() | ||
} | ||
|
||
if (firstSourceBirthName) { | ||
/** | ||
* not yet implemented in CXX importer | ||
*/ | ||
} | ||
|
||
/** | ||
* CXX does only map the FHIR administrative Genders back to the CXX Genders | ||
* MII uses and extension for the case UNKNOWN which specifies whether it is "unbestimmt" or "divers" | ||
*/ | ||
gender = sourcePatient.gender | ||
|
||
if (sourcePatient.birthDate) { | ||
final Extension dataAbsentReasonExtension = sourcePatient.birthDateElement | ||
.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") | ||
|
||
birthDate { | ||
date = sourcePatient.birthDate | ||
|
||
if(dataAbsentReasonExtension){ | ||
extension.add(dataAbsentReasonExtension) | ||
} | ||
} | ||
|
||
} | ||
|
||
if (sourcePatient.deceasedDateTimeType) { | ||
deceasedDateTime { | ||
date = sourcePatient.deceasedDateTimeType.value | ||
} | ||
} | ||
|
||
final Address firstAddress = sourcePatient.addressFirstRep | ||
|
||
/** | ||
* Importer currently considers first line item to be street and second to be HouseNo | ||
* | ||
* country, state, postfach is supported by CXX but not yet by the FHIR importer | ||
* | ||
*/ | ||
|
||
if (firstAddress) { | ||
address { | ||
city = firstAddress.city | ||
postalCode = firstAddress.postalCode | ||
|
||
if (firstAddress.line.size() == 1) { | ||
line.add(firstAddress.line.get(0).getValue()) | ||
} else { | ||
final String street = firstAddress.line.find { | ||
it.hasExtension("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-streetName") | ||
}?.getValue() | ||
|
||
final String houseNo = firstAddress.line.find { | ||
it.hasExtension("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-houseNumber") | ||
}?.getValue() | ||
|
||
/** | ||
* not supported by importer yet | ||
*/ | ||
final String postFach = firstAddress.line.find { | ||
it.hasExtension("http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-postBox") | ||
}?.getValue() | ||
|
||
line.add(street) | ||
line.add(houseNo) | ||
|
||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|