use of org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceTranslatorImplTest method toFhirResource_shouldTranslateVoidedTrueToInactive.
@Test
public void toFhirResource_shouldTranslateVoidedTrueToInactive() {
omrsAllergy.setVoided(true);
AllergyIntolerance allergyIntolerance = allergyIntoleranceTranslator.toFhirResource(omrsAllergy);
assertThat(allergyIntolerance.getClinicalStatus().getCoding().get(0).getCode(), equalTo("inactive"));
assertThat(allergyIntolerance.getClinicalStatus().getCoding().get(0).getDisplay(), equalTo("Inactive"));
assertThat(allergyIntolerance.getClinicalStatus().getText(), equalTo("Inactive"));
}
use of org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE in project openmrs-module-fhir2 by openmrs.
the class AllergyIntoleranceTranslatorImpl method setClinicalStatus.
private CodeableConcept setClinicalStatus(boolean voided) {
CodeableConcept status = new CodeableConcept();
if (voided) {
status.setText("Inactive");
status.addCoding(new Coding(FhirConstants.ALLERGY_INTOLERANCE_CLINICAL_STATUS_SYSTEM_URI, "inactive", "Inactive"));
} else {
status.setText("Active");
status.addCoding(new Coding(FhirConstants.ALLERGY_INTOLERANCE_CLINICAL_STATUS_SYSTEM_URI, "active", "Active"));
}
return status;
}
use of org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE in project openmrs-module-fhir2 by openmrs.
the class ConditionClinicalStatusTranslatorImpl_2_2Test method shouldMapFHIRInActiveToOpenMrsInActive.
@Test
public void shouldMapFHIRInActiveToOpenMrsInActive() {
CodeableConcept codeableConcept = new CodeableConcept();
Coding coding = new Coding();
coding.setCode(INACTIVE);
coding.setSystem(FhirConstants.CONDITION_CLINICAL_STATUS_SYSTEM_URI);
codeableConcept.addCoding(coding);
assertThat(clinicalStatusTranslator.toOpenmrsType(codeableConcept), is(ConditionClinicalStatus.INACTIVE));
}
use of org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE in project org.hl7.fhir.core by hapifhir.
the class CCDAConverter method processAllergyProblemAct.
protected void processAllergyProblemAct(ListResource list, Element concern) throws Exception {
cda.checkTemplateId(concern, "2.16.840.1.113883.10.20.22.4.30");
// Allergy Problem Act - this is a concern - we treat the concern as information about it's place in the list
checkNoNegationOrNullFlavor(concern, "Allergy Problem Act");
checkNoSubject(concern, "Allergy Problem Act");
// SHALL contain exactly one [1..1] Allergy - intolerance Observation
for (Element entry : cda.getChildren(concern, "entryRelationship")) {
Element obs = cda.getChild(entry, "observation");
cda.checkTemplateId(obs, "2.16.840.1.113883.10.20.22.4.7");
checkNoNegationOrNullFlavor(obs, "Allergy - intolerance Observation");
checkNoSubject(obs, "Allergy Problem Act");
AllergyIntolerance ai = new AllergyIntolerance();
ListEntryComponent item = addItemToList(list, ai);
// SHALL contain at least one [1..*] id (CONF:7472).
for (Element e : cda.getChildren(concern, "id")) ai.getIdentifier().add(convert.makeIdentifierFromII(e));
// SHALL contain exactly one [1..1] statusCode, which SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.80.68 HITSPProblemStatus DYNAMIC (CONF:7485)
// the status code is about the concern (e.g. the entry in the list)
// possible values: active, suspended, aborted, completed, with an effective time
String s = cda.getStatus(concern);
item.setFlag(Factory.newCodeableConcept(s, "http://hl7.org/fhir/v3/ActStatus", s));
if (// only on this condition?
s.equals("aborted"))
item.setDeleted(true);
// SHALL contain exactly one [1..1] effectiveTime (CONF:7498)
Period p = convert.makePeriodFromIVL(cda.getChild(concern, "effectiveTime"));
item.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/list-period", p, false));
if (p.getEnd() != null)
item.setDate(p.getEnd());
else
item.setDate(p.getStart());
// SHALL contain at least one [1..*] id (CONF:7382)
for (Element e : cda.getChildren(obs, "id")) ai.getIdentifier().add(convert.makeIdentifierFromII(e));
// SHALL contain exactly one [1..1] effectiveTime (CONF:7387)
ai.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/allergyintolerance-period", convert.makePeriodFromIVL(cda.getChild(obs, "effectiveTime")), false));
// SHALL contain exactly one [1..1] value with @xsi:type="CD" (CONF:7390)
CodeableConcept type = convert.makeCodeableConceptFromCD(cda.getChild(obs, "value"));
// This value SHALL contain @code, which SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.6.2 Allergy/Adverse Event Type
String ss = type.getCoding().get(0).getCode();
if (ss.equals("416098002") || ss.equals("414285001"))
ai.setType(AllergyIntoleranceType.ALLERGY);
else if (ss.equals("59037007") || ss.equals("235719002"))
ai.setType(AllergyIntoleranceType.INTOLERANCE);
ai.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/allergy-category", type, false));
// SHOULD contain zero or one [0..1] participant (CONF:7402) such that it
// ......This playingEntity SHALL contain exactly one [1..1] code
ai.setCode(convert.makeCodeableConceptFromCD(cda.getDescendent(obs, "participant/participantRole/playingEntity/code")));
// SHOULD contain zero or more [0..*] entryRelationship (CONF:7447) such that it SHALL contain exactly one [1..1] Reaction Observation (templateId:2.16.840.1.113883.10.20.22.4.9) (CONF:7450).
for (Element e : cda.getChildren(obs, "entryRelationship")) {
Element child = cda.getChild(e, "observation");
if (cda.hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.28") && ai.getClinicalStatus() == null) {
// SHALL contain exactly one [1..1] value with @xsi:type="CE", where the @code SHALL be selected from ValueSet Problem Status Value Set 2.16.840.1.113883.3.88.12.80.68 DYNAMIC (CONF:7322).
// 55561003 SNOMED CT Active
// 73425007 SNOMED CT Inactive
// 413322009 SNOMED CT Resolved
String sc = cda.getChild(child, "value").getAttribute("code");
if (sc.equals("55561003")) {
ai.setClinicalStatus(AllergyIntoleranceClinicalStatus.ACTIVE);
ai.setVerificationStatus(AllergyIntoleranceVerificationStatus.CONFIRMED);
} else
ai.setClinicalStatus(AllergyIntoleranceClinicalStatus.RESOLVED);
} else if (cda.hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.9")) {
ai.getReaction().add(processAdverseReactionObservation(child));
}
}
// SHOULD contain zero or one [0..1] entryRelationship (CONF:9961) such that it SHALL contain exactly one [1..1] Severity Observation (templateId:2.16.840.1.113883.10.20.22.4.8) (CONF:9963).
ai.setCriticality(readCriticality(cda.getSeverity(obs)));
}
}
use of org.hl7.fhir.r4.model.Consent.ConsentState.INACTIVE in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeValueSetValueSetExpansionContainsComponent.
protected void composeValueSetValueSetExpansionContainsComponent(Complex parent, String parentType, String name, ValueSet.ValueSetExpansionContainsComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "contains", name, element, index);
if (element.hasSystemElement())
composeUri(t, "ValueSet", "system", element.getSystemElement(), -1);
if (element.hasAbstractElement())
composeBoolean(t, "ValueSet", "abstract", element.getAbstractElement(), -1);
if (element.hasInactiveElement())
composeBoolean(t, "ValueSet", "inactive", element.getInactiveElement(), -1);
if (element.hasVersionElement())
composeString(t, "ValueSet", "version", element.getVersionElement(), -1);
if (element.hasCodeElement())
composeCode(t, "ValueSet", "code", element.getCodeElement(), -1);
if (element.hasDisplayElement())
composeString(t, "ValueSet", "display", element.getDisplayElement(), -1);
for (int i = 0; i < element.getDesignation().size(); i++) composeValueSetConceptReferenceDesignationComponent(t, "ValueSet", "designation", element.getDesignation().get(i), i);
for (int i = 0; i < element.getContains().size(); i++) composeValueSetValueSetExpansionContainsComponent(t, "ValueSet", "contains", element.getContains().get(i), i);
}
Aggregations