Search in sources :

Example 1 with FamilyMemberHistory

use of org.hl7.fhir.r4.model.FamilyMemberHistory in project elexis-server by elexis.

the class FamilyMemberHistoryResourceProvider method createFamilyMemberHistory.

@Create
public MethodOutcome createFamilyMemberHistory(@ResourceParam FamilyMemberHistory familyMemberHistory) {
    MethodOutcome outcome = new MethodOutcome();
    Optional<IFamilyMemberHistory> exists = getTransformer().getLocalObject(familyMemberHistory);
    if (exists.isPresent()) {
        outcome.setCreated(false);
        outcome.setId(new IdType(familyMemberHistory.getId()));
    } else {
        Optional<IFamilyMemberHistory> created = getTransformer().createLocalObject(familyMemberHistory);
        if (created.isPresent()) {
            outcome.setCreated(true);
            outcome.setId(new IdType(created.get().getId()));
        } else {
            throw new InternalErrorException("Creation failed");
        }
    }
    return outcome;
}
Also used : IFamilyMemberHistory(ch.elexis.core.findings.IFamilyMemberHistory) InternalErrorException(ca.uhn.fhir.rest.server.exceptions.InternalErrorException) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) IdType(org.hl7.fhir.r4.model.IdType) Create(ca.uhn.fhir.rest.annotation.Create)

Example 2 with FamilyMemberHistory

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

the class RdfParser method composeFamilyMemberHistory.

protected void composeFamilyMemberHistory(Complex parent, String parentType, String name, FamilyMemberHistory element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "FamilyMemberHistory", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "FamilyMemberHistory", "identifier", element.getIdentifier().get(i), i);
    if (element.hasPatient())
        composeReference(t, "FamilyMemberHistory", "patient", element.getPatient(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "FamilyMemberHistory", "date", element.getDateElement(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "FamilyMemberHistory", "status", element.getStatusElement(), -1);
    if (element.hasNameElement())
        composeString(t, "FamilyMemberHistory", "name", element.getNameElement(), -1);
    if (element.hasRelationship())
        composeCodeableConcept(t, "FamilyMemberHistory", "relationship", element.getRelationship(), -1);
    if (element.hasGenderElement())
        composeEnum(t, "FamilyMemberHistory", "gender", element.getGenderElement(), -1);
    if (element.hasBorn())
        composeType(t, "FamilyMemberHistory", "born", element.getBorn(), -1);
    if (element.hasAge())
        composeType(t, "FamilyMemberHistory", "age", element.getAge(), -1);
    if (element.hasDeceased())
        composeType(t, "FamilyMemberHistory", "deceased", element.getDeceased(), -1);
    if (element.hasNote())
        composeAnnotation(t, "FamilyMemberHistory", "note", element.getNote(), -1);
    for (int i = 0; i < element.getCondition().size(); i++) composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(t, "FamilyMemberHistory", "condition", element.getCondition().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 3 with FamilyMemberHistory

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

the class RdfParser method composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent.

protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(Complex parent, String parentType, String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "condition", name, element, index);
    if (element.hasCode())
        composeCodeableConcept(t, "FamilyMemberHistory", "code", element.getCode(), -1);
    if (element.hasOutcome())
        composeCodeableConcept(t, "FamilyMemberHistory", "outcome", element.getOutcome(), -1);
    if (element.hasOnset())
        composeType(t, "FamilyMemberHistory", "onset", element.getOnset(), -1);
    if (element.hasNote())
        composeAnnotation(t, "FamilyMemberHistory", "note", element.getNote(), -1);
}
Also used : Complex(org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)

Example 4 with FamilyMemberHistory

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

the class RdfParser method composeFamilyMemberHistory.

protected void composeFamilyMemberHistory(Complex parent, String parentType, String name, FamilyMemberHistory element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "FamilyMemberHistory", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "FamilyMemberHistory", "identifier", element.getIdentifier().get(i), i);
    for (int i = 0; i < element.getDefinition().size(); i++) composeReference(t, "FamilyMemberHistory", "definition", element.getDefinition().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "FamilyMemberHistory", "status", element.getStatusElement(), -1);
    if (element.hasNotDoneElement())
        composeBoolean(t, "FamilyMemberHistory", "notDone", element.getNotDoneElement(), -1);
    if (element.hasNotDoneReason())
        composeCodeableConcept(t, "FamilyMemberHistory", "notDoneReason", element.getNotDoneReason(), -1);
    if (element.hasPatient())
        composeReference(t, "FamilyMemberHistory", "patient", element.getPatient(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "FamilyMemberHistory", "date", element.getDateElement(), -1);
    if (element.hasNameElement())
        composeString(t, "FamilyMemberHistory", "name", element.getNameElement(), -1);
    if (element.hasRelationship())
        composeCodeableConcept(t, "FamilyMemberHistory", "relationship", element.getRelationship(), -1);
    if (element.hasGenderElement())
        composeEnum(t, "FamilyMemberHistory", "gender", element.getGenderElement(), -1);
    if (element.hasBorn())
        composeType(t, "FamilyMemberHistory", "born", element.getBorn(), -1);
    if (element.hasAge())
        composeType(t, "FamilyMemberHistory", "age", element.getAge(), -1);
    if (element.hasEstimatedAgeElement())
        composeBoolean(t, "FamilyMemberHistory", "estimatedAge", element.getEstimatedAgeElement(), -1);
    if (element.hasDeceased())
        composeType(t, "FamilyMemberHistory", "deceased", element.getDeceased(), -1);
    for (int i = 0; i < element.getReasonCode().size(); i++) composeCodeableConcept(t, "FamilyMemberHistory", "reasonCode", element.getReasonCode().get(i), i);
    for (int i = 0; i < element.getReasonReference().size(); i++) composeReference(t, "FamilyMemberHistory", "reasonReference", element.getReasonReference().get(i), i);
    for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "FamilyMemberHistory", "note", element.getNote().get(i), i);
    for (int i = 0; i < element.getCondition().size(); i++) composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(t, "FamilyMemberHistory", "condition", element.getCondition().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 5 with FamilyMemberHistory

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

the class ProfileUtilitiesTests method execute.

public void execute(String[] args) throws FileNotFoundException, IOException, FHIRException {
    System.out.println("loading context");
    context = SimpleWorkerContext.fromPack(Utilities.path(root, "validation.zip"));
    comp = new ProfileComparer(context);
    compare("patient-daf-dafpatient.profile.xml", "patient-qicore-qicore-patient.profile.xml");
    compare("encounter-daf-dafencounter.profile.xml", "encounter-qicore-qicore-encounter.profile.xml");
    compare("substance-daf-dafsubstance.profile.xml", "substance-qicore-qicore-substance.profile.xml");
    compare("medication-daf-dafmedication.profile.xml", "medication-qicore-qicore-medication.profile.xml");
    compare("procedure-daf-dafprocedure.profile.xml", "procedure-qicore-qicore-procedure.profile.xml");
    compare("familymemberhistory-daf-daffamilymemberhistory.profile.xml", "familymemberhistory-qicore-qicore-familymemberhistory.profile.xml");
    compare("immunization-daf-dafimmunization.profile.xml", "immunization-qicore-qicore-immunization.profile.xml");
    compare("condition-daf-dafcondition.profile.xml", "condition-qicore-qicore-condition.profile.xml");
    compare("allergyintolerance-daf-dafallergyintolerance.profile.xml", "allergyintolerance-qicore-qicore-allergyintolerance.profile.xml");
    compare("medicationadministration-daf-dafmedicationadministration.profile.xml", "medicationadministration-qicore-qicore-medicationadministration.profile.xml");
    compare("medicationdispense-daf-dafmedicationdispense.profile.xml", "medicationdispense-qicore-qicore-medicationdispense.profile.xml");
    compare("medicationprescription-daf-dafmedicationprescription.profile.xml", "medicationprescription-qicore-qicore-medicationprescription.profile.xml");
    compare("medicationstatement-daf-dafmedicationstatement.profile.xml", "medicationstatement-qicore-qicore-medicationstatement.profile.xml");
    compare("observation-daf-smokingstatus-dafsmokingstatus.profile.xml", "observation-qicore-qicore-observation.profile.xml");
    compare("observation-daf-vitalsigns-dafvitalsigns.profile.xml", "observation-qicore-qicore-observation.profile.xml");
    // compare("observation-daf-results-dafresultobs.profile.xml", "observation-qicore-qicore-observation.profile.xml");
    // compare("diagnosticorder-daf-dafdiagnosticorder.profile.xml", "diagnosticorder-qicore-qicore-diagnosticorder.profile.xml");
    // compare("diagnosticreport-daf-dafdiagnosticreport.profile.xml", "diagnosticreport-qicore-qicore-diagnosticreport.profile.xml");
    System.out.println("processing output");
    for (ProfileComparison outcome : comp.getComparisons()) {
        if (outcome.getSubset() != null)
            new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "intersection-" + outcome.getId() + ".xml")), outcome.getSubset());
        if (outcome.getSuperset() != null)
            new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "union-" + outcome.getId() + ".xml")), outcome.getSuperset());
        System.out.println("\r\n" + outcome.getId() + ": Comparison of " + outcome.getLeft().getUrl() + " and " + outcome.getRight().getUrl());
        for (ValidationMessage vm : outcome.getMessages()) if (vm.getLevel() == IssueSeverity.INFORMATION)
            System.out.println(vm.summary());
        for (ValidationMessage vm : outcome.getMessages()) if (vm.getLevel() == IssueSeverity.WARNING)
            System.out.println(vm.summary());
        for (ValidationMessage vm : outcome.getMessages()) if (vm.getLevel() == IssueSeverity.ERROR)
            System.out.println(vm.summary());
        for (ValidationMessage vm : outcome.getMessages()) if (vm.getLevel() == IssueSeverity.FATAL)
            System.out.println(vm.summary());
        System.out.println("done. " + Integer.toString(outcome.getMessages().size()) + " messages");
        System.out.println("=================================================================");
    }
}
Also used : ProfileComparison(org.hl7.fhir.dstu3.conformance.ProfileComparer.ProfileComparison) XmlParser(org.hl7.fhir.dstu3.formats.XmlParser) ValidationMessage(org.hl7.fhir.utilities.validation.ValidationMessage) ProfileComparer(org.hl7.fhir.dstu3.conformance.ProfileComparer) FileOutputStream(java.io.FileOutputStream)

Aggregations

IFamilyMemberHistory (ch.elexis.core.findings.IFamilyMemberHistory)3 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)2 FileOutputStream (java.io.FileOutputStream)2 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)2 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)2 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)2 FamilyMemberHistory (org.hl7.fhir.r4.model.FamilyMemberHistory)2 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)2 ValidationMessage (org.hl7.fhir.utilities.validation.ValidationMessage)2 Test (org.junit.jupiter.api.Test)2 Create (ca.uhn.fhir.rest.annotation.Create)1 Search (ca.uhn.fhir.rest.annotation.Search)1 InternalErrorException (ca.uhn.fhir.rest.server.exceptions.InternalErrorException)1 IPatient (ch.elexis.core.model.IPatient)1 ArrayList (java.util.ArrayList)1 XmlParser (org.hl7.fhir.dstu2.formats.XmlParser)1 ProfileComparer (org.hl7.fhir.dstu2.utils.ProfileComparer)1 ProfileComparison (org.hl7.fhir.dstu2.utils.ProfileComparer.ProfileComparison)1 ProfileComparer (org.hl7.fhir.dstu3.conformance.ProfileComparer)1 ProfileComparison (org.hl7.fhir.dstu3.conformance.ProfileComparer.ProfileComparison)1