Search in sources :

Example 21 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.

the class ValueSet10_50 method convertCodeSystemConcept.

public static ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException {
    if (src == null || src.isEmpty())
        return null;
    ValueSet.ConceptDefinitionComponent tgt = new ValueSet.ConceptDefinitionComponent();
    ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
    tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src));
    if (src.hasCode())
        tgt.setCode(src.getCode());
    if (src.hasDefinition())
        tgt.setDefinition(src.getDefinition());
    if (src.hasDisplay())
        tgt.setDisplay(src.getDisplay());
    for (ConceptDefinitionComponent cc : src.getConcept()) tgt.addConcept(convertCodeSystemConcept(cs, cc));
    for (CodeSystem.ConceptDefinitionDesignationComponent cc : src.getDesignation()) tgt.addDesignation(convertCodeSystemDesignation(cc));
    return tgt;
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent) ValueSet(org.hl7.fhir.dstu2.model.ValueSet) CodeSystem(org.hl7.fhir.r5.model.CodeSystem)

Example 22 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.

the class ValueSet10_50 method processConcept.

public static void processConcept(List<ValueSet.ConceptDefinitionComponent> concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException {
    org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent();
    concepts.add(ct);
    ct.setCode(cs.getCode());
    ct.setDisplay(cs.getDisplay());
    ct.setDefinition(cs.getDefinition());
    if (CodeSystemUtilities.isNotSelectable(srcCS, cs))
        ct.setAbstract(true);
    for (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) {
        org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent();
        cst.setLanguage(csd.getLanguage());
        cst.setUse(Coding10_50.convertCoding(csd.getUse()));
        cst.setValue(csd.getValue());
    }
    for (ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, srcCS);
}
Also used : CodeSystem(org.hl7.fhir.r5.model.CodeSystem) ConceptDefinitionComponent(org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent) ValueSet(org.hl7.fhir.dstu2.model.ValueSet)

Example 23 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.

the class DicomPackageBuilder method buildCodeSystem.

private CodeSystem buildCodeSystem() throws ParserConfigurationException, FileNotFoundException, SAXException, IOException {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse(new FileInputStream(Utilities.path(source, "Resources", "Ontology", "DCM", "dcm.owl")));
    Element rdf = doc.getDocumentElement();
    Element d = XMLUtil.getFirstChild(rdf);
    version = processVersion(XMLUtil.getNamedChildText(d, "versionInfo"));
    CodeSystem cs = new CodeSystem();
    cs.setId("DCM");
    cs.setUrl("http://dicom.nema.org/resources/ontology/DCM");
    cs.setVersion(version);
    cs.setName("DICOMTerminologyDefinitions");
    cs.setTitle("DICOM Controlled Terminology Definitions");
    cs.getIdentifier().add(new Identifier().setSystem("urn:ietf:rfc:3986").setValue("urn:oid:1.2.840.10008.2.16.4"));
    cs.setStatus(PublicationStatus.ACTIVE);
    cs.setExperimental(false);
    cs.setPublisher("FHIR Project on behalf of DICOM");
    cs.setDate(new Date());
    cs.setDescription("DICOM Code Definitions (Coding Scheme Designator \"DCM\" Coding Scheme Version " + version);
    cs.setPurpose("This code system is published as part of FHIR in order to make the codes available to FHIR terminology services and so implementers can easily leverage the codes");
    cs.setCopyright("These codes are excerpted from Digital Imaging and Communications in Medicine (DICOM) Standard, Part 16: Content Mapping Resource, Copyright © 2011 by the National Electrical Manufacturers Association.");
    cs.setCaseSensitive(true);
    cs.setValueSet("http://dicom.nema.org/resources/ValueSet/all");
    cs.setContent(CodeSystemContentMode.COMPLETE);
    d = XMLUtil.getNextSibling(d);
    while (d != null) {
        String code = XMLUtil.getNamedChildText(d, "notation");
        String display = XMLUtil.getNamedChildText(d, "prefLabel");
        String definition = XMLUtil.getNamedChildText(d, "definition");
        ConceptDefinitionComponent cc = new ConceptDefinitionComponent();
        cs.getConcept().add(cc);
        cc.setCode(code);
        cc.setDisplay(display);
        cc.setDefinition(definition);
        d = XMLUtil.getNextSibling(d);
    }
    return cs;
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) Identifier(org.hl7.fhir.r4.model.Identifier) ConceptDefinitionComponent(org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Element(org.w3c.dom.Element) Document(org.w3c.dom.Document) CodeSystem(org.hl7.fhir.r4.model.CodeSystem) FileInputStream(java.io.FileInputStream) Date(java.util.Date)

Example 24 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.

the class ICPC2Importer method processClass.

private void processClass(Element cls, Map<String, ConceptDefinitionComponent> concepts, CodeSystem define) throws FHIRFormatError {
    ConceptDefinitionComponent concept = new ConceptDefinitionComponent();
    concept.setCode(cls.getAttribute("code"));
    concept.setDefinition(getRubric(cls, "preferred"));
    String s = getRubric(cls, "shortTitle");
    if (s != null && !s.equals(concept.getDefinition()))
        concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("shortTitle")).setValue(s);
    s = getRubric(cls, "inclusion");
    if (s != null)
        concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("inclusion")).setValue(s);
    s = getRubric(cls, "exclusion");
    if (s != null)
        concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("exclusion")).setValue(s);
    s = getRubric(cls, "criteria");
    if (s != null)
        concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("criteria")).setValue(s);
    s = getRubric(cls, "consider");
    if (s != null)
        concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("consider")).setValue(s);
    s = getRubric(cls, "note");
    if (s != null)
        concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("note")).setValue(s);
    concepts.put(concept.getCode(), concept);
    List<Element> children = new ArrayList<Element>();
    XMLUtil.getNamedChildren(cls, "SubClass", children);
    if (children.size() > 0)
        CodeSystemUtilities.setNotSelectable(define, concept);
    Element parent = XMLUtil.getNamedChild(cls, "SuperClass");
    if (parent == null) {
        define.addConcept(concept);
    } else {
        ConceptDefinitionComponent p = concepts.get(parent.getAttribute("code"));
        p.getConcept().add(concept);
    }
}
Also used : ConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList)

Example 25 with ConceptDefinitionComponent

use of org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent in project org.hl7.fhir.core by hapifhir.

the class CodeSystem method setProperty.

@Override
public void setProperty(String name, Base value) throws FHIRException {
    if (name.equals("url"))
        // UriType
        this.url = castToUri(value);
    else if (name.equals("identifier"))
        // Identifier
        this.identifier = castToIdentifier(value);
    else if (name.equals("version"))
        // StringType
        this.version = castToString(value);
    else if (name.equals("name"))
        // StringType
        this.name = castToString(value);
    else if (name.equals("status"))
        // Enumeration<ConformanceResourceStatus>
        this.status = new ConformanceResourceStatusEnumFactory().fromType(value);
    else if (name.equals("experimental"))
        // BooleanType
        this.experimental = castToBoolean(value);
    else if (name.equals("publisher"))
        // StringType
        this.publisher = castToString(value);
    else if (name.equals("contact"))
        this.getContact().add((CodeSystemContactComponent) value);
    else if (name.equals("date"))
        // DateTimeType
        this.date = castToDateTime(value);
    else if (name.equals("description"))
        // StringType
        this.description = castToString(value);
    else if (name.equals("useContext"))
        this.getUseContext().add(castToCodeableConcept(value));
    else if (name.equals("requirements"))
        // StringType
        this.requirements = castToString(value);
    else if (name.equals("copyright"))
        // StringType
        this.copyright = castToString(value);
    else if (name.equals("caseSensitive"))
        // BooleanType
        this.caseSensitive = castToBoolean(value);
    else if (name.equals("valueSet"))
        // UriType
        this.valueSet = castToUri(value);
    else if (name.equals("compositional"))
        // BooleanType
        this.compositional = castToBoolean(value);
    else if (name.equals("versionNeeded"))
        // BooleanType
        this.versionNeeded = castToBoolean(value);
    else if (name.equals("content"))
        // Enumeration<CodeSystemContentMode>
        this.content = new CodeSystemContentModeEnumFactory().fromType(value);
    else if (name.equals("count"))
        // UnsignedIntType
        this.count = castToUnsignedInt(value);
    else if (name.equals("filter"))
        this.getFilter().add((CodeSystemFilterComponent) value);
    else if (name.equals("property"))
        this.getProperty().add((CodeSystemPropertyComponent) value);
    else if (name.equals("concept"))
        this.getConcept().add((ConceptDefinitionComponent) value);
    else
        super.setProperty(name, value);
}
Also used : ConformanceResourceStatusEnumFactory(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatusEnumFactory)

Aggregations

ConceptDefinitionComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent)54 ArrayList (java.util.ArrayList)26 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)26 ConceptDefinitionComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionComponent)22 CodeSystem (org.hl7.fhir.r5.model.CodeSystem)21 ConceptDefinitionComponent (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent)17 ConceptDefinitionComponent (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent)16 ValueSet (org.hl7.fhir.dstu2.model.ValueSet)15 FHIRException (org.hl7.fhir.exceptions.FHIRException)14 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)12 ConceptPropertyComponent (org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent)10 ConceptPropertyComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent)10 IOException (java.io.IOException)9 HashMap (java.util.HashMap)9 NotImplementedException (org.apache.commons.lang3.NotImplementedException)9 TerminologyServiceException (org.hl7.fhir.exceptions.TerminologyServiceException)9 FileNotFoundException (java.io.FileNotFoundException)8 ConceptDefinitionComponent (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent)8 ValidationResult (org.hl7.fhir.r5.context.IWorkerContext.ValidationResult)8 ConceptDefinitionDesignationComponent (org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent)8