Search in sources :

Example 1 with BindingsParser

use of org.hl7.fhir.definitions.parsers.spreadsheets.BindingsParser in project kindling by HL7.

the class SourceParser method loadGlobalBindings.

private void loadGlobalBindings() throws Exception {
    logger.log("Load Common Bindings", LogMessageType.Process);
    BindingsParser parser = new BindingsParser(new CSFileInputStream(new CSFile(termDir + "bindings.xml")), termDir + "bindings.xml", srcDir, registry, version.toCode(), definitions.getCodeSystems(), page.getConceptMaps(), genDate, exceptionIfExcelNotNormalised, page.packageInfo());
    List<BindingSpecification> cds = parser.parse();
    for (BindingSpecification cd : cds) {
        definitions.getAllBindings().add(cd);
        definitions.getCommonBindings().put(cd.getName(), cd);
        if (cd.getValueSet() != null) {
            vsGen.updateHeader(cd, cd.getValueSet());
            definitions.getBoundValueSets().put(cd.getValueSet().getUrl(), cd.getValueSet());
        } else if (cd.getReference() != null && cd.getReference().startsWith("http:")) {
            definitions.getUnresolvedBindings().add(cd);
        }
        if (cd.getMaxValueSet() != null) {
            vsGen.updateHeader(cd, cd.getMaxValueSet());
            definitions.getBoundValueSets().put(cd.getMaxValueSet().getUrl(), cd.getMaxValueSet());
        }
    }
    if (!page.getDefinitions().getBoundValueSets().containsKey("http://hl7.org/fhir/ValueSet/data-absent-reason"))
        throw new Exception("d-a-r not found");
}
Also used : BindingSpecification(org.hl7.fhir.definitions.model.BindingSpecification) CSFile(org.hl7.fhir.utilities.CSFile) BindingsParser(org.hl7.fhir.definitions.parsers.spreadsheets.BindingsParser) CSFileInputStream(org.hl7.fhir.utilities.CSFileInputStream) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) FileNotFoundException(java.io.FileNotFoundException) SAXException(org.xml.sax.SAXException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 BindingSpecification (org.hl7.fhir.definitions.model.BindingSpecification)1 BindingsParser (org.hl7.fhir.definitions.parsers.spreadsheets.BindingsParser)1 FHIRException (org.hl7.fhir.exceptions.FHIRException)1 CSFile (org.hl7.fhir.utilities.CSFile)1 CSFileInputStream (org.hl7.fhir.utilities.CSFileInputStream)1 SAXException (org.xml.sax.SAXException)1