Search in sources :

Example 41 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project kindling by HL7.

the class SpreadSheetCreator method addOpParam.

private int addOpParam(XSSFSheet sheet, XSSFSheet bindings, String path, OperationDefinitionParameterComponent param, int rowCount) {
    path = path + "." + param.getName();
    Row row = sheet.createRow(rowCount++);
    int columnCount = 0;
    addCell(path, row, columnCount++);
    addCell(use(param), row, columnCount++);
    addCell("" + param.getMin() + ".." + param.getMax(), row, columnCount++);
    addCell(type(param), row, columnCount++);
    addCell(bind(param, bindings), row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(param.getDocumentation(), row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(null, row, columnCount++);
    addCell(status(param), row, columnCount++);
    addCell(ext(param, BuildExtensions.EXT_COMMITTEE_NOTES), row, columnCount++);
    for (OperationDefinitionParameterComponent pp : param.getPart()) {
        rowCount = addOpParam(sheet, bindings, path, pp, rowCount);
    }
    return rowCount;
}
Also used : Row(org.apache.poi.ss.usermodel.Row) OperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)

Example 42 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project kindling by HL7.

the class SpreadSheetCreator method addOperation.

private int addOperation(XSSFSheet sheet, XSSFSheet bindings, OperationDefinition opd, int rowCount) {
    Row row = sheet.createRow(rowCount++);
    int columnCount = 0;
    addCell(opd.getCode(), row, columnCount++);
    addCell(use(opd), row, columnCount++);
    addCell("", row, columnCount++);
    addCell(type(opd), row, columnCount++);
    addCell("", row, columnCount++);
    addCell(opd.present(), row, columnCount++);
    addCell(opd.getDescription(), row, columnCount++);
    addCell(opd.getComment(), row, columnCount++);
    addCell(ext(opd, BuildExtensions.EXT_FOOTER), row, columnCount++);
    addCell(ext(opd, BuildExtensions.EXT_FOOTER2), row, columnCount++);
    addCell(exlist(opd, false, "1"), row, columnCount++);
    addCell(exlist(opd, true, "1"), row, columnCount++);
    addCell(exlist(opd, false, "2"), row, columnCount++);
    addCell(exlist(opd, true, "2"), row, columnCount++);
    addCell(status(opd), row, columnCount++);
    addCell(ext(opd, BuildExtensions.EXT_COMMITTEE_NOTES), row, columnCount++);
    for (OperationDefinitionParameterComponent param : opd.getParameter()) {
        rowCount = addOpParam(sheet, bindings, opd.getCode(), param, rowCount);
    }
    return rowCount;
}
Also used : Row(org.apache.poi.ss.usermodel.Row) OperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)

Example 43 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project kindling by HL7.

the class XSDGenerator method generateEnum.

private void generateEnum(String en) throws IOException {
    if (allenums.contains(en))
        return;
    allenums.add(en);
    write("  <xs:simpleType name=\"" + en + "-list\">\r\n");
    write("    <xs:restriction base=\"code-primitive\">\r\n");
    ValueSet vs = enums.get(en);
    vs.setUserData(ToolResourceUtilities.NAME_VS_USE_MARKER, true);
    ValueSet ex = workerContext.expandVS(vs, true, false).getValueset();
    for (ValueSetExpansionContainsComponent cc : ex.getExpansion().getContains()) {
        genIncludedCode(cc);
    }
    write("    </xs:restriction>\r\n");
    write("  </xs:simpleType>\r\n");
    write("  <xs:complexType name=\"" + en + "\">\r\n");
    write("    <xs:annotation>\r\n");
    write("      <xs:documentation xml:lang=\"en\">" + Utilities.escapeXml(enumDefs.get(en)) + "</xs:documentation>\r\n");
    write("      <xs:documentation xml:lang=\"en\">If the element is present, it must have either a @value, an @id, or extensions</xs:documentation>\r\n");
    write("    </xs:annotation>\r\n");
    write("    <xs:complexContent>\r\n");
    write("      <xs:extension base=\"Element\">\r\n");
    write("        <xs:attribute name=\"value\" type=\"" + en + "-list\" use=\"optional\"/>\r\n");
    write("      </xs:extension>\r\n");
    write("    </xs:complexContent>\r\n");
    write("  </xs:complexType>\r\n");
}
Also used : ValueSetExpansionContainsComponent(org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent) ValueSet(org.hl7.fhir.r5.model.ValueSet)

Example 44 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project kindling by HL7.

the class ProfileGenerator method produceOpParam.

private void produceOpParam(String path, List<OperationDefinitionParameterComponent> opd, OperationParameter p, OperationParameterUse defUse) throws Exception {
    OperationDefinitionParameterComponent pp = new OperationDefinitionParameterComponent();
    pp.setName(p.getName());
    if (path.contains("."))
        pp.setUse(defUse);
    else if (p.getUse().equals("in"))
        pp.setUse(OperationParameterUse.IN);
    else if (p.getUse().equals("out"))
        pp.setUse(OperationParameterUse.OUT);
    else
        // but this is validated elsewhere
        throw new Exception("Unable to determine parameter use: " + p.getUse() + " at " + path + "." + p.getName());
    pp.setDocumentation(preProcessMarkdown(p.getDoc(), "Operation Parameter Doco"));
    pp.setMin(p.getMin());
    pp.setMax(p.getMax());
    if (p.getBs() != null) {
        if (p.getBs().hasMax())
            throw new Error("Max binding not handled yet");
        pp.setBinding(new OperationDefinitionParameterBindingComponent().setStrength(p.getBs().getStrength()).setValueSet(buildValueSetReference(p.getBs())));
        if (!Utilities.noString(p.getBinding().getName())) {
            pp.getBinding().addExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", new StringType(p.getBinding().getName()));
        }
    }
    if (!Utilities.noString(p.getProfile())) {
        pp.addTargetProfile(p.getProfile());
    }
    opd.add(pp);
    if (p.getFhirType().equals("Tuple")) {
        for (OperationParameter part : p.getParts()) {
            produceOpParam(path + "." + p.getName(), pp.getPart(), part, pp.getUse());
        }
    } else {
        List<TypeRef> trs = new TypeParser(version.toCode()).parse(p.getFhirType(), false, null, null, false);
        if (trs.size() > 1) {
            if (p.getSearchType() != null)
                pp.setSearchType(SearchParamType.fromCode(p.getSearchType()));
            pp.setType(Enumerations.FHIRAllTypes.fromCode("Element"));
            for (TypeRef tr : trs) {
                pp.addExtension(ToolingExtensions.EXT_ALLOWED_TYPE, new UriType(tr.getName()));
                if (tr.getParams().size() > 0)
                    throw new Error("Multiple types for an operation parameter, where one is a reference, is not supported by the build tools");
            }
        } else {
            TypeRef tr = trs.get(0);
            if (definitions.getConstraints().containsKey(tr.getName())) {
                ProfiledType pt = definitions.getConstraints().get(tr.getName());
                pp.setType(Enumerations.FHIRAllTypes.fromCode(pt.getBaseType().equals("*") ? "Type" : pt.getBaseType()));
                pp.addTargetProfile("http://hl7.org/fhir/StructureDefinition/" + pt.getName());
            } else {
                if (p.getSearchType() != null)
                    pp.setSearchType(SearchParamType.fromCode(p.getSearchType()));
                pp.setType(Enumerations.FHIRAllTypes.fromCode(tr.getName().equals("*") ? "Type" : tr.getName()));
                if (tr.getParams().size() == 1 && !tr.getParams().get(0).equals("Any"))
                    pp.addTargetProfile("http://hl7.org/fhir/StructureDefinition/" + tr.getParams().get(0));
            }
        }
    }
}
Also used : TypeParser(org.hl7.fhir.definitions.parsers.TypeParser) ProfiledType(org.hl7.fhir.definitions.model.ProfiledType) StringType(org.hl7.fhir.r5.model.StringType) TypeRef(org.hl7.fhir.definitions.model.TypeRef) OperationDefinitionParameterBindingComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterBindingComponent) OperationParameter(org.hl7.fhir.definitions.model.OperationParameter) FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError) FHIRException(org.hl7.fhir.exceptions.FHIRException) URISyntaxException(java.net.URISyntaxException) OperationDefinitionParameterComponent(org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent) UriType(org.hl7.fhir.r5.model.UriType)

Example 45 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project kindling by HL7.

the class FhirTurtleGenerator method genBaseMetadata.

/**
 * Emit all the basic atoms that are implicit in the actual model
 */
private void genBaseMetadata() {
    // Declare these for now - they will get filled in more completely later on
    FHIRResource Resource = fact.fhir_class("Resource");
    FHIRResource Element = fact.fhir_class("Element");
    FHIRResource Reference = fact.fhir_class("Reference");
    // Primitive isn't in the actual model - added here
    fact.fhir_class("Primitive").addTitle("Types with only a value").addDefinition("Types with only a value and no additional elements as children").restriction(fact.fhir_restriction(value, RDFS.Literal));
    // A resource can have an optional nodeRole
    FHIRResource treeRoot = fact.fhir_class("treeRoot").addTitle("Class of FHIR base documents");
    FHIRResource nodeRole = fact.fhir_objectProperty("nodeRole").addTitle("Identifies role of subject in context of a given document").domain(Resource).range(treeRoot.resource);
    Resource.restriction(fact.fhir_cardinality_restriction(nodeRole.resource, treeRoot.resource, 0, 1));
    // Any element can have an index to assign order in a list
    FHIRResource index = fact.fhir_dataProperty("index").addTitle("Ordering value for list").domain(Element).range(XSD.nonNegativeInteger);
    Element.restriction(fact.fhir_cardinality_restriction(index.resource, XSD.nonNegativeInteger, 0, 1));
    // References have an optional link
    FHIRResource link = fact.fhir_objectProperty("link").addTitle("URI of a reference");
    Reference.restriction(fact.fhir_cardinality_restriction(link.resource, Resource.resource, 0, 1));
    // XHTML is an XML Literal -- but it isn't recognized by OWL so we use string
    FHIRResource NarrativeDiv = fact.fhir_dataProperty("Narrative.div");
    fact.fhir_class("xhtml", "Primitive").restriction(fact.fhir_cardinality_restriction(value, fact.fhir_datatype(XSD.xstring).resource, 1, 1));
}
Also used : FHIRResource(org.hl7.fhir.rdf.FHIRResource)

Aggregations

ArrayList (java.util.ArrayList)82 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)43 List (java.util.List)41 FHIRException (org.hl7.fhir.exceptions.FHIRException)40 Date (java.util.Date)39 IOException (java.io.IOException)38 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)35 Test (org.junit.jupiter.api.Test)35 Resource (org.hl7.fhir.r4.model.Resource)34 Collectors (java.util.stream.Collectors)29 Coding (org.hl7.fhir.r4.model.Coding)27 Reference (org.hl7.fhir.r4.model.Reference)27 Timer (com.codahale.metrics.Timer)26 HashMap (java.util.HashMap)25 Bundle (org.hl7.fhir.r4.model.Bundle)25 Reference (org.hl7.fhir.dstu3.model.Reference)24 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)23 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)21 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)21 JsonObject (com.google.gson.JsonObject)20