Search in sources :

Example 71 with Immunization

use of org.hl7.fhir.r4.model.Immunization in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeImmunization.

protected void composeImmunization(Complex parent, String parentType, String name, Immunization element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Immunization", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Immunization", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "Immunization", "status", element.getStatusElement(), -1);
    if (element.hasNotGivenElement())
        composeBoolean(t, "Immunization", "notGiven", element.getNotGivenElement(), -1);
    if (element.hasVaccineCode())
        composeCodeableConcept(t, "Immunization", "vaccineCode", element.getVaccineCode(), -1);
    if (element.hasPatient())
        composeReference(t, "Immunization", "patient", element.getPatient(), -1);
    if (element.hasEncounter())
        composeReference(t, "Immunization", "encounter", element.getEncounter(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "Immunization", "date", element.getDateElement(), -1);
    if (element.hasPrimarySourceElement())
        composeBoolean(t, "Immunization", "primarySource", element.getPrimarySourceElement(), -1);
    if (element.hasReportOrigin())
        composeCodeableConcept(t, "Immunization", "reportOrigin", element.getReportOrigin(), -1);
    if (element.hasLocation())
        composeReference(t, "Immunization", "location", element.getLocation(), -1);
    if (element.hasManufacturer())
        composeReference(t, "Immunization", "manufacturer", element.getManufacturer(), -1);
    if (element.hasLotNumberElement())
        composeString(t, "Immunization", "lotNumber", element.getLotNumberElement(), -1);
    if (element.hasExpirationDateElement())
        composeDate(t, "Immunization", "expirationDate", element.getExpirationDateElement(), -1);
    if (element.hasSite())
        composeCodeableConcept(t, "Immunization", "site", element.getSite(), -1);
    if (element.hasRoute())
        composeCodeableConcept(t, "Immunization", "route", element.getRoute(), -1);
    if (element.hasDoseQuantity())
        composeQuantity(t, "Immunization", "doseQuantity", element.getDoseQuantity(), -1);
    for (int i = 0; i < element.getPractitioner().size(); i++) composeImmunizationImmunizationPractitionerComponent(t, "Immunization", "practitioner", element.getPractitioner().get(i), i);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "Immunization", "note", element.getNote().get(i), i);
    if (element.hasExplanation())
        composeImmunizationImmunizationExplanationComponent(t, "Immunization", "explanation", element.getExplanation(), -1);
    for (int i = 0; i < element.getReaction().size(); i++) composeImmunizationImmunizationReactionComponent(t, "Immunization", "reaction", element.getReaction().get(i), i);
    for (int i = 0; i < element.getVaccinationProtocol().size(); i++) composeImmunizationImmunizationVaccinationProtocolComponent(t, "Immunization", "vaccinationProtocol", element.getVaccinationProtocol().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 72 with Immunization

use of org.hl7.fhir.r4.model.Immunization in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeImmunizationImmunizationEducationComponent.

protected void composeImmunizationImmunizationEducationComponent(Complex parent, String parentType, String name, Immunization.ImmunizationEducationComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "education", name, element, index);
    if (element.hasDocumentTypeElement())
        composeString(t, "Immunization", "documentType", element.getDocumentTypeElement(), -1);
    if (element.hasReferenceElement())
        composeUri(t, "Immunization", "reference", element.getReferenceElement(), -1);
    if (element.hasPublicationDateElement())
        composeDateTime(t, "Immunization", "publicationDate", element.getPublicationDateElement(), -1);
    if (element.hasPresentationDateElement())
        composeDateTime(t, "Immunization", "presentationDate", element.getPresentationDateElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 73 with Immunization

use of org.hl7.fhir.r4.model.Immunization in project org.hl7.fhir.core by hapifhir.

the class ArgonautConverter method processImmunizationsSection.

private void processImmunizationsSection(CDAUtilities cda, Convert convert, Element section, Context context) throws Exception {
    scanSection("Immunizations", section);
    ListResource list = new ListResource();
    list.setId(context.getBaseId() + "-list-immunizations");
    list.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/list-daf-dafimmunizationlist");
    list.setSubject(context.getSubjectRef());
    list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")), null));
    list.setTitle(cda.getChild(section, "title").getTextContent());
    list.setStatus(ListStatus.CURRENT);
    list.setMode(ListMode.SNAPSHOT);
    list.setDateElement(context.getNow());
    list.setSource(context.getAuthorRef());
    buildNarrative(list, cda.getChild(section, "text"));
    int i = 0;
    for (Element c : cda.getChildren(section, "entry")) {
        // allergy problem act
        Element sa = cda.getChild(c, "substanceAdministration");
        Immunization imm = new Immunization();
        imm.setId(context.getBaseId() + "-immunization-" + i);
        imm.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/immunization-daf-dafimmunization");
        i++;
        imm.setPatient(context.getSubjectRef());
        imm.setEncounter(new Reference().setReference("Encounter/" + context.getEncounter().getId()));
        imm.setNotGiven("true".equals(sa.getAttribute("negationInd")));
        imm.setStatus(convertImmunizationStatus(cda.getChild(sa, "statusCode")));
        boolean found = false;
        for (Element e : cda.getChildren(sa, "id")) {
            Identifier id = convert.makeIdentifierFromII(e);
            imm.getIdentifier().add(id);
        }
        if (!found) {
            list.addEntry().setItem(new Reference().setReference("Immunization/" + imm.getId()));
            imm.setDateElement(convert.makeDateTimeFromTS(cda.getChild(cda.getChild(sa, "effectiveTime"), "low")));
            if (imm.getNotGiven()) {
                Element reason = cda.getChild(cda.getChildByAttribute(sa, "entryRelationship", "typeCode", "RSON"), "observation");
                imm.setExplanation(new ImmunizationExplanationComponent());
                imm.getExplanation().addReasonNotGiven(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(reason, "code")), null));
            }
            Element mm = cda.getChild(cda.getChild(cda.getChild(sa, "consumable"), "manufacturedProduct"), "manufacturedMaterial");
            imm.setVaccineCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(mm, "code")), null));
            imm.setRoute(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(sa, "routeCode")), null));
            if (cda.getChild(mm, "lotNumberText") != null)
                imm.setLotNumber(cda.getChild(mm, "lotNumberText").getTextContent());
            Element mr = cda.getChild(cda.getChild(cda.getChild(sa, "consumable"), "manufacturedProduct"), "manufacturerOrganization");
            if (mr != null)
                imm.setManufacturer(new Reference().setDisplay(cda.getChild(mr, "name").getTextContent()));
            // the problem with this is that you can't have just a dose sequence number
            // Element subject = cda.getChild(cda.getChildByAttribute(sa, "entryRelationship", "typeCode", "SUBJ"), "observation");
            // if (subject != null)
            // imm.addVaccinationProtocol().setDoseSequence(Integer.parseInt(cda.getChild(subject, "value").getAttribute("value")));
            boolean hasprf = false;
            for (Element e : cda.getChildren(sa, "performer")) {
                if (imm.hasPractitioner())
                    throw new Error("additional performer discovered");
                Practitioner p = processPerformer(cda, convert, context, e, "assignedEntity", "assignedPerson");
                Reference ref = new Reference().setReference("Practitioner/" + p.getId()).setDisplay(p.getUserString("display"));
                imm.addPractitioner().setActor(ref).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("AP")));
                hasprf = true;
            }
            imm.setPrimarySource(hasprf);
            saveResource(imm);
        }
    }
    saveResource(list);
}
Also used : Element(org.w3c.dom.Element) ImmunizationExplanationComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent)

Example 74 with Immunization

use of org.hl7.fhir.r4.model.Immunization in project org.hl7.fhir.core by hapifhir.

the class TurtleTests method test_immunization_example_refused.

@Test
public void test_immunization_example_refused() throws FileNotFoundException, IOException, Exception {
    System.out.println("immunization-example-refused.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\immunization-example-refused.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 75 with Immunization

use of org.hl7.fhir.r4.model.Immunization in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeImmunizationImmunizationExplanationComponent.

protected void composeImmunizationImmunizationExplanationComponent(Complex parent, String parentType, String name, Immunization.ImmunizationExplanationComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "explanation", name, element, index);
    for (int i = 0; i < element.getReason().size(); i++) composeCodeableConcept(t, "Immunization", "reason", element.getReason().get(i), i);
    for (int i = 0; i < element.getReasonNotGiven().size(); i++) composeCodeableConcept(t, "Immunization", "reasonNotGiven", element.getReasonNotGiven().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Aggregations

Immunization (org.hl7.fhir.r4.model.Immunization)47 Test (org.junit.Test)27 Test (org.junit.jupiter.api.Test)22 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)18 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)15 Resource (org.hl7.fhir.r4.model.Resource)13 OperationOutcome (org.hl7.fhir.r4.model.OperationOutcome)8 Bundle (org.hl7.fhir.r4.model.Bundle)7 Organization (org.hl7.fhir.r4.model.Organization)7 BaseFhirProvenanceResourceTest (org.openmrs.module.fhir2.providers.BaseFhirProvenanceResourceTest)6 Date (java.util.Date)5 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)5 IdType (org.hl7.fhir.r4.model.IdType)5 Observation (org.hl7.fhir.r4.model.Observation)5 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)5 InputStream (java.io.InputStream)4 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)4 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)4 Obs (org.openmrs.Obs)4 FhirContext (ca.uhn.fhir.context.FhirContext)3