p.getModifierExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-planned", Factory.newBoolean(true), false)); p.getModifierExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-status", Factory.newCode(cda.getStatus(procedure)), false)); p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-priority", convert.makeCodeableConceptFromCD(cda.getChild(procedure, "priorityCode")), false)); p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-method", convert.makeCodeableConceptFromCD(cda.getChild(procedure, "methodCode")), false)); p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/implanted-devices", Factory.makeReference(processDevice(participantRole, p)), false)); } else if (cda.hasTemplateId(participantRole, "2.16.840.1.113883.10.20.22.4.32")) { p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/location", Factory.makeReference(processSDLocation(participantRole, p)), false)); Extension n = Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions", null, true); n.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions-type", convert.makeCodeableConceptFromCD(cda.getChild(a, "code")), false)); n.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions-text", convert.makeStringFromED(cda.getChild(a, "text")), false)); p.getExtension().add(n); } else if (cda.hasTemplateId(a, "2.16.840.1.113883.10.20.22.4.19")) {
item.setFlag(Factory.newCodeableConcept(s, "http://hl7.org/fhir/v3/ActStatus", s)); if (s.equals("aborted")) // only on this condition? item.setDeleted(true); item.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/list-period", p, false)); if (p.getEnd() != null) item.setDate(p.getEnd()); ai.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/allergyintolerance-period", convert.makePeriodFromIVL(cda.getChild(obs, "effectiveTime")), false)); 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));
public Type makeStringFromED(Element e) throws Exception { if (e == null) return null; if (cda.getChild(e, "reference") != null) { if (cda.getChild(e, "reference").getAttribute("value").startsWith("#")) { Element t = cda.getByXmlId(cda.getChild(e, "reference").getAttribute("value").substring(1)); String ot = t.getTextContent().trim(); return Utilities.noString(ot) ? null : Factory.newString_(ot); } else throw new Exception("external references not handled yet "+cda.getChild(e, "reference").getAttribute("value")); } return Factory.newString_(e.getTextContent()); }
pat.setBirthDateElement(convert.makeDateFromTS(cda.getChild(p, "birthTime"))); pat.setMaritalStatus(convert.makeCodeableConceptFromCD(cda.getChild(p, "maritalStatusCode"))); pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.DAF_NAME_RACE, convert.makeCodeableConceptFromCD(cda.getChild(p, "raceCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.DAF_NAME_ETHNICITY, convert.makeCodeableConceptFromCD(cda.getChild(p, "ethnicGroupCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_BIRTHPLACE, convert.makeAddressFromAD(cda.getChild(p, new String[] {"birthplace", "place", "addr"})), false)); guardian.getRelationship().add(Factory.newCodeableConcept("GUARD", "urn:oid:2.16.840.1.113883.5.110", "guardian")); Element g = cda.getChild(p, "guardian"); for (Element e : cda.getChildren(g, "addr")) cc.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_LANG_PROF, convert.makeCodeableConceptFromCD(cda.getChild(l, "modeCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); pat.setManagingOrganization(Factory.makeReference(makeOrganization(cda.getChild(pr, "providerOrganization"), "Provider"))); return addReference(pat, "Subject", makeUUIDReference());
cda.checkTemplateId(so, "2.16.840.1.113883.10.20.15.3.8"); obs.setCode(Factory.newCodeableConcept("11449-6", "http://loinc.org", "Pregnancy Status")); break; case SmokingStatus: cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.78"); obs.setCode(Factory.newCodeableConcept("72166-2", "http://loinc.org", "Tobacco Smoking Status")); break; case TobaccoUse: cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.12"); obs.setCode(Factory.newCodeableConcept("11367-0", "http://loinc.org", "History of Tobacco Use")); obs.setValue(Factory.newCodeableConcept("60001007", "http://snomed.info/sct", "Not pregnant")); } else { obs.getRelated().add(or); or.setType(ObservationRelationshipType.HASMEMBER); or.setTarget(Factory.makeReference("#"+id)); co.setCode(Factory.newCodeableConcept("11778-8", "http://loinc.org", "Delivery date Estimated")); co.setValue(convert.makeDateTimeFromTS(cda.getChild(dd, "value"))); // not legal, see gForge http://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=3125&start=0
public static void addDisplayHint(Element def, String hint) { if (!StringUtils.isBlank(hint)) def.getExtension().add(Factory.newExtension(EXT_DISPLAY_HINT, Factory.newString_(hint), true)); }
public static void addAllowedResource(QuestionnaireItemComponent group, String value) { group.getExtension().add(Factory.newExtension(EXT_ALLOWEDRESOURCE, Factory.newCode(value), true)); }
protected ListEntryComponent addItemToList(ListResource list, DomainResource ai) throws Exception { list.getContained().add(ai); String n = nextRef(); ai.setId(n); ListEntryComponent item = new ListResource.ListEntryComponent(); list.getEntry().add(item); item.setItem(Factory.makeReference("#"+n)); return item; }
public static void addIdentifier(Element element, Identifier value) { element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true)); }
public static void addMax(QuestionnaireItemComponent item, int max) { item.getExtension().add(Factory.newExtension(EXT_MAXOCCURS, Factory.newInteger(max), true)); }
public Type makeCodeableConceptFromNullFlavor(String nf) throws Exception { // Some nullFlavors have explicit values in value sets. This can only be called where there aren't. if (nf == null || "".equals(nf)) return null; if ("NI".equals(nf)) return null; // there's no code for this if ("NA".equals(nf)) return Factory.newCodeableConcept("unsupported", "http://hl7.org/fhir/data-absent-reason", "Unsupported"); // todo: is this reasonable? Why else would you use N/A? if ("UNK".equals(nf)) return Factory.newCodeableConcept("unknown", "http://hl7.org/fhir/data-absent-reason", "Unknown"); if ("ASKU".equals(nf)) return Factory.newCodeableConcept("asked", "http://hl7.org/fhir/data-absent-reason", "Asked/Unknown"); if ("NAV".equals(nf)) return Factory.newCodeableConcept("temp", "http://hl7.org/fhir/data-absent-reason", "Temporarily Unavailable"); if ("NASK".equals(nf)) return Factory.newCodeableConcept("notasked", "http://hl7.org/fhir/data-absent-reason", "Not Asked"); if ("MSK".equals(nf)) return Factory.newCodeableConcept("masked", "http://hl7.org/fhir/data-absent-reason", "Masked"); if ("OTH".equals(nf)) return null; // well, what should be done? return null; // well, what should be done? }
public Type convertToType(Element element) throws FHIRException { Type b = new Factory().create(element.fhirType()); if (b instanceof PrimitiveType) { ((PrimitiveType) b).setValueAsString(element.primitiveValue()); } else { for (Element child : element.getChildren()) { b.setProperty(child.getName(), convertToType(child)); } } return b; }
focus.setExpansion(new ValueSet.ValueSetExpansionComponent()); focus.getExpansion().setTimestampElement(DateTimeType.now()); focus.getExpansion().setIdentifier(Factory.createUUID()); if (!profile.getUrl().startsWith("urn:uuid:")) focus.getExpansion().addParameter().setName("profile").setValue(new UriType(profile.getUrl()));
public static void addVSComment(ConceptSetComponent nc, String comment) { if (!StringUtils.isBlank(comment)) nc.getExtension().add(Factory.newExtension(EXT_VS_COMMENT, Factory.newString_(comment), true)); } public static void addVSComment(ConceptReferenceComponent nc, String comment) {
pat.setBirthDateElement(convert.makeDateFromTS(cda.getChild(p, "birthTime"))); pat.setMaritalStatus(convert.makeCodeableConceptFromCD(cda.getChild(p, "maritalStatusCode"))); pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.DAF_NAME_RACE, convert.makeCodeableConceptFromCD(cda.getChild(p, "raceCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.DAF_NAME_ETHNICITY, convert.makeCodeableConceptFromCD(cda.getChild(p, "ethnicGroupCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_BIRTHPLACE, convert.makeAddressFromAD(cda.getChild(p, new String[] {"birthplace", "place", "addr"})), false)); guardian.getRelationship().add(Factory.newCodeableConcept("GUARD", "urn:oid:2.16.840.1.113883.5.110", "guardian")); Element g = cda.getChild(p, "guardian"); for (Element e : cda.getChildren(g, "addr")) cc.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_LANG_PROF, convert.makeCodeableConceptFromCD(cda.getChild(l, "modeCode")), false)); pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); pat.setManagingOrganization(Factory.makeReference(makeOrganization(cda.getChild(pr, "providerOrganization"), "Provider"))); return addReference(pat, "Subject", makeUUIDReference());
public static void addSubsumes(ConceptDefinitionComponent nc, String code) { nc.getModifierExtension().add(Factory.newExtension(EXT_SUBSUMES, Factory.newCode(code), true)); }
Practitioner p = null; if (uri != null) { ref = Factory.makeReference(uri); p = practitionerCache.get(uri); p.setId(n); r.getContained().add(p); ref = Factory.makeReference("#"+n); } else { ref = Factory.makeReference(addReference(p, "Practitioner", uri));
public static void addStringExtension(DomainResource e, String url, String content) { if (!StringUtils.isBlank(content)) { Extension ex = getExtension(e, url); if (ex != null) ex.setValue(new StringType(content)); else e.getExtension().add(Factory.newExtension(url, new StringType(content), true)); } }
cda.checkTemplateId(so, "2.16.840.1.113883.10.20.15.3.8"); obs.setCode(Factory.newCodeableConcept("11449-6", "http://loinc.org", "Pregnancy Status")); break; case SmokingStatus: cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.78"); obs.setCode(Factory.newCodeableConcept("72166-2", "http://loinc.org", "Tobacco Smoking Status")); break; case TobaccoUse: cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.12"); obs.setCode(Factory.newCodeableConcept("11367-0", "http://loinc.org", "History of Tobacco Use")); obs.setValue(Factory.newCodeableConcept("60001007", "http://snomed.info/sct", "Not pregnant")); } else { obs.getRelated().add(or); or.setType(ObservationRelationshipType.HASMEMBER); or.setTarget(Factory.makeReference("#"+id)); co.setCode(Factory.newCodeableConcept("11778-8", "http://loinc.org", "Delivery date Estimated")); co.setValue(convert.makeDateTimeFromTS(cda.getChild(dd, "value"))); // not legal, see gForge http://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=3125&start=0
public static void addMin(QuestionnaireItemComponent item, int min) { item.getExtension().add(Factory.newExtension(EXT_MINOCCURS, Factory.newInteger(min), true)); }