@Override public ValueSetExpansionComponent expandValueSet(FhirContext theContext, ConceptSetComponent theInclude) { ValueSetExpansionComponent retVal = new ValueSetExpansionComponent(); Set<String> wantCodes = new HashSet<>(); for (ConceptReferenceComponent next : theInclude.getConcept()) { wantCodes.add(next.getCode()); } CodeSystem system = fetchCodeSystem(theContext, theInclude.getSystem()); if (system != null) { List<ConceptDefinitionComponent> concepts = system.getConcept(); addConcepts(theInclude, retVal, wantCodes, concepts); } for (UriType next: theInclude.getValueSet()) { ValueSet vs = myValueSets.get(defaultString(next.getValueAsString())); if (vs != null) { for (ConceptSetComponent nextInclude : vs.getCompose().getInclude()) { ValueSetExpansionComponent contents = expandValueSet(theContext, nextInclude); retVal.getContains().addAll(contents.getContains()); } } } return retVal; }
private void validateIncludes(String name, List<ConceptSetComponent> listToValidate) { for (ConceptSetComponent nextExclude : listToValidate) { if (isBlank(nextExclude.getSystem()) && !ElementUtil.isEmpty(nextExclude.getConcept(), nextExclude.getFilter())) { throw new InvalidRequestException("ValueSet contains " + name + " criteria with no system defined"); } } }
private void addFilterIfPresent(String theFilter, ConceptSetComponent include) { if (ElementUtil.isEmpty(include.getConcept())) { if (isNotBlank(theFilter)) { include.addFilter().setProperty("display").setOp(FilterOperator.EQUAL).setValue(theFilter); } } }
params.add(new ValueSetExpansionParameterComponent().setName("version").setValue(new UriType(cs.getUrl() + "|" + cs.getVersion()))); if (inc.getConcept().size() == 0 && inc.getFilter().size() == 0) { if (!inc.getConcept().isEmpty()) { canBeHeirarchy = false; for (ConceptReferenceComponent c : inc.getConcept()) { addCode(inc.getSystem(), c.getCode(), Utilities.noString(c.getDisplay()) ? getCodeDisplay(cs, c.getCode()) : c.getDisplay(), null, convertDesignations(c.getDesignation()), profile, false, CodeSystemUtilities.isInactive(cs, c.getCode()), imports);
for (ConceptSetComponent next : theVs.getCompose().getInclude()) { if (isBlank(theSystem) || theSystem.equals(next.getSystem())) { for (ConceptReferenceComponent nextCode : next.getConcept()) { if (theCode.equals(nextCode.getCode())) { CodeType code = new CodeType(theCode); ValueSet expansion = new ValueSet(); for (ConceptSetComponent nextInclude : theVs.getCompose().getInclude()) { for (ConceptReferenceComponent nextConcept : nextInclude.getConcept()) { expansion.getExpansion().addContains().setCode(nextConcept.getCode()).setDisplay(nextConcept.getDisplay());
currentInclusion.setConcept(new ArrayList<>(currentInclusion.getConcept()));
for (ConceptReferenceComponent cc : vsi.getConcept()) if (cc.getCode().equals(code)) { return true; if (!def.getCaseSensitive()) { for (ConceptReferenceComponent cc : vsi.getConcept()) if (cc.getCode().equalsIgnoreCase(code)) { return false; if (vsi.getConcept().isEmpty() && vsi.getFilter().isEmpty()) { return codeInDefine(def.getConcept(), code, def.getCaseSensitive());
@Override public ValueSetExpansionComponent expandValueSet(FhirContext theContext, ConceptSetComponent theInclude) { ValueSetExpansionComponent retVal = new ValueSetExpansionComponent(); Set<String> wantCodes = new HashSet<>(); for (ConceptReferenceComponent next : theInclude.getConcept()) { wantCodes.add(next.getCode()); } CodeSystem system = fetchCodeSystem(theContext, theInclude.getSystem()); if (system != null) { List<ConceptDefinitionComponent> concepts = system.getConcept(); addConcepts(theInclude, retVal, wantCodes, concepts); } for (UriType next: theInclude.getValueSet()) { ValueSet vs = myValueSets.get(defaultString(next.getValueAsString())); if (vs != null) { for (ConceptSetComponent nextInclude : vs.getCompose().getInclude()) { ValueSetExpansionComponent contents = expandValueSet(theContext, nextInclude); retVal.getContains().addAll(contents.getContains()); } } } return retVal; }
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case -887328209: // system this.system = castToUri(value); // UriType return value; case 351608024: // version this.version = castToString(value); // StringType return value; case 951024232: // concept this.getConcept().add((ConceptReferenceComponent) value); // ConceptReferenceComponent return value; case -1274492040: // filter this.getFilter().add((ConceptSetFilterComponent) value); // ConceptSetFilterComponent return value; case -1410174671: // valueSet this.getValueSet().add(castToUri(value)); // UriType return value; default: return super.setProperty(hash, name, value); } }
private void excludeCodes(ConceptSetComponent exc, List<ValueSetExpansionParameterComponent> params) throws TerminologyServiceException { 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"); // importValueSet(imp.getValue(), params, profile); CodeSystem cs = context.fetchCodeSystem(exc.getSystem()); if ((cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE) && context.supportsSystem(exc.getSystem())) { excludeCodes(context.expandVS(exc, false), params); return; } for (ConceptReferenceComponent c : exc.getConcept()) { excludeCode(exc.getSystem(), c.getCode()); } if (exc.getFilter().size() > 0) throw new NotImplementedException("not done yet"); }
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("system")) { this.system = castToUri(value); // UriType } else if (name.equals("version")) { this.version = castToString(value); // StringType } else if (name.equals("concept")) { this.getConcept().add((ConceptReferenceComponent) value); } else if (name.equals("filter")) { this.getFilter().add((ConceptSetFilterComponent) value); } else if (name.equals("valueSet")) { this.getValueSet().add(castToUri(value)); } else return super.setProperty(name, value); return value; }
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(); }
public org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent(); copyElement(src, tgt); tgt.setSystem(src.getSystem()); tgt.setVersion(src.getVersion()); for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); return tgt; }
public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); copyElement(src, tgt); tgt.setSystem(src.getSystem()); if (src.hasVersion()) tgt.setVersion(src.getVersion()); for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); return tgt; }
private void addFilterIfPresent(String theFilter, ConceptSetComponent include) { if (ElementUtil.isEmpty(include.getConcept())) { if (isNotBlank(theFilter)) { include.addFilter().setProperty("display").setOp(FilterOperator.EQUAL).setValue(theFilter); } } }
private void validateIncludes(String name, List<ConceptSetComponent> listToValidate) { for (ConceptSetComponent nextExclude : listToValidate) { if (isBlank(nextExclude.getSystem()) && !ElementUtil.isEmpty(nextExclude.getConcept(), nextExclude.getFilter())) { throw new InvalidRequestException("ValueSet contains " + name + " criteria with no system defined"); } } }
/** * @return The first repetition of repeating field {@link #concept}, creating it if it does not already exist */ public ConceptReferenceComponent getConceptFirstRep() { if (getConcept().isEmpty()) { addConcept(); } return getConcept().get(0); }
public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); copyElement(src, tgt); tgt.setSystem(src.getSystem()); if (src.hasVersion()) tgt.setVersion(src.getVersion()); for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); return tgt; }
public org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent(); copyElement(src, tgt); tgt.setSystem(src.getSystem()); tgt.setVersion(src.getVersion()); for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) tgt.addConcept(convertConceptReferenceComponent(t)); for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) tgt.addFilter(convertConceptSetFilterComponent(t)); return tgt; }