use of org.hl7.elm.r1.DateTime in project odm2fhir by num-codex.
the class Apheresis method createProcedure.
private Procedure createProcedure(ItemData generalCoding, ItemData answerCoding) {
var procedure = (Procedure) new Procedure().addIdentifier(createIdentifier(PROCEDURE, generalCoding)).setPerformed(// TODO Set actual DateTime value
UNKNOWN_DATE_TIME).setCategory(createCodeableConcept(createCoding(SNOMED_CT, "277132007", "Therapeutic procedure (procedure)"))).setCode(createCodeableConcept(generalCoding).setText("Apheresis")).setMeta(createMeta(APHERESIS));
createCodings(answerCoding).forEach(coding -> {
if (ProcedureStatus.UNKNOWN.getSystem().equals(coding.getSystem())) {
procedure.setStatus(ProcedureStatus.fromCode(coding.getCode()));
} else {
procedure.setPerformed((DateTimeType) new DateTimeType().addExtension(createExtension(coding)));
}
});
return procedure;
}
use of org.hl7.elm.r1.DateTime in project odm2fhir by num-codex.
the class DialysisHemofiltration method createProcedure.
private Procedure createProcedure(ItemData generalCoding, ItemData answerCoding) {
var procedure = (Procedure) new Procedure().addIdentifier(createIdentifier(PROCEDURE, generalCoding)).setPerformed(// TODO Set actual DateTime value
UNKNOWN_DATE_TIME).setCategory(createCodeableConcept(createCoding(SNOMED_CT, "277132007", "Therapeutic procedure (procedure)"))).setCode(createCodeableConcept(generalCoding).setText("Dialysis")).setMeta(createMeta(DIALYSIS));
createCodings(answerCoding).forEach(coding -> {
if (ProcedureStatus.UNKNOWN.getSystem().equals(coding.getSystem())) {
procedure.setStatus(ProcedureStatus.fromCode(coding.getCode()));
} else {
procedure.setPerformed((DateTimeType) new DateTimeType().addExtension(createExtension(coding)));
}
});
return procedure;
}
use of org.hl7.elm.r1.DateTime in project odm2fhir by num-codex.
the class PronePosition method createProcedure.
private Procedure createProcedure(ItemData generalCoding, ItemData answerCoding) {
var procedure = (Procedure) new Procedure().addIdentifier(createIdentifier(PROCEDURE, generalCoding)).setPerformed(// TODO Set actual DateTime value
UNKNOWN_DATE_TIME).setCategory(createCodeableConcept(createCoding(SNOMED_CT, "225287004", "Procedures relating to positioning and support (procedure)"))).setCode(createCodeableConcept(generalCoding).setText("Prone position")).setMeta(createMeta(PRONE_POSITION));
createCodings(answerCoding).forEach(coding -> {
if (ProcedureStatus.UNKNOWN.getSystem().equals(coding.getSystem())) {
procedure.setStatus(ProcedureStatus.fromCode(coding.getCode()));
} else {
procedure.setPerformed((DateTimeType) new DateTimeType().addExtension(createExtension(coding)));
}
});
return procedure;
}
use of org.hl7.elm.r1.DateTime in project odm2fhir by num-codex.
the class ChronicKidneyDiseases method createCondition.
private Condition createCondition(ItemData generalCoding, ItemData answerCoding, ItemData stageCoding) {
var condition = (Condition) new Condition().setClinicalStatus(ACTIVE).setVerificationStatus(CONFIRMED).addIdentifier(createIdentifier(CONDITION, generalCoding)).setRecordedDateElement(// TODO Set actual DateTime value
UNKNOWN_DATE_TIME).addCategory(createCodeableConcept(createCoding(SNOMED_CT, "394589003", "Nephrology (qualifier value)"))).setSeverity(createCodeableConcept(stageCoding)).setMeta(createMeta(CHRONIC_KIDNEY_DISEASES));
var codeableConcept = new CodeableConcept();
for (var coding : createCodings(answerCoding)) {
switch(coding.getCode()) {
case // NO
"410594000":
// remove clinicalStatus
condition.setVerificationStatus(REFUTED).setClinicalStatus(null);
updateCodeableConcept(codeableConcept, generalCoding);
break;
case // UNKNOWN
"261665006":
// remove verificationStatus and clinicalStatus
condition.setVerificationStatus(null).setClinicalStatus(null).addModifierExtension(DATA_PRESENCE_UNKNOWN);
updateCodeableConcept(codeableConcept, generalCoding);
break;
case // UNKNOWN
"unknown":
break;
default:
codeableConcept.addCoding(coding);
break;
}
}
return codeableConcept.isEmpty() ? new Condition() : condition.setCode(codeableConcept);
}
use of org.hl7.elm.r1.DateTime in project odm2fhir by num-codex.
the class HistoryOfTravel method createObservation.
private Observation createObservation(ItemData generalCoding, ItemData answerCoding, Map<String, ItemData> travelActivity) {
var observation = (Observation) new Observation().addIdentifier(createIdentifier(OBSERVATION, travelActivity.get("country")).setType(OBI).setAssigner(getOrganizationReference())).setStatus(FINAL).setEffective(// TODO Set actual DateTime value
UNKNOWN_DATE_TIME).addCategory(SOCIAL_HISTORY).setMeta(createMeta(HISTORY_OF_TRAVEL));
var codeCodeableConcept = createCodeableConcept(generalCoding).setText("History of Travel");
if (!codeCodeableConcept.isEmpty()) {
observation.setCode(codeCodeableConcept);
}
var valueCodeableConcept = createCodeableConcept(answerCoding);
if (!valueCodeableConcept.isEmpty()) {
observation.setValue(valueCodeableConcept);
}
var startDate = travelActivity.get("start");
if (!startDate.isEmpty()) {
observation.addComponent(new ObservationComponentComponent().setCode(createCodeableConcept(createCoding(LOINC, "82752-7", "Date travel started")).setText("Travel start date")).setValue(createDateTimeType(startDate)));
}
var endDate = travelActivity.get("end");
if (!endDate.isEmpty()) {
observation.addComponent(new ObservationComponentComponent().setCode(createCodeableConcept(createCoding(LOINC, "91560-3", "Date of departure from travel destination")).setText("Travel end date")).setValue(createDateTimeType(endDate)));
}
var country = travelActivity.get("country");
if (!country.isEmpty()) {
var countryCoding = createCoding(country);
countryCoding.setDisplay(new Locale("", countryCoding.getCode()).getDisplayCountry(ENGLISH));
observation.addComponent(new ObservationComponentComponent().setCode(createCodeableConcept(createCoding(LOINC, "94651-7", "Country of travel")).setText("Country of travel")).setValue(createCodeableConcept(countryCoding).setText(countryCoding.getDisplay())));
}
var state = travelActivity.get("state");
if (!state.isEmpty()) {
var stateCoding = createCoding(state);
stateCoding.setDisplay(STATES.getOrDefault(stateCoding.getCode(), stateCoding.getCode()));
observation.addComponent(new ObservationComponentComponent().setCode(createCodeableConcept(createCoding(LOINC, "82754-3", "State of travel")).setText("State of travel")).setValue(createCodeableConcept(stateCoding).setText(stateCoding.getDisplay())));
}
var city = travelActivity.get("city");
if (!city.isEmpty()) {
observation.addComponent(new ObservationComponentComponent().setCode(createCodeableConcept(createCoding(LOINC, "94653-3", "City of travel")).setText("City of travel")).setValue(createStringType(city)));
}
// no Components added = no travel activity
return observation.getComponent().isEmpty() ? new Observation() : observation;
}
Aggregations