Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: first draft condition mapper #136

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs=-Dfile.enconding=UTF-8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.miracum.streams.ume.obdstofhir.mapper.mii;

import de.basisdatensatz.obds.v3.DiagnoseTyp;
import de.basisdatensatz.obds.v3.OBDS;
import org.hl7.fhir.r4.model.*;
import org.miracum.streams.ume.obdstofhir.FhirProperties;
import org.miracum.streams.ume.obdstofhir.mapper.ObdsToFhirMapper;
Expand All @@ -19,10 +19,23 @@ public ConditionMapper(FhirProperties fhirProperties) {
super(fhirProperties);
}

public Condition map(DiagnoseTyp diagnose, Reference patient) {
public Condition map(OBDS.MengePatient.Patient.MengeMeldung.Meldung meldung, Reference patient) {
var condition = new Condition();
condition.setSubject(patient);
condition.getMeta().addProfile(fhirProperties.getProfiles().getMiiPrOnkoDiagnosePrimaertumor());
var tumorzuordnung = meldung.getTumorzuordnung();
if (tumorzuordnung == null) {
throw new RuntimeException("tumorzuordnung ist null");
}
condition.setRecordedDate(
tumorzuordnung.getDiagnosedatum().getValue().toGregorianCalendar().getTime());

condition.setCode(
new CodeableConcept(
new Coding(
fhirProperties.getSystems().getIcd10gm(),
tumorzuordnung.getPrimaertumorICD().getCode(),
"")));
return condition;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule;
import de.basisdatensatz.obds.v3.OBDS;
import java.io.IOException;
import java.util.TimeZone;
import org.approvaltests.Approvals;
import org.approvaltests.core.Options;
import org.hl7.fhir.r4.model.Reference;
Expand All @@ -29,6 +30,7 @@ class ConditionMapperTest {

@Test
void map_withGivenObds_shouldCreateValidConditionResource() throws IOException {
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
// TODO: refactor to use a data provider for parameterized tests
final var resource = this.getClass().getClassLoader().getResource("obds3/test1.xml");
assertThat(resource).isNotNull();
Expand All @@ -45,9 +47,7 @@ void map_withGivenObds_shouldCreateValidConditionResource() throws IOException {
var obdsPatient = obds.getMengePatient().getPatient().getFirst();

final var condition =
sut.map(
obdsPatient.getMengeMeldung().getMeldung().getFirst().getDiagnose(),
new Reference("Patient/1"));
sut.map(obdsPatient.getMengeMeldung().getMeldung().getFirst(), new Reference("Patient/1"));

var fhirParser = FhirContext.forR4().newJsonParser().setPrettyPrint(true);
var fhirJson = fhirParser.encodeResourceToString(condition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
"meta": {
"profile": [ "https://www.medizininformatik-initiative.de/fhir/ext/modul-onko/StructureDefinition/mii-pr-onko-diagnose-primaertumor" ]
},
"code": {
"coding": [ {
"system": "http://fhir.de/CodeSystem/bfarm/icd-10-gm",
"code": "C17.1"
} ]
},
"subject": {
"reference": "Patient/1"
}
},
"recordedDate": "2024-06-10T02:00:00+02:00"
}
Loading