org.hl7.fhir.dstu3.model.CodeSystem Java Examples
The following examples show how to use
org.hl7.fhir.dstu3.model.CodeSystem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValueSet10_30.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
static public 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.dstu3.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(VersionConvertor_10_30.convertCoding(csd.getUse())); cst.setValue(csd.getValue()); } for (ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, srcCS); }
Example #2
Source File: CodeSystem14_30.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentModeEnumFactory()); VersionConvertor_14_30.copyElement(src, tgt); switch(src.getValue()) { case NOTPRESENT: tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT); break; case EXAMPLAR: tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE); break; case FRAGMENT: tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT); break; case COMPLETE: tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE); break; default: tgt.setValue(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL); break; } return tgt; }
Example #3
Source File: CodeSystem14_30.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode> src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentModeEnumFactory()); VersionConvertor_14_30.copyElement(src, tgt); switch(src.getValue()) { case NOTPRESENT: tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT); break; case EXAMPLE: tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR); break; case FRAGMENT: tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT); break; case COMPLETE: tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE); break; default: tgt.setValue(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL); break; } return tgt; }
Example #4
Source File: NUCCConvertor.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public void execute() throws IOException, FHIRException { CSVReader csv = new CSVReader(new FileInputStream("c:\\temp\\nucc.csv")); CodeSystem cs = new CodeSystem(); cs.setId("nucc-provider-taxonomy"); cs.setUrl("http://nucc.org/provider-taxonomy"); cs.setName("NUCC Provider Taxonomy"); cs.setDateElement(new DateTimeType()); cs.setDescription("The Health Care Provider Taxonomy code is a unique alphanumeric code, ten characters in length. The code set is structured into three distinct 'Levels' including Provider Type, Classification, and Area of Specialization"); cs.setCopyright("See NUCC copyright statement"); cs.setStatus(PublicationStatus.ACTIVE); cs.setContent(CodeSystemContentMode.COMPLETE); cs.setExperimental(false); cs.setValueSet("http://hl7.org/fhir/ValueSet/nucc-provider-taxonomy"); cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH); csv.parseLine(); while (csv.ready()) { String[] values = csv.parseLine(); processLine(cs, values); } csv.close(); new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\nucc.xml"), cs); }
Example #5
Source File: CodeSystem14_30.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); VersionConvertor_14_30.copyElement(src, tgt); if (src.hasCodeElement()) tgt.setCodeElement(VersionConvertor_14_30.convertCode(src.getCodeElement())); if (src.hasDescription()) tgt.setDescriptionElement(VersionConvertor_14_30.convertString(src.getDescriptionElement())); for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) try { tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue())); } catch (org.hl7.fhir.exceptions.FHIRException e) { throw new FHIRException(e); } if (src.hasValueElement()) tgt.setValueElement(VersionConvertor_14_30.convertString(src.getValueElement())); return tgt; }
Example #6
Source File: ValueSet10_30.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
static public void processConcept(List<ConceptDefinitionComponent> concepts, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); concepts.add(ct); ct.setCode(cs.getCode()); ct.setDisplay(cs.getDisplay()); ct.setDefinition(cs.getDefinition()); if (cs.getAbstract()) CodeSystemUtilities.setNotSelectable(tgtcs, ct); for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); cst.setLanguage(csd.getLanguage()); cst.setUse(VersionConvertor_10_30.convertCoding(csd.getUse())); cst.setValue(csd.getValue()); } for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) processConcept(ct.getConcept(), csc, tgtcs); }
Example #7
Source File: CodeSystemUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static void markStatus(CodeSystem cs, String wg, String status, String fmm) { 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) { String ss = ToolingExtensions.readStringExtension(cs, ToolingExtensions.EXT_BALLOT_STATUS); if (Utilities.noString(ss) || ssval(ss) < ssval(status)) ToolingExtensions.setStringExtension(cs, ToolingExtensions.EXT_BALLOT_STATUS, status); } 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)); } }
Example #8
Source File: ValueSetUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public static void markStatus(ValueSet vs, String wg, String status, String fmm) { 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) { String ss = ToolingExtensions.readStringExtension(vs, ToolingExtensions.EXT_BALLOT_STATUS); if (Utilities.noString(ss) || ssval(ss) < ssval(status)) ToolingExtensions.setStringExtension(vs, ToolingExtensions.EXT_BALLOT_STATUS, status); } 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, fmm); }
Example #9
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private void generateProperties(XhtmlNode x, CodeSystem cs) { if (cs.hasProperty()) { x.para().b().tx("Properties"); XhtmlNode tbl = x.table("grid"); XhtmlNode tr = tbl.tr(); tr.td().b().tx("Code"); tr.td().b().tx("URL"); tr.td().b().tx("Description"); tr.td().b().tx("Type"); for (PropertyComponent p : cs.getProperty()) { tr = tbl.tr(); tr.td().tx(p.getCode()); tr.td().tx(p.getUri()); tr.td().tx(p.getDescription()); tr.td().tx(p.hasType() ? p.getType().toCode() : ""); } } }
Example #10
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private void addCodeToTable(boolean isAbstract, String system, String code, String display, XhtmlNode td) { CodeSystem e = context.fetchCodeSystem(system); if (e == null || e.getContent() != org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE) { if (isAbstract) td.i().setAttribute("title", ABSTRACT_CODE_HINT).addText(code); else if ("http://snomed.info/sct".equals(system)) { td.ah("http://browser.ihtsdotools.org/?perspective=full&conceptId1="+code).addText(code); } else if ("http://loinc.org".equals(system)) { td.ah("http://details.loinc.org/LOINC/"+code+".html").addText(code); } else td.addText(code); } else { String href = prefix+getCsRef(e); if (href.contains("#")) href = href + "-"+Utilities.nmtokenize(code); else href = href + "#"+e.getId()+"-"+Utilities.nmtokenize(code); if (isAbstract) td.ah(href).setAttribute("title", ABSTRACT_CODE_HINT).i().addText(code); else td.ah(href).addText(code); } }
Example #11
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private String determineCacheId(ValueSet vs, boolean heirarchical) throws Exception { // just the content logical definition is hashed ValueSet vsid = new ValueSet(); vsid.setCompose(vs.getCompose()); JsonParser parser = new JsonParser(); parser.setOutputStyle(OutputStyle.NORMAL); ByteArrayOutputStream b = new ByteArrayOutputStream(); parser.compose(b, vsid); b.close(); String s = new String(b.toByteArray(), Constants.CHARSET_UTF8); // any code systems we can find, we add these too. for (ConceptSetComponent inc : vs.getCompose().getInclude()) { CodeSystem cs = fetchCodeSystem(inc.getSystem()); if (cs != null) { String css = cacheValue(cs); s = s + css; } } s = s + "-" + Boolean.toString(heirarchical); String r = Integer.toString(s.hashCode()); // TextFile.stringToFile(s, Utilities.path(cache, r+".id.json")); return r; }
Example #12
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
private String cacheValue(CodeSystem cs) throws IOException { CodeSystem csid = new CodeSystem(); csid.setId(cs.getId()); csid.setVersion(cs.getVersion()); csid.setContent(cs.getContent()); csid.setHierarchyMeaning(CodeSystemHierarchyMeaning.GROUPEDBY); for (ConceptDefinitionComponent cc : cs.getConcept()) { csid.getConcept().add(processCSConcept(cc)); } JsonParser parser = new JsonParser(); parser.setOutputStyle(OutputStyle.NORMAL); ByteArrayOutputStream b = new ByteArrayOutputStream(); parser.compose(b, csid); b.close(); return new String(b.toByteArray(), Constants.CHARSET_UTF8); }
Example #13
Source File: SimpleWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public void seeResource(String url, Resource r) throws FHIRException { if (r instanceof StructureDefinition) seeProfile(url, (StructureDefinition) r); else if (r instanceof ValueSet) seeValueSet(url, (ValueSet) r); else if (r instanceof CodeSystem) seeCodeSystem(url, (CodeSystem) r); else if (r instanceof OperationDefinition) seeOperationDefinition(url, (OperationDefinition) r); else if (r instanceof ConceptMap) maps.put(((ConceptMap) r).getUrl(), (ConceptMap) r); else if (r instanceof StructureMap) transforms.put(((StructureMap) r).getUrl(), (StructureMap) r); else if (r instanceof NamingSystem) systems.add((NamingSystem) r); }
Example #14
Source File: CareConnectProfileDbValidationSupportSTU3.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
private CodeValidationResult testIfConceptIsInListInner(List<CodeSystem.ConceptDefinitionComponent> conceptList, boolean theCaseSensitive, String code) { logT("CareConnect testIfConceptIsInListInner: code=" + code); CodeValidationResult retVal = null; for (CodeSystem.ConceptDefinitionComponent next : conceptList) { // KGM logT("CareConnect testIfConceptIsInListInner NextCode = "+next.getCode()); String nextCandidate = next.getCode(); if (theCaseSensitive == false) { nextCandidate = nextCandidate.toUpperCase(); } if (nextCandidate.equals(code)) { logD("Code "+code+" is in the list"); retVal = new CodeValidationResult(next); break; } // recurse retVal = testIfConceptIsInList(code, next.getConcept(), theCaseSensitive); if (retVal != null) { break; } } return retVal; }
Example #15
Source File: CareConnectProfileDbValidationSupportSTU3.java From careconnect-reference-implementation with Apache License 2.0 | 6 votes |
@Override public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay) { CodeSystem cs = fetchCodeSystem(theContext, theCodeSystem); logD("CareConnect validateCode system = "+ theCodeSystem); if (cs != null) { boolean caseSensitive = true; if (cs.hasCaseSensitive()) { caseSensitive = cs.getCaseSensitive(); } CodeValidationResult retVal = testIfConceptIsInList(theCode, cs.getConcept(), caseSensitive); if (retVal != null) { return retVal; } } return new CodeValidationResult(IssueSeverity.WARNING, "CareConnect Unknown code: " + theCodeSystem + " / " + theCode); }
Example #16
Source File: ValidationSupportSTU3.java From synthea with Apache License 2.0 | 6 votes |
@Override public LookupCodeResult lookupCode(FhirContext theContext, String theSystem, String theCode) { if (isCodeSystemSupported(theContext, theSystem)) { LookupCodeResult result = new LookupCodeResult(); result.setSearchedForSystem(theSystem); result.setSearchedForCode(theCode); result.setFound(false); CodeSystem cs = codeSystemMap.get(theSystem); for (ConceptDefinitionComponent def : cs.getConcept()) { if (def.getCode().equals(theCode)) { result.setCodeDisplay(def.getDisplay()); result.setFound(true); return result; } } } return LookupCodeResult.notFound(theSystem, theCode); }
Example #17
Source File: CodeSystemUpdateProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
public OperationOutcome performCodeSystemUpdate(ValueSet vs) { OperationOutcomeBuilder responseBuilder = new OperationOutcomeBuilder(); List<String> codeSystems = new ArrayList<>(); if (vs.hasCompose() && vs.getCompose().hasInclude()) { CodeSystem codeSystem; for (ValueSet.ConceptSetComponent csc : vs.getCompose().getInclude()) { if (!csc.hasSystem()) continue; codeSystem = getCodeSystemByUrl(csc.getSystem()); if (!csc.hasConcept()) continue; updateCodeSystem( codeSystem.setUrl(csc.getSystem()), getUnionDistinctCodes(csc, codeSystem) ); codeSystems.add(codeSystem.getUrl()); } } return responseBuilder.buildIssue( "information", "informational", "Successfully updated the following CodeSystems: " + String.join(", ", codeSystems) ).build(); }
Example #18
Source File: ICPC2Importer.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
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); } }
Example #19
Source File: CareConnectProfileDbValidationSupportSTU3.java From careconnect-reference-implementation with Apache License 2.0 | 5 votes |
private CodeValidationResult testIfConceptIsInList(String theCode, List<CodeSystem.ConceptDefinitionComponent> conceptList, boolean theCaseSensitive) { logT("CareConnect testIfConceptIsInList: {} code="+ theCode); String code = theCode; if (theCaseSensitive == false) { code = code.toUpperCase(); } return testIfConceptIsInListInner(conceptList, theCaseSensitive, code); }
Example #20
Source File: NUCCConvertor.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private void processLine(CodeSystem cs, String[] values) throws FHIRFormatError { if (!values[1].equals(last[0])) { last[1] = ""; last[0] = values[1]; concepts[0] = new ConceptDefinitionComponent(); cs.getConcept().add(concepts[0]); concepts[0].setDisplay(values[1]); concepts[0].setCode("base-"+Integer.toString(cs.getConcept().size())); CodeSystemUtilities.setNotSelectable(cs, concepts[0]); } if (!values[2].equals(last[1])) { last[1] = values[2]; concepts[1] = new ConceptDefinitionComponent(); concepts[0].getConcept().add(concepts[1]); concepts[1].setCode(values[0]); concepts[1].setDisplay(values[2]); concepts[1].setDefinition(values[4]); if (values.length > 5 && !Utilities.noString(values[5])) ToolingExtensions.addCSComment(concepts[1], values[5]); } else if (!Utilities.noString(values[3])) { ConceptDefinitionComponent cc = new ConceptDefinitionComponent(); concepts[1].getConcept().add(cc); cc.setCode(values[0]); cc.setDisplay(values[3]); cc.setDefinition(values[4]); if (values.length > 5 && !Utilities.noString(values[5])) ToolingExtensions.addCSComment(cc, values[5]); } }
Example #21
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private boolean codeExistsInValueSet(CodeSystem cs, String code) { for (ConceptDefinitionComponent c : cs.getConcept()) { if (inConcept(code, c)) return true; } return false; }
Example #22
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private boolean conceptsHaveDeprecated(CodeSystem cs, ConceptDefinitionComponent c) { if (CodeSystemUtilities.isDeprecated(cs, c)) return true; for (ConceptDefinitionComponent g : c.getConcept()) if (conceptsHaveDeprecated(cs, g)) return true; return false; }
Example #23
Source File: NarrativeGenerator.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private boolean checkDoDefinition(List<ValueSetExpansionContainsComponent> contains) { for (ValueSetExpansionContainsComponent c : contains) { CodeSystem cs = context.fetchCodeSystem(c.getSystem()); if (cs != null) return true; if (checkDoDefinition(c.getContains())) return true; } return false; }
Example #24
Source File: FHIRToolingClient.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public Parameters lookupCode(Map<String, String> params) { ResourceRequest<Resource> result = utils.issueGetResourceRequest(resourceAddress.resolveOperationUri(CodeSystem.class, "lookup", params), getPreferredResourceFormat()); result.addErrorStatus(410);//gone result.addErrorStatus(404);//unknown result.addErrorStatus(405); result.addErrorStatus(422);//Unprocessable Entity result.addSuccessStatus(200); result.addSuccessStatus(201); if(result.isUnsuccessfulRequest()) { throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload()); } return (Parameters) result.getPayload(); }
Example #25
Source File: CodeSystem14_30.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); VersionConvertor_14_30.copyElement(src, tgt); if (src.hasName()) tgt.setNameElement(VersionConvertor_14_30.convertString(src.getNameElement())); for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) tgt.addTelecom(VersionConvertor_14_30.convertContactPoint(t)); return tgt; }
Example #26
Source File: CodeSystemUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static boolean isInactive(CodeSystem cs, ConceptDefinitionComponent def) throws FHIRException { for (ConceptPropertyComponent p : def.getProperty()) { if (p.getCode().equals("status") && p.hasValueStringType()) return "inactive".equals(p.getValueStringType()); } return false; }
Example #27
Source File: ValidationSupportSTU3.java From synthea with Apache License 2.0 | 5 votes |
/** * Loads the structure definitions from the given directory. * @param rootDir the directory to load structure definitions from * @return a list of structure definitions * @throws Throwable when there is an error reading the structure definitions. */ private void loadFromDirectory(String rootDir) throws Throwable { IParser jsonParser = FhirContext.forDstu3().newJsonParser(); jsonParser.setParserErrorHandler(new StrictErrorHandler()); URL profilesFolder = ClassLoader.getSystemClassLoader().getResource(rootDir); Path path = Paths.get(profilesFolder.toURI()); Files.walk(path, Integer.MAX_VALUE).filter(Files::isReadable).filter(Files::isRegularFile) .filter(p -> p.toString().endsWith(".json")).forEach(f -> { try { IBaseResource resource = jsonParser.parseResource(new FileReader(f.toFile())); resources.add(resource); if (resource instanceof CodeSystem) { CodeSystem cs = (CodeSystem) resource; resourcesMap.put(cs.getUrl(), cs); codeSystemMap.put(cs.getUrl(), cs); } else if (resource instanceof ValueSet) { ValueSet vs = (ValueSet) resource; resourcesMap.put(vs.getUrl(), vs); } else if (resource instanceof StructureDefinition) { StructureDefinition sd = (StructureDefinition) resource; resourcesMap.put(sd.getUrl(), sd); definitions.add(sd); definitionsMap.put(sd.getUrl(), sd); } } catch (FileNotFoundException e) { throw new RuntimeException(e); } }); }
Example #28
Source File: JpaTerminologyProvider.java From cqf-ruler with Apache License 2.0 | 5 votes |
@Override public synchronized Code lookup(Code code, CodeSystemInfo codeSystem) throws ResourceNotFoundException { CodeSystem cs = terminologySvcDstu3.fetchCodeSystem(context, codeSystem.getId()); for (CodeSystem.ConceptDefinitionComponent concept : cs.getConcept()) { if (concept.getCode().equals(code.getCode())) return code.withSystem(codeSystem.getId()).withDisplay(concept.getDisplay()); } return code; }
Example #29
Source File: CodeSystemUtilities.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public static CodeSystem makeShareable(CodeSystem cs) { if (!cs.hasMeta()) cs.setMeta(new Meta()); for (UriType t : cs.getMeta().getProfile()) if (t.getValue().equals("http://hl7.org/fhir/StructureDefinition/shareablecodesystem")) return cs; cs.getMeta().getProfile().add(new UriType("http://hl7.org/fhir/StructureDefinition/shareablecodesystem")); return cs; }
Example #30
Source File: BaseWorkerContext.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public void seeCodeSystem(String url, CodeSystem cs) throws FHIRException { if (codeSystems.containsKey(cs.getUrl()) && !allowLoadingDuplicates) { throw new FHIRException("Duplicate code system " + cs.getUrl()); } codeSystems.put(cs.getId(), cs); codeSystems.put(url, cs); codeSystems.put(cs.getUrl(), cs); }