private boolean codeInExpansion(ValueSet vs, String system, String code) { for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) { if (code.equals(c.getCode()) && (system == null || system.equals(c.getSystem()))) return true; if (codeinExpansion(c, system, code)) return true; } return false; }
@Override public ValueSetExpansionComponent expandValueSet(FhirContext theCtx, ConceptSetComponent theInclude) { for (IValidationSupport next : myChain) { if (isNotBlank(theInclude.getSystem())) { if (next.isCodeSystemSupported(theCtx, theInclude.getSystem())) { return next.expandValueSet(theCtx, theInclude); } } for (UriType nextValueSet : theInclude.getValueSet()) { ValueSetExpansionComponent retVal = next.expandValueSet(theCtx, theInclude); if (retVal != null && retVal.getContains().size() > 0) { return retVal; } } } return myChain.get(0).expandValueSet(theCtx, theInclude); }
@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; }
public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); copyElement(src, tgt); tgt.setIdentifier(src.getIdentifier()); tgt.setTimestamp(src.getTimestamp()); if (src.hasTotal()) tgt.setTotal(src.getTotal()); if (src.hasOffset()) tgt.setOffset(src.getOffset()); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("identifier")) { this.identifier = castToUri(value); // UriType } else if (name.equals("timestamp")) { this.timestamp = castToDateTime(value); // DateTimeType } else if (name.equals("total")) { this.total = castToInteger(value); // IntegerType } else if (name.equals("offset")) { this.offset = castToInteger(value); // IntegerType } else if (name.equals("parameter")) { this.getParameter().add((ValueSetExpansionParameterComponent) value); } else if (name.equals("contains")) { this.getContains().add((ValueSetExpansionContainsComponent) value); } else return super.setProperty(name, value); return value; }
@Override public ValueSetExpansionComponent expandValueSet(FhirContext theCtx, ConceptSetComponent theInclude) { for (IValidationSupport next : myChain) { if (isNotBlank(theInclude.getSystem())) { if (next.isCodeSystemSupported(theCtx, theInclude.getSystem())) { return next.expandValueSet(theCtx, theInclude); } } for (UriType nextValueSet : theInclude.getValueSet()) { ValueSetExpansionComponent retVal = next.expandValueSet(theCtx, theInclude); if (retVal != null && retVal.getContains().size() > 0) { return retVal; } } } return myChain.get(0).expandValueSet(theCtx, theInclude); }
public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent(); copyElement(src, tgt); tgt.setIdentifier(src.getIdentifier()); tgt.setTimestamp(src.getTimestamp()); tgt.setTotal(src.getTotal()); tgt.setOffset(src.getOffset()); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }
private boolean isSubset(ValueSet expBase, ValueSet expDerived) { return codesInExpansion(expDerived.getExpansion().getContains(), expBase.getExpansion()); }
private boolean filterContainsCode(List<ValueSet> filters, String system, String code) { for (ValueSet vse : filters) if (expansionContainsCode(vse.getExpansion().getContains(), system, code)) return true; return false; }
private boolean codesInExpansion(List<ValueSetExpansionContainsComponent> contains, ValueSetExpansionComponent expansion) { for (ValueSetExpansionContainsComponent cc : contains) { if (!inExpansion(cc, expansion.getContains())) return false; if (!codesInExpansion(cc.getContains(), expansion)) return false; } return true; }
private boolean codeInExpansion(ValueSetExpansionOutcome vso, String system, String code) throws EOperationOutcome, Exception { if (vso.getService() != null) { return vso.getService().codeInValueSet(system, code); } else { for (ValueSetExpansionContainsComponent c : vso.getValueset().getExpansion().getContains()) { if (code.equals(c.getCode()) && (system == null || system.equals(c.getSystem()))) return true; if (codeinExpansion(c, system, code)) return true; } } return false; }
private boolean codeInExpansion(ValueSet vs, String system, String code) { for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) { if (code.equals(c.getCode()) && (system == null || system.equals(c.getSystem()))) return true; if (codeinExpansion(c, system, code)) return true; } return false; }
/** * @return The first repetition of repeating field {@link #contains}, creating it if it does not already exist */ public ValueSetExpansionContainsComponent getContainsFirstRep() { if (getContains().isEmpty()) { addContains(); } return getContains().get(0); }
private void addCodes(ValueSetExpansionComponent expand, List<ValueSetExpansionParameterComponent> params, ExpansionProfile profile, List<ValueSet> filters) throws ETooCostly { if (expand.getContains().size() > maxExpansionSize) throw new ETooCostly("Too many codes to display (>" + Integer.toString(expand.getContains().size()) + ")"); for (ValueSetExpansionParameterComponent p : expand.getParameter()) { if (!existsInParams(params, p.getName(), p.getValue())) params.add(p); } copyImportContains(expand.getContains(), null, profile, filters); }
private void excludeCodes(ValueSetExpansionComponent expand, List<ValueSetExpansionParameterComponent> params) { for (ValueSetExpansionContainsComponent c : expand.getContains()) { excludeCode(c.getSystem(), c.getCode()); } }
for (ValueSetExpansionContainsComponent next : valueSet.getExpansion().getContains()) { if (coding.getCode().equals(next.getCode()) && coding.getSystem().equals(next.getSystem())) { found = true;
List<ValueSetExpansionContainsComponent> contains = expansion.getExpansion().getContains();
@Override public ValueSet expand(ValueSet source, String theFilter) { ValueSet toExpand = new ValueSet(); // for (UriType next : source.getCompose().getInclude()) { // ConceptSetComponent include = toExpand.getCompose().addInclude(); // include.setSystem(next.getValue()); // addFilterIfPresent(theFilter, include); // } for (ConceptSetComponent next : source.getCompose().getInclude()) { toExpand.getCompose().addInclude(next); addFilterIfPresent(theFilter, next); } if (toExpand.getCompose().isEmpty()) { throw new InvalidRequestException("ValueSet does not have any compose.include or compose.import values, can not expand"); } toExpand.getCompose().getExclude().addAll(source.getCompose().getExclude()); ValueSet retVal = doExpand(toExpand); if (isNotBlank(theFilter)) { applyFilter(retVal.getExpansion().getTotalElement(), retVal.getExpansion().getContains(), theFilter); } return retVal; }
public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); copyElement(src, tgt); tgt.setIdentifier(src.getIdentifier()); tgt.setTimestamp(src.getTimestamp()); if (src.hasTotal()) tgt.setTotal(src.getTotal()); if (src.hasOffset()) tgt.setOffset(src.getOffset()); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }
public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent(); copyElement(src, tgt); tgt.setIdentifier(src.getIdentifier()); tgt.setTimestamp(src.getTimestamp()); tgt.setTotal(src.getTotal()); tgt.setOffset(src.getOffset()); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }