Search in sources :

Example 96 with ContactPoint

use of org.hl7.fhir.r5.model.ContactPoint in project integration-adaptor-111 by nhsconnect.

the class ContactPointMapperTest method shouldMapContactPointEmail.

@Test
public void shouldMapContactPointEmail() {
    TEL tel = TEL.Factory.newInstance();
    tel.setValue(EMAIL_ADDRESS);
    tel.setUse(singletonList(USE_ITK_MOBILE));
    tel.addNewUseablePeriod();
    when(periodMapper.mapPeriod(ArgumentMatchers.any())).thenReturn(period);
    ContactPoint contactPoint = contactPointMapper.mapContactPoint(tel);
    assertThat(contactPoint.getValue()).isEqualTo(EMAIL_ADDRESS);
    assertThat(contactPoint.getUse()).isEqualTo(MOBILE);
    assertThat(contactPoint.getPeriod()).isEqualTo(period);
    assertThat(contactPoint.getSystem()).isEqualTo(EMAIL);
}
Also used : ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint) TEL(uk.nhs.connect.iucds.cda.ucr.TEL) Test(org.junit.jupiter.api.Test)

Example 97 with ContactPoint

use of org.hl7.fhir.r5.model.ContactPoint in project kindling by HL7.

the class CodeListToValueSetParser method generateConceptMapV3.

private void generateConceptMapV3(String v3map, ValueSet vs, CodeSystem cs) throws Exception {
    if (!v3map.startsWith("http://terminology.hl7.org/ValueSet/v3-"))
        v3map = "http://terminology.hl7.org/ValueSet/v3-" + v3map;
    ConceptMap cm = new ConceptMap();
    cm.setVersion(version);
    cm.setId("cm-" + vs.getId() + "-v3");
    cm.setUserData("path", cm.getId() + ".html");
    cm.setUserData("generate", true);
    cm.setUrl("http://hl7.org/fhir/ConceptMap/" + cm.getId());
    cm.setName("v3." + vs.getName());
    cm.setTitle("v3 map for " + vs.present());
    cm.setPublisher("HL7 (FHIR Project)");
    for (ContactDetail cc : vs.getContact()) {
        ContactDetail cd = cm.addContact();
        cd.setName(cc.getName());
        for (ContactPoint ccs : cc.getTelecom()) cd.addTelecom(ccs.copy());
    }
    cm.setCopyright(vs.getCopyright());
    // until we publish DSTU, then .review
    cm.setStatus(vs.getStatus());
    cm.setDate(vs.getDate());
    cm.setSource(Factory.newCanonical(vs.getUrl()));
    cm.setTarget(Factory.newCanonical(v3map));
    if (cs != null)
        processV3ConceptDefs(cm, cs.getUrl(), cs.getConcept());
    for (ConceptSetComponent cc : vs.getCompose().getInclude()) for (ConceptReferenceComponent c : cc.getConcept()) {
        processV3Map(cm, cc.getSystem(), c.getCode(), c.getUserString("v2"));
    }
    maps.see(cm, packageInfo);
}
Also used : ContactDetail(org.hl7.fhir.r5.model.ContactDetail) ContactPoint(org.hl7.fhir.r5.model.ContactPoint) ConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent) ConceptMap(org.hl7.fhir.r5.model.ConceptMap) ConceptReferenceComponent(org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent)

Example 98 with ContactPoint

use of org.hl7.fhir.r5.model.ContactPoint in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeContactPoint.

protected void composeContactPoint(Complex parent, String parentType, String name, ContactPoint element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeElement(t, "ContactPoint", name, element, index);
    if (element.hasSystemElement())
        composeEnum(t, "ContactPoint", "system", element.getSystemElement(), -1);
    if (element.hasValueElement())
        composeString(t, "ContactPoint", "value", element.getValueElement(), -1);
    if (element.hasUseElement())
        composeEnum(t, "ContactPoint", "use", element.getUseElement(), -1);
    if (element.hasRankElement())
        composePositiveInt(t, "ContactPoint", "rank", element.getRankElement(), -1);
    if (element.hasPeriod())
        composePeriod(t, "ContactPoint", "period", element.getPeriod(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 99 with ContactPoint

use of org.hl7.fhir.r5.model.ContactPoint in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeContactPoint.

protected void composeContactPoint(Complex parent, String parentType, String name, ContactPoint element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeElement(t, "ContactPoint", name, element, index);
    if (element.hasSystemElement())
        composeEnum(t, "ContactPoint", "system", element.getSystemElement(), -1);
    if (element.hasValueElement())
        composeString(t, "ContactPoint", "value", element.getValueElement(), -1);
    if (element.hasUseElement())
        composeEnum(t, "ContactPoint", "use", element.getUseElement(), -1);
    if (element.hasRankElement())
        composePositiveInt(t, "ContactPoint", "rank", element.getRankElement(), -1);
    if (element.hasPeriod())
        composePeriod(t, "ContactPoint", "period", element.getPeriod(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 100 with ContactPoint

use of org.hl7.fhir.r5.model.ContactPoint in project org.hl7.fhir.core by hapifhir.

the class NarrativeGenerator method displayLeaf.

private boolean displayLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, String name, boolean showCodeDetails) throws FHIRException, UnsupportedEncodingException, IOException {
    if (ew == null)
        return false;
    Base e = ew.getBase();
    Map<String, String> displayHints = readDisplayHints(defn);
    if (name.endsWith("[x]"))
        name = name.substring(0, name.length() - 3);
    if (!showCodeDetails && e instanceof PrimitiveType && isDefault(displayHints, ((PrimitiveType) e)))
        return false;
    if (e instanceof StringType) {
        x.addText(name + ": " + ((StringType) e).getValue());
        return true;
    } else if (e instanceof CodeType) {
        x.addText(name + ": " + ((CodeType) e).getValue());
        return true;
    } else if (e instanceof IdType) {
        x.addText(name + ": " + ((IdType) e).getValue());
        return true;
    } else if (e instanceof DateTimeType) {
        x.addText(name + ": " + ((DateTimeType) e).toHumanDisplay());
        return true;
    } else if (e instanceof InstantType) {
        x.addText(name + ": " + ((InstantType) e).toHumanDisplay());
        return true;
    } else if (e instanceof Extension) {
        x.addText("Extensions: todo");
        return true;
    } else if (e instanceof org.hl7.fhir.dstu2.model.DateType) {
        x.addText(name + ": " + ((org.hl7.fhir.dstu2.model.DateType) e).toHumanDisplay());
        return true;
    } else if (e instanceof Enumeration) {
        // todo: look up a display name if there is one
        x.addText(((Enumeration<?>) e).getValue().toString());
        return true;
    } else if (e instanceof BooleanType) {
        if (((BooleanType) e).getValue()) {
            x.addText(name);
            return true;
        }
    } else if (e instanceof CodeableConcept) {
        renderCodeableConcept((CodeableConcept) e, x, showCodeDetails);
        return true;
    } else if (e instanceof Coding) {
        renderCoding((Coding) e, x, showCodeDetails);
        return true;
    } else if (e instanceof Annotation) {
        renderAnnotation((Annotation) e, x, showCodeDetails);
        return true;
    } else if (e instanceof org.hl7.fhir.dstu2.model.IntegerType) {
        x.addText(Integer.toString(((org.hl7.fhir.dstu2.model.IntegerType) e).getValue()));
        return true;
    } else if (e instanceof org.hl7.fhir.dstu2.model.DecimalType) {
        x.addText(((org.hl7.fhir.dstu2.model.DecimalType) e).getValue().toString());
        return true;
    } else if (e instanceof Identifier) {
        renderIdentifier((Identifier) e, x);
        return true;
    } else if (e instanceof HumanName) {
        renderHumanName((HumanName) e, x);
        return true;
    } else if (e instanceof SampledData) {
        renderSampledData((SampledData) e, x);
        return true;
    } else if (e instanceof Address) {
        renderAddress((Address) e, x);
        return true;
    } else if (e instanceof ContactPoint) {
        renderContactPoint((ContactPoint) e, x);
        return true;
    } else if (e instanceof Timing) {
        renderTiming((Timing) e, x);
        return true;
    } else if (e instanceof Quantity) {
        renderQuantity((Quantity) e, x, showCodeDetails);
        return true;
    } else if (e instanceof Ratio) {
        renderQuantity(((Ratio) e).getNumerator(), x, showCodeDetails);
        x.addText("/");
        renderQuantity(((Ratio) e).getDenominator(), x, showCodeDetails);
        return true;
    } else if (e instanceof Period) {
        Period p = (Period) e;
        x.addText(name + ": ");
        x.addText(!p.hasStart() ? "??" : p.getStartElement().toHumanDisplay());
        x.addText(" --> ");
        x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
        return true;
    } else if (e instanceof Reference) {
        Reference r = (Reference) e;
        if (r.hasDisplayElement())
            x.addText(r.getDisplay());
        else if (r.hasReferenceElement()) {
            ResourceWithReference tr = resolveReference(res, r.getReference());
            // getDisplayForReference(tr.getReference()));
            x.addText(tr == null ? r.getReference() : "????");
        } else
            x.addText("??");
        return true;
    } else if (e instanceof Narrative) {
        return false;
    } else if (e instanceof Resource) {
        return false;
    } else if (!(e instanceof Attachment))
        throw new NotImplementedException("type " + e.getClass().getName() + " not handled yet");
    return false;
}
Also used : Address(org.hl7.fhir.dstu2.model.Address) StringType(org.hl7.fhir.dstu2.model.StringType) NotImplementedException(org.apache.commons.lang3.NotImplementedException) Attachment(org.hl7.fhir.dstu2.model.Attachment) HumanName(org.hl7.fhir.dstu2.model.HumanName) ContactPoint(org.hl7.fhir.dstu2.model.ContactPoint) Identifier(org.hl7.fhir.dstu2.model.Identifier) Coding(org.hl7.fhir.dstu2.model.Coding) Narrative(org.hl7.fhir.dstu2.model.Narrative) SampledData(org.hl7.fhir.dstu2.model.SampledData) PrimitiveType(org.hl7.fhir.dstu2.model.PrimitiveType) Ratio(org.hl7.fhir.dstu2.model.Ratio) InstantType(org.hl7.fhir.dstu2.model.InstantType) Enumeration(org.hl7.fhir.dstu2.model.Enumeration) Reference(org.hl7.fhir.dstu2.model.Reference) BooleanType(org.hl7.fhir.dstu2.model.BooleanType) Resource(org.hl7.fhir.dstu2.model.Resource) DomainResource(org.hl7.fhir.dstu2.model.DomainResource) Quantity(org.hl7.fhir.dstu2.model.Quantity) Period(org.hl7.fhir.dstu2.model.Period) Base(org.hl7.fhir.dstu2.model.Base) Annotation(org.hl7.fhir.dstu2.model.Annotation) IdType(org.hl7.fhir.dstu2.model.IdType) Extension(org.hl7.fhir.dstu2.model.Extension) DateTimeType(org.hl7.fhir.dstu2.model.DateTimeType) CodeType(org.hl7.fhir.dstu2.model.CodeType) EventTiming(org.hl7.fhir.dstu2.model.Timing.EventTiming) Timing(org.hl7.fhir.dstu2.model.Timing) CodeableConcept(org.hl7.fhir.dstu2.model.CodeableConcept)

Aggregations

ContactPoint (org.hl7.fhir.r4.model.ContactPoint)53 Test (org.junit.Test)28 Address (org.hl7.fhir.r4.model.Address)15 PersonAttribute (org.openmrs.PersonAttribute)15 NotImplementedException (org.apache.commons.lang3.NotImplementedException)14 ContactPoint (org.hl7.fhir.dstu3.model.ContactPoint)14 Identifier (org.hl7.fhir.r4.model.Identifier)14 Test (org.junit.jupiter.api.Test)14 HumanName (org.hl7.fhir.r4.model.HumanName)13 ProviderAttribute (org.openmrs.ProviderAttribute)11 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)10 ArrayList (java.util.ArrayList)9 IdType (org.hl7.fhir.dstu3.model.IdType)9 Organization (org.hl7.fhir.r4.model.Organization)9 Patient (org.hl7.fhir.r4.model.Patient)9 HashSet (java.util.HashSet)8 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)8 ContactDetail (org.hl7.fhir.r5.model.ContactDetail)6 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)6 HashMap (java.util.HashMap)5