Search in sources :

Example 31 with Meta

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

the class NarrativeGenerator method inject.

private void inject(org.hl7.fhir.dstu3.elementmodel.Element er, XhtmlNode x, NarrativeStatus status) throws DefinitionException, IOException {
    if (!x.hasAttribute("xmlns"))
        x.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
    org.hl7.fhir.dstu3.elementmodel.Element txt = er.getNamedChild("text");
    if (txt == null) {
        txt = new org.hl7.fhir.dstu3.elementmodel.Element("text", er.getProperty().getChild(null, "text"));
        int i = 0;
        while (i < er.getChildren().size() && (er.getChildren().get(i).getName().equals("id") || er.getChildren().get(i).getName().equals("meta") || er.getChildren().get(i).getName().equals("implicitRules") || er.getChildren().get(i).getName().equals("language"))) i++;
        if (i >= er.getChildren().size())
            er.getChildren().add(txt);
        else
            er.getChildren().add(i, txt);
    }
    org.hl7.fhir.dstu3.elementmodel.Element st = txt.getNamedChild("status");
    if (st == null) {
        st = new org.hl7.fhir.dstu3.elementmodel.Element("status", txt.getProperty().getChild(null, "status"));
        txt.getChildren().add(0, st);
    }
    st.setValue(status.toCode());
    org.hl7.fhir.dstu3.elementmodel.Element div = txt.getNamedChild("div");
    if (div == null) {
        div = new org.hl7.fhir.dstu3.elementmodel.Element("div", txt.getProperty().getChild(null, "div"));
        txt.getChildren().add(div);
        div.setValue(new XhtmlComposer(XhtmlComposer.XML).compose(x));
    }
    div.setXhtml(x);
}
Also used : XhtmlComposer(org.hl7.fhir.utilities.xhtml.XhtmlComposer) ContactPoint(org.hl7.fhir.dstu3.model.ContactPoint)

Example 32 with Meta

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

the class LoincToDEConvertor method process.

public Bundle process(String sourceFile) throws FileNotFoundException, SAXException, IOException, ParserConfigurationException {
    this.definitions = sourceFile;
    log("Begin. Produce Loinc CDEs in " + dest + " from " + definitions);
    loadLoinc();
    log("LOINC loaded");
    now = DateTimeType.now();
    bundle = new Bundle();
    bundle.setType(BundleType.COLLECTION);
    bundle.setId("http://hl7.org/fhir/commondataelement/loinc");
    bundle.setMeta(new Meta().setLastUpdatedElement(InstantType.now()));
    processLoincCodes();
    return bundle;
}
Also used : Meta(org.hl7.fhir.r4.model.Meta) Bundle(org.hl7.fhir.r4.model.Bundle)

Example 33 with Meta

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

the class LoincToDEConvertor method process.

public void process() throws FHIRFormatError, IOException, XmlPullParserException, SAXException, ParserConfigurationException {
    log("Begin. Produce Loinc CDEs in " + dest + " from " + definitions);
    loadLoinc();
    log("LOINC loaded");
    now = DateTimeType.now();
    bundle = new Bundle();
    bundle.setId("http://hl7.org/fhir/commondataelement/loinc");
    bundle.setMeta(new Meta().setLastUpdatedElement(InstantType.now()));
    processLoincCodes();
    if (dest != null) {
        log("Saving...");
        saveBundle();
    }
    log("Done");
}
Also used : Meta(org.hl7.fhir.r4.model.Meta) Bundle(org.hl7.fhir.r4.model.Bundle)

Example 34 with Meta

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

the class QuestionnaireBuilder method processMetadata.

private void processMetadata() {
    // todo: can we derive a more informative identifier from the questionnaire if we have a profile
    if (prebuiltQuestionnaire == null) {
        questionnaire.addIdentifier().setSystem("urn:ietf:rfc:3986").setValue(questionnaireId);
        questionnaire.setVersion(profile.getVersion());
        questionnaire.setStatus(profile.getStatus());
        questionnaire.setDate(profile.getDate());
        questionnaire.setPublisher(profile.getPublisher());
        Questionnaire.QuestionnaireItemComponent item = new Questionnaire.QuestionnaireItemComponent();
        questionnaire.addItem(item);
        item.setLinkId("meta");
        item.getCode().addAll(profile.getKeyword());
        questionnaire.setId(nextId("qs"));
    }
    if (response != null) {
        // no identifier - this is transient
        response.setQuestionnaire("#" + questionnaire.getId());
        response.getContained().add(questionnaire);
        response.setStatus(QuestionnaireResponseStatus.INPROGRESS);
        QuestionnaireResponse.QuestionnaireResponseItemComponent item = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
        response.addItem(item);
        item.setLinkId("meta");
        item.setUserData("object", resource);
    }
}
Also used : QuestionnaireItemComponent(org.hl7.fhir.r4b.model.Questionnaire.QuestionnaireItemComponent) Questionnaire(org.hl7.fhir.r4b.model.Questionnaire) QuestionnaireItemComponent(org.hl7.fhir.r4b.model.Questionnaire.QuestionnaireItemComponent) QuestionnaireResponse(org.hl7.fhir.r4b.model.QuestionnaireResponse)

Example 35 with Meta

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

the class QuestionnaireBuilder method processDataType.

private void processDataType(StructureDefinition profile, QuestionnaireItemComponent group, ElementDefinition element, String path, TypeRefComponent t, List<QuestionnaireResponse.QuestionnaireResponseItemComponent> answerGroups, List<ElementDefinition> parents) throws FHIRException {
    String tc = t.getWorkingCode();
    if (tc.equals("code"))
        addCodeQuestions(group, element, path, answerGroups);
    else if (Utilities.existsInList(tc, "string", "id", "oid", "uuid", "markdown"))
        addStringQuestions(group, element, path, answerGroups);
    else if (Utilities.existsInList(tc, "uri", "url", "canonical"))
        addUriQuestions(group, element, path, answerGroups);
    else if (tc.equals("boolean"))
        addBooleanQuestions(group, element, path, answerGroups);
    else if (tc.equals("decimal"))
        addDecimalQuestions(group, element, path, answerGroups);
    else if (tc.equals("dateTime") || tc.equals("date"))
        addDateTimeQuestions(group, element, path, answerGroups);
    else if (tc.equals("instant"))
        addInstantQuestions(group, element, path, answerGroups);
    else if (tc.equals("time"))
        addTimeQuestions(group, element, path, answerGroups);
    else if (tc.equals("CodeableConcept"))
        addCodeableConceptQuestions(group, element, path, answerGroups);
    else if (tc.equals("Period"))
        addPeriodQuestions(group, element, path, answerGroups);
    else if (tc.equals("Ratio"))
        addRatioQuestions(group, element, path, answerGroups);
    else if (tc.equals("HumanName"))
        addHumanNameQuestions(group, element, path, answerGroups);
    else if (tc.equals("Address"))
        addAddressQuestions(group, element, path, answerGroups);
    else if (tc.equals("ContactPoint"))
        addContactPointQuestions(group, element, path, answerGroups);
    else if (tc.equals("Identifier"))
        addIdentifierQuestions(group, element, path, answerGroups);
    else if (tc.equals("integer") || tc.equals("positiveInt") || tc.equals("unsignedInt"))
        addIntegerQuestions(group, element, path, answerGroups);
    else if (tc.equals("Coding"))
        addCodingQuestions(group, element, path, answerGroups);
    else if (Utilities.existsInList(tc, "Quantity", "Count", "Age", "Duration", "Distance", "Money"))
        addQuantityQuestions(group, element, path, answerGroups);
    else if (tc.equals("Money"))
        addMoneyQuestions(group, element, path, answerGroups);
    else if (tc.equals("Reference"))
        addReferenceQuestions(group, element, path, t.getTargetProfile(), answerGroups);
    else if (tc.equals("Duration"))
        addDurationQuestions(group, element, path, answerGroups);
    else if (tc.equals("base64Binary"))
        addBinaryQuestions(group, element, path, answerGroups);
    else if (tc.equals("Attachment"))
        addAttachmentQuestions(group, element, path, answerGroups);
    else if (tc.equals("Age"))
        addAgeQuestions(group, element, path, answerGroups);
    else if (tc.equals("Range"))
        addRangeQuestions(group, element, path, answerGroups);
    else if (tc.equals("Timing"))
        addTimingQuestions(group, element, path, answerGroups);
    else if (tc.equals("Annotation"))
        addAnnotationQuestions(group, element, path, answerGroups);
    else if (tc.equals("SampledData"))
        addSampledDataQuestions(group, element, path, answerGroups);
    else if (tc.equals("Extension")) {
        if (t.hasProfile())
            addExtensionQuestions(profile, group, element, path, t.getProfile().get(0).getValue(), answerGroups, parents);
    } else if (tc.equals("SampledData"))
        addSampledDataQuestions(group, element, path, answerGroups);
    else if (!tc.equals("Narrative") && !tc.equals("Resource") && !tc.equals("Meta") && !tc.equals("Signature")) {
        StructureDefinition sd = context.fetchTypeDefinition(tc);
        if (sd == null)
            throw new NotImplementedException("Unhandled Data Type: " + tc + " on element " + element.getPath());
        buildGroup(group, sd, sd.getSnapshot().getElementFirstRep(), parents, answerGroups);
    }
}
Also used : StructureDefinition(org.hl7.fhir.r4b.model.StructureDefinition) NotImplementedException(org.apache.commons.lang3.NotImplementedException)

Aggregations

Meta (org.hl7.fhir.r4.model.Meta)40 HashMap (java.util.HashMap)36 Date (java.util.Date)35 Meta (org.hl7.fhir.dstu3.model.Meta)31 IBaseMetaType (org.hl7.fhir.instance.model.api.IBaseMetaType)28 Reference (org.hl7.fhir.r4.model.Reference)26 JsonObject (javax.json.JsonObject)24 Path (javax.ws.rs.Path)24 Produces (javax.ws.rs.Produces)24 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)20 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)18 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)17 DocumentReference (org.hl7.fhir.r4.model.DocumentReference)17 ArrayList (java.util.ArrayList)16 Coding (org.hl7.fhir.r4.model.Coding)16 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)15 Test (org.junit.jupiter.api.Test)15 Test (org.junit.Test)14 NotImplementedException (org.apache.commons.lang3.NotImplementedException)13 GET (javax.ws.rs.GET)12