use of org.hl7.fhir.dstu2.model.Questionnaire in project integration-adaptor-111 by nhsconnect.
the class QuestionnaireMapperTest method shouldMapQuestionnairePublisherSkillSet.
@Test
public void shouldMapQuestionnairePublisherSkillSet() {
String skillSet = "T6";
when(xmlUtils.getSingleNodeAsString(any(), anyString())).thenReturn(skillSet);
Questionnaire questionnaire = questionnaireMapper.mapQuestionnaire(pathwaysCase, triageLine);
assertThat(questionnaire.getPublisher()).isEqualTo(String.format("User skill set: '%s'", skillSet));
}
use of org.hl7.fhir.dstu2.model.Questionnaire in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeQuestionnaireQuestionnaireItemOptionComponent.
protected void composeQuestionnaireQuestionnaireItemOptionComponent(Complex parent, String parentType, String name, Questionnaire.QuestionnaireItemOptionComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "option", name, element, index);
if (element.hasValue())
composeType(t, "Questionnaire", "value", element.getValue(), -1);
}
use of org.hl7.fhir.dstu2.model.Questionnaire in project org.hl7.fhir.core by hapifhir.
the class Tester method main.
public static void main(String[] args) throws Exception {
IWorkerContext context = SimpleWorkerContext.fromPack(Utilities.path("C:\\work\\org.hl7.fhir\\build\\publish", "validation-min.xml.zip"));
int t = 0;
int ok = 0;
for (String f : new File("C:\\work\\org.hl7.fhir\\build\\publish").list()) {
if (f.endsWith(".xml") && !f.endsWith(".canonical.xml") && !f.contains("profile") && !f.contains("questionnaire") && new File("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".ttl")).exists()) {
// if (f.equals("account-questionnaire.xml")) {
System.out.print("convert " + f);
// Manager.convert(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+f), FhirFormat.XML,
// new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.json")), FhirFormat.JSON, OutputStyle.PRETTY);
// String src = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.json")));
// String tgt = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".json")));
Element e = Manager.parse(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\" + f), FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".mm.ttl")), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "resource.xml")), FhirFormat.XML, OutputStyle.PRETTY, null);
String src = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".mm.ttl"));
String tgt = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\" + Utilities.changeFileExt(f, ".ttl"));
t++;
if (src.equals(tgt)) {
System.out.println(".. ok");
ok++;
} else
System.out.println(".. fail");
}
// }
}
System.out.println("done - " + Integer.toString(t) + " files, " + Integer.toString(ok) + " ok");
}
use of org.hl7.fhir.dstu2.model.Questionnaire in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeQuestionnaireQuestionnaireItemComponent.
protected void composeQuestionnaireQuestionnaireItemComponent(Complex parent, String parentType, String name, Questionnaire.QuestionnaireItemComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "item", name, element, index);
if (element.hasLinkIdElement())
composeString(t, "Questionnaire", "linkId", element.getLinkIdElement(), -1);
for (int i = 0; i < element.getConcept().size(); i++) composeCoding(t, "Questionnaire", "concept", element.getConcept().get(i), i);
if (element.hasPrefixElement())
composeString(t, "Questionnaire", "prefix", element.getPrefixElement(), -1);
if (element.hasTextElement())
composeString(t, "Questionnaire", "text", element.getTextElement(), -1);
if (element.hasTypeElement())
composeEnum(t, "Questionnaire", "type", element.getTypeElement(), -1);
for (int i = 0; i < element.getEnableWhen().size(); i++) composeQuestionnaireQuestionnaireItemEnableWhenComponent(t, "Questionnaire", "enableWhen", element.getEnableWhen().get(i), i);
if (element.hasRequiredElement())
composeBoolean(t, "Questionnaire", "required", element.getRequiredElement(), -1);
if (element.hasRepeatsElement())
composeBoolean(t, "Questionnaire", "repeats", element.getRepeatsElement(), -1);
if (element.hasReadOnlyElement())
composeBoolean(t, "Questionnaire", "readOnly", element.getReadOnlyElement(), -1);
if (element.hasMaxLengthElement())
composeInteger(t, "Questionnaire", "maxLength", element.getMaxLengthElement(), -1);
if (element.hasOptions())
composeReference(t, "Questionnaire", "options", element.getOptions(), -1);
for (int i = 0; i < element.getOption().size(); i++) composeQuestionnaireQuestionnaireItemOptionComponent(t, "Questionnaire", "option", element.getOption().get(i), i);
if (element.hasInitial())
composeType(t, "Questionnaire", "initial", element.getInitial(), -1);
for (int i = 0; i < element.getItem().size(); i++) composeQuestionnaireQuestionnaireItemComponent(t, "Questionnaire", "item", element.getItem().get(i), i);
}
use of org.hl7.fhir.dstu2.model.Questionnaire in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeQuestionnaireQuestionnaireItemEnableWhenComponent.
protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(Complex parent, String parentType, String name, Questionnaire.QuestionnaireItemEnableWhenComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "enableWhen", name, element, index);
if (element.hasQuestionElement())
composeString(t, "Questionnaire", "question", element.getQuestionElement(), -1);
if (element.hasHasAnswerElement())
composeBoolean(t, "Questionnaire", "hasAnswer", element.getHasAnswerElement(), -1);
if (element.hasAnswer())
composeType(t, "Questionnaire", "answer", element.getAnswer(), -1);
}
Aggregations