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

worked on patient.groovy #92

Merged
merged 1 commit into from
Nov 7, 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
3 changes: 3 additions & 0 deletions src/main/groovy/projects/patientfinder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ The following imported data sets are supported/tested:

# Change log

## 2024-11-06
* moved telecom information from Patient.contact.telecom to Patient.telecom

## 2024-10-17
* Added the export of MedicationRequest requester from LaborMapping

Expand Down
36 changes: 9 additions & 27 deletions src/main/groovy/projects/patientfinder/patient.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package projects.patientfinder

import de.kairos.centraxx.fhir.r4.utils.FhirUrls
import de.kairos.fhir.centraxx.metamodel.Country
import de.kairos.fhir.centraxx.metamodel.Ethnicity
import de.kairos.fhir.centraxx.metamodel.Multilingual
import de.kairos.fhir.centraxx.metamodel.PatientAddress
import de.kairos.fhir.centraxx.metamodel.enums.GenderType
import org.hl7.fhir.r4.model.codesystems.ContactPointSystem
Expand All @@ -12,12 +10,9 @@ import static de.kairos.fhir.centraxx.metamodel.AbstractCode.CODE
import static de.kairos.fhir.centraxx.metamodel.AbstractIdContainer.ID_CONTAINER_TYPE
import static de.kairos.fhir.centraxx.metamodel.AbstractIdContainer.PSN
import static de.kairos.fhir.centraxx.metamodel.IdContainerType.DECISIVE
import static de.kairos.fhir.centraxx.metamodel.Multilingual.LANGUAGE
import static de.kairos.fhir.centraxx.metamodel.Multilingual.NAME
import static de.kairos.fhir.centraxx.metamodel.PatientMaster.GENDER_TYPE
import static de.kairos.fhir.centraxx.metamodel.RootEntities.patient
import static de.kairos.fhir.centraxx.metamodel.RootEntities.patientMasterDataAnonymous

/**
* Represented by a CXX PatientMasterDataAnonymous
* Specified: http://www.hl7.org/fhir/us/core/StructureDefinition-us-core-patient.html
Expand Down Expand Up @@ -48,10 +43,9 @@ patient {
}

humanName {
use = "official"
text = context.source[patient().firstName()] + " " + context.source[patient().lastName()]
family = context.source[patient().lastName()]
given context.source[patient().firstName()] as String
prefix context.source[patient().title().multilinguals()]?.find { it[LANGUAGE] == "en" }?.getAt(Multilingual.DESCRIPTION) as String
given(context.source[patient().firstName()] as String)
}

if (context.source[patient().birthName()]) {
Expand Down Expand Up @@ -84,26 +78,14 @@ patient {
line lineString
}
}
contact {
telecom {
system = ContactPointSystem.PHONE.toCode()
value = ad[PatientAddress.PHONE1]
}
telecom {
system = ContactPointSystem.EMAIL.toCode()
value = ad[PatientAddress.EMAIL]
}
}
}

final def firstEthnicity = context.source[patient().patientContainer().ethnicities()].find { final def ethnicity -> ethnicity != null }
if (firstEthnicity != null) {
extension {
url = "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
extension {
url = "text"
valueString = firstEthnicity[Ethnicity.MULTILINGUALS].find { it[LANGUAGE] == "en"}?.getAt(NAME) as String
}
telecom {
system = ContactPointSystem.PHONE.toCode()
value = ad[PatientAddress.PHONE1]
}
telecom {
system = ContactPointSystem.EMAIL.toCode()
value = ad[PatientAddress.EMAIL]
}
}
}
Expand Down