use of org.hl7.fhir.r4b.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);
}
use of org.hl7.fhir.r4b.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;
}
use of org.hl7.fhir.r4b.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");
}
use of org.hl7.fhir.r4b.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);
}
}
use of org.hl7.fhir.r4b.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);
}
}
Aggregations