Java Code Examples for org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent#getConcept()
The following examples show how to use
org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent#getConcept() .
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: ValueSetExpanderSimple.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private void excludeCodes(ConceptSetComponent exc, List<ValueSetExpansionParameterComponent> params, String ctxt) throws FHIRException { exc.checkNoModifiers("Compose.exclude", "expanding"); if (exc.hasSystem() && exc.getConcept().size() == 0 && exc.getFilter().size() == 0) { excludeSystems.add(exc.getSystem()); } if (exc.hasValueSet()) throw new Error("Processing Value set references in exclude is not yet done in "+ctxt); // importValueSet(imp.getValue(), params, expParams); CodeSystem cs = context.fetchCodeSystem(exc.getSystem()); if ((cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) && context.supportsSystem(exc.getSystem())) { ValueSetExpansionOutcome vse = context.expandVS(exc, false); ValueSet valueset = vse.getValueset(); if (valueset == null) throw new TerminologyServiceException("Error Expanding ValueSet: "+vse.getError()); excludeCodes(valueset.getExpansion(), params); return; } for (ConceptReferenceComponent c : exc.getConcept()) { excludeCode(exc.getSystem(), c.getCode()); } if (exc.getFilter().size() > 0) throw new NotImplementedException("not done yet"); }
Example 2
Source File: ProfileComparer.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
private boolean mergeIntoExisting(List<ConceptSetComponent> include, ConceptSetComponent inc) { for (ConceptSetComponent dst : include) { if (Base.compareDeep(dst, inc, false)) return true; // they're actually the same if (dst.getSystem().equals(inc.getSystem())) { if (inc.hasFilter() || dst.hasFilter()) { return false; // just add the new one as a a parallel } else if (inc.hasConcept() && dst.hasConcept()) { for (ConceptReferenceComponent cc : inc.getConcept()) { boolean found = false; for (ConceptReferenceComponent dd : dst.getConcept()) { if (dd.getCode().equals(cc.getCode())) found = true; if (found) { if (cc.hasDisplay() && !dd.hasDisplay()) dd.setDisplay(cc.getDisplay()); break; } } if (!found) dst.getConcept().add(cc.copy()); } } else dst.getConcept().clear(); // one of them includes the entire code system } } return false; }
Example 3
Source File: ValueSets.java From bunsen with Apache License 2.0 | 4 votes |
private static Iterator<Value> expandValuesIterator(ValueSet valueSet) { List<Value> values = new ArrayList<>(); ValueSetComposeComponent compose = valueSet.getCompose(); for (ConceptSetComponent inclusion: compose.getInclude()) { for (ConceptReferenceComponent concept: inclusion.getConcept()) { Value value = new Value(); value.setValueSetUri(valueSet.getUrl()); value.setValueSetVersion(valueSet.getVersion()); value.setSystem(inclusion.getSystem()); value.setVersion(inclusion.getVersion()); value.setValue(concept.getCode()); values.add(value); } } return values.iterator(); }
Example 4
Source File: ValidationSupportR4.java From synthea with Apache License 2.0 | 4 votes |
@Override public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl) { IssueSeverity severity = IssueSeverity.WARNING; String message = "Unsupported CodeSystem"; if (isCodeSystemSupported(theContext, theCodeSystem)) { severity = IssueSeverity.ERROR; message = "Code not found"; CodeSystem cs = codeSystemMap.get(theCodeSystem); for (ConceptDefinitionComponent def : cs.getConcept()) { if (def.getCode().equals(theCode)) { if (def.getDisplay() != null && theDisplay != null) { if (def.getDisplay().equals(theDisplay)) { severity = IssueSeverity.INFORMATION; message = "Validated Successfully"; } else { severity = IssueSeverity.WARNING; message = "Validated Code; Display mismatch"; } } else { severity = IssueSeverity.WARNING; message = "Validated Code; No display"; } } } } ValueSet vs = fetchValueSet(theContext, theValueSetUrl); if (vs != null && vs.hasCompose() && vs.getCompose().hasExclude()) { for (ConceptSetComponent exclude : vs.getCompose().getExclude()) { if (exclude.getSystem().equals(theCodeSystem) && exclude.hasConcept()) { for (ConceptReferenceComponent concept : exclude.getConcept()) { if (concept.getCode().equals(theCode)) { severity = IssueSeverity.ERROR; message += "; Code Excluded from ValueSet"; } } } } } return new CodeValidationResult(severity, message); }