Search in sources :

Example 21 with StandardsStatus

use of org.hl7.fhir.utilities.StandardsStatus in project kindling by HL7.

the class LogicalModelProcessor method processCommand.

@Override
protected String processCommand(String command, String[] com) throws Exception {
    if (com[0].equals("lmheader"))
        return lmHeader(name, definition.getId(), com.length > 1 ? com[1] : null, true);
    else if (com[0].equals("svg"))
        return new SvgGenerator(page, genlevel(), null, true, false, version).generate(definition, com[1], "");
    else if (com[0].equals("draft-note"))
        return page.getDraftNote(definition);
    else if (com[0].equals("definition"))
        return definition.getDescription();
    else if (com[0].equals("tx"))
        return tx;
    else if (com[0].equals("inv"))
        return genConstraints(definition);
    else if (com[0].equals("resource-table"))
        return genLogicalModelTable(definition, genlevel());
    else if (com[0].equals("dictionary"))
        return dict;
    else if (com[0].equals("lmexamples"))
        return genExampleList();
    else if (com[0].equals("resref"))
        return "{todo}";
    else if (com[0].equals("maponthispage"))
        return "{todo}";
    else if (com[0].equals("mappings"))
        return "{todo}";
    else if (com[0].equals("fmm-style")) {
        String fmm = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_FMM_LEVEL);
        StandardsStatus ss = ToolingExtensions.getStandardsStatus(definition);
        if (StandardsStatus.EXTERNAL == ss)
            return "colse";
        else
            return "colsi";
    } else if (com[0].equals("fmm")) {
        String fmm = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_FMM_LEVEL);
        StandardsStatus ss = ToolingExtensions.getStandardsStatus(definition);
        if (StandardsStatus.EXTERNAL == ss)
            return getFmmFromlevel("", "N/A");
        else
            return getFmmFromlevel("", fmm);
    } else if (com[0].equals("wg")) {
        String wg = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_WORKGROUP);
        return (wg == null || !definitions.getWorkgroups().containsKey(wg) ? "(No assigned work group)" : "<a _target=\"blank\" href=\"" + definitions.getWorkgroups().get(wg).getUrl() + "\">" + definitions.getWorkgroups().get(wg).getName() + "</a> Work Group");
    } else if (com[0].equals("fmm-style")) {
        String fmm = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_FMM_LEVEL);
        StandardsStatus ss = ToolingExtensions.getStandardsStatus(definition);
        if (StandardsStatus.EXTERNAL == ss)
            return "colse";
        else
            return "colsi";
    } else if (com[0].equals("wgt")) {
        String fmm = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_FMM_LEVEL);
        StandardsStatus ss = ToolingExtensions.getStandardsStatus(definition);
        if (StandardsStatus.EXTERNAL == ss)
            return getFmmFromlevel("", "N/A");
        else
            return getFmmFromlevel("", fmm);
    } else
        return super.processCommand(command, com);
}
Also used : SvgGenerator(org.hl7.fhir.definitions.generators.specification.SvgGenerator) StandardsStatus(org.hl7.fhir.utilities.StandardsStatus)

Example 22 with StandardsStatus

use of org.hl7.fhir.utilities.StandardsStatus in project org.hl7.fhir.core by hapifhir.

the class ValueSetUtilities method markStatus.

public static void markStatus(ValueSet vs, String wg, StandardsStatus status, String pckage, String fmm, IWorkerContext context, String normativeVersion) throws FHIRException {
    if (vs.hasUserData("external.url"))
        return;
    if (wg != null) {
        if (!ToolingExtensions.hasExtension(vs, ToolingExtensions.EXT_WORKGROUP) || (!Utilities.existsInList(ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_WORKGROUP), "fhir", "vocab") && Utilities.existsInList(wg, "fhir", "vocab"))) {
            ToolingExtensions.setCodeExtension(vs, ToolingExtensions.EXT_WORKGROUP, wg);
        }
    }
    if (status != null) {
        StandardsStatus ss = ToolingExtensions.getStandardsStatus(vs);
        if (ss == null || ss.isLowerThan(status))
            ToolingExtensions.setStandardsStatus(vs, status, normativeVersion);
        if (pckage != null) {
            if (!vs.hasUserData("ballot.package"))
                vs.setUserData("ballot.package", pckage);
            else if (!pckage.equals(vs.getUserString("ballot.package")))
                if (!"infrastructure".equals(vs.getUserString("ballot.package")))
                    System.out.println("Value Set " + vs.getUrl() + ": ownership clash " + pckage + " vs " + vs.getUserString("ballot.package"));
        }
        if (status == StandardsStatus.NORMATIVE) {
            vs.setExperimental(false);
            vs.setStatus(PublicationStatus.ACTIVE);
        }
    }
    if (fmm != null) {
        String sfmm = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_FMM_LEVEL);
        if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm))
            ToolingExtensions.setIntegerExtension(vs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm));
    }
    if (vs.hasUserData("cs"))
        CodeSystemUtilities.markStatus((CodeSystem) vs.getUserData("cs"), wg, status, pckage, fmm, normativeVersion);
    else if (status == StandardsStatus.NORMATIVE && context != null) {
        for (ConceptSetComponent csc : vs.getCompose().getInclude()) {
            if (csc.hasSystem()) {
                CodeSystem cs = context.fetchCodeSystem(csc.getSystem());
                if (cs != null) {
                    CodeSystemUtilities.markStatus(cs, wg, status, pckage, fmm, normativeVersion);
                }
            }
        }
    }
}
Also used : ConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent) StandardsStatus(org.hl7.fhir.utilities.StandardsStatus) CodeSystem(org.hl7.fhir.r4.model.CodeSystem)

Example 23 with StandardsStatus

use of org.hl7.fhir.utilities.StandardsStatus in project org.hl7.fhir.core by hapifhir.

the class CodeSystemUtilities method markStatus.

public static void markStatus(CodeSystem cs, String wg, StandardsStatus status, String pckage, String fmm, String normativeVersion) throws FHIRException {
    if (wg != null) {
        if (!ToolingExtensions.hasExtension(cs, ToolingExtensions.EXT_WORKGROUP) || (Utilities.existsInList(ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_WORKGROUP), "fhir", "vocab") && !Utilities.existsInList(wg, "fhir", "vocab"))) {
            ToolingExtensions.setCodeExtension(cs, ToolingExtensions.EXT_WORKGROUP, wg);
        }
    }
    if (status != null) {
        StandardsStatus ss = ToolingExtensions.getStandardsStatus(cs);
        if (ss == null || ss.isLowerThan(status))
            ToolingExtensions.setStandardsStatus(cs, status, normativeVersion);
        if (pckage != null) {
            if (!cs.hasUserData("ballot.package"))
                cs.setUserData("ballot.package", pckage);
            else if (!pckage.equals(cs.getUserString("ballot.package")))
                if (!"infrastructure".equals(cs.getUserString("ballot.package")))
                    System.out.println("Code System " + cs.getUrl() + ": ownership clash " + pckage + " vs " + cs.getUserString("ballot.package"));
        }
        if (status == StandardsStatus.NORMATIVE) {
            cs.setExperimental(false);
            cs.setStatus(PublicationStatus.ACTIVE);
        }
    }
    if (fmm != null) {
        String sfmm = ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_FMM_LEVEL);
        if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm))
            ToolingExtensions.setIntegerExtension(cs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm));
    }
}
Also used : StandardsStatus(org.hl7.fhir.utilities.StandardsStatus)

Example 24 with StandardsStatus

use of org.hl7.fhir.utilities.StandardsStatus in project org.hl7.fhir.core by hapifhir.

the class ValueSetUtilities method markStatus.

public static void markStatus(ValueSet vs, String wg, StandardsStatus status, String pckage, String fmm, IWorkerContext context, String normativeVersion) throws FHIRException {
    if (vs.hasUserData("external.url"))
        return;
    if (wg != null) {
        if (!ToolingExtensions.hasExtension(vs, ToolingExtensions.EXT_WORKGROUP) || (!Utilities.existsInList(ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_WORKGROUP), "fhir", "vocab") && Utilities.existsInList(wg, "fhir", "vocab"))) {
            ToolingExtensions.setCodeExtension(vs, ToolingExtensions.EXT_WORKGROUP, wg);
        }
    }
    if (status != null) {
        StandardsStatus ss = ToolingExtensions.getStandardsStatus(vs);
        if (ss == null || ss.isLowerThan(status))
            ToolingExtensions.setStandardsStatus(vs, status, normativeVersion);
        if (pckage != null) {
            if (!vs.hasUserData("ballot.package"))
                vs.setUserData("ballot.package", pckage);
            else if (!pckage.equals(vs.getUserString("ballot.package")))
                if (!"infrastructure".equals(vs.getUserString("ballot.package")))
                    System.out.println("Value Set " + vs.getUrl() + ": ownership clash " + pckage + " vs " + vs.getUserString("ballot.package"));
        }
        if (status == StandardsStatus.NORMATIVE) {
            vs.setExperimental(false);
            vs.setStatus(PublicationStatus.ACTIVE);
        }
    }
    if (fmm != null) {
        String sfmm = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_FMM_LEVEL);
        if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm)) {
            ToolingExtensions.setIntegerExtension(vs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm));
        }
        if (Integer.parseInt(fmm) <= 1) {
            vs.setExperimental(true);
        }
    }
    if (vs.hasUserData("cs"))
        CodeSystemUtilities.markStatus((CodeSystem) vs.getUserData("cs"), wg, status, pckage, fmm, normativeVersion);
    else if (status == StandardsStatus.NORMATIVE && context != null) {
        for (ConceptSetComponent csc : vs.getCompose().getInclude()) {
            if (csc.hasSystem()) {
                CodeSystem cs = context.fetchCodeSystem(csc.getSystem());
                if (cs != null) {
                    CodeSystemUtilities.markStatus(cs, wg, status, pckage, fmm, normativeVersion);
                }
            }
        }
    }
}
Also used : ConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent) StandardsStatus(org.hl7.fhir.utilities.StandardsStatus) CodeSystem(org.hl7.fhir.r5.model.CodeSystem)

Example 25 with StandardsStatus

use of org.hl7.fhir.utilities.StandardsStatus in project org.hl7.fhir.core by hapifhir.

the class CodeSystemUtilities method markStatus.

public static void markStatus(CodeSystem cs, String wg, StandardsStatus status, String pckage, String fmm, String normativeVersion) throws FHIRException {
    if (wg != null) {
        if (!ToolingExtensions.hasExtension(cs, ToolingExtensions.EXT_WORKGROUP) || (Utilities.existsInList(ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_WORKGROUP), "fhir", "vocab") && !Utilities.existsInList(wg, "fhir", "vocab"))) {
            ToolingExtensions.setCodeExtension(cs, ToolingExtensions.EXT_WORKGROUP, wg);
        }
    }
    if (status != null) {
        StandardsStatus ss = ToolingExtensions.getStandardsStatus(cs);
        if (ss == null || ss.isLowerThan(status))
            ToolingExtensions.setStandardsStatus(cs, status, normativeVersion);
        if (pckage != null) {
            if (!cs.hasUserData("ballot.package"))
                cs.setUserData("ballot.package", pckage);
            else if (!pckage.equals(cs.getUserString("ballot.package")))
                if (!"infrastructure".equals(cs.getUserString("ballot.package")))
                    System.out.println("Code System " + cs.getUrl() + ": ownership clash " + pckage + " vs " + cs.getUserString("ballot.package"));
        }
        if (status == StandardsStatus.NORMATIVE) {
            cs.setExperimental(false);
            cs.setStatus(PublicationStatus.ACTIVE);
        }
    }
    if (fmm != null) {
        String sfmm = ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_FMM_LEVEL);
        if (Utilities.noString(sfmm) || Integer.parseInt(sfmm) < Integer.parseInt(fmm)) {
            ToolingExtensions.setIntegerExtension(cs, ToolingExtensions.EXT_FMM_LEVEL, Integer.parseInt(fmm));
        }
        if (Integer.parseInt(fmm) <= 1) {
            cs.setExperimental(true);
        }
    }
}
Also used : StandardsStatus(org.hl7.fhir.utilities.StandardsStatus)

Aggregations

StandardsStatus (org.hl7.fhir.utilities.StandardsStatus)20 FHIRException (org.hl7.fhir.exceptions.FHIRException)9 ArrayList (java.util.ArrayList)7 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)7 FileNotFoundException (java.io.FileNotFoundException)6 IOException (java.io.IOException)6 URISyntaxException (java.net.URISyntaxException)6 File (java.io.File)5 SimpleDateFormat (java.text.SimpleDateFormat)5 Date (java.util.Date)5 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)5 TransformerException (javax.xml.transform.TransformerException)5 NotImplementedException (org.apache.commons.lang3.NotImplementedException)5 UcumException (org.fhir.ucum.UcumException)5 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)5 PathEngineException (org.hl7.fhir.exceptions.PathEngineException)5 CSFile (org.hl7.fhir.utilities.CSFile)5 IniFile (org.hl7.fhir.utilities.IniFile)5 TextFile (org.hl7.fhir.utilities.TextFile)5 SvgGenerator (org.hl7.fhir.definitions.generators.specification.SvgGenerator)4