@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 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 addConcepts(ConceptSetComponent theInclude, ValueSetExpansionComponent theRetVal, Set<String> theWantCodes, List<ConceptDefinitionComponent> theConcepts) { for (ConceptDefinitionComponent next : theConcepts) { if (theWantCodes.isEmpty() || theWantCodes.contains(next.getCode())) { theRetVal .addContains() .setSystem(theInclude.getSystem()) .setCode(next.getCode()) .setDisplay(next.getDisplay()); } addConcepts(theInclude, theRetVal, theWantCodes, next.getConcept()); } }
ValueSet base = imports.get(0); imports.remove(0); copyImportContains(base.getExpansion().getContains(), null, profile, imports); } else { CodeSystem cs = context.fetchCodeSystem(inc.getSystem());
for (ValueSetExpansionContainsComponent next : valueSet.getExpansion().getContains()) { if (coding.getCode().equals(next.getCode()) && coding.getSystem().equals(next.getSystem())) { found = true;
this.expansion = new ValueSetExpansionComponent(); return this.expansion;
for (ConceptSetComponent nextInclude : theVs.getCompose().getInclude()) { for (ConceptReferenceComponent nextConcept : nextInclude.getConcept()) { expansion.getExpansion().addContains().setCode(nextConcept.getCode()).setDisplay(nextConcept.getDisplay()); for (ValueSetExpansionContainsComponent next : expandedValueSet.getValueset().getExpansion().getContains()) { String nextCode = next.getCode(); if (!caseSensitive) {
List<ValueSetExpansionContainsComponent> contains = expansion.getExpansion().getContains();
try { focus = source.copy(); focus.setExpansion(new ValueSet.ValueSetExpansionComponent()); focus.getExpansion().setTimestampElement(DateTimeType.now()); focus.getExpansion().setIdentifier(Factory.createUUID()); if (!profile.getUrl().startsWith("urn:uuid:")) focus.getExpansion().addParameter().setName("profile").setValue(new UriType(profile.getUrl())); handleCompose(source.getCompose(), focus.getExpansion().getParameter(), profile); focus.getExpansion().getContains().add(c); focus.getExpansion().getContains().add(c); focus.getExpansion().setTotal(total);
throw new FHIRException(vse.getError()); CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); for (ValueSetExpansionContainsComponent t : vse.getValueset().getExpansion().getContains()) { if (t.hasCode()) b.append(t.getCode());
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case -1618432855: // identifier this.identifier = castToUri(value); // UriType return value; case 55126294: // timestamp this.timestamp = castToDateTime(value); // DateTimeType return value; case 110549828: // total this.total = castToInteger(value); // IntegerType return value; case -1019779949: // offset this.offset = castToInteger(value); // IntegerType return value; case 1954460585: // parameter this.getParameter().add((ValueSetExpansionParameterComponent) value); // ValueSetExpansionParameterComponent return value; case -567445985: // contains this.getContains().add((ValueSetExpansionContainsComponent) value); // ValueSetExpansionContainsComponent return value; default: return super.setProperty(hash, name, value); } }
@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 ValueSet importValueSet(String value, List<ValueSetExpansionParameterComponent> params, ExpansionProfile profile) throws ETooCostly, TerminologyServiceException, FileNotFoundException, IOException, FHIRFormatError { if (value == null) throw new TerminologyServiceException("unable to find value set with no identity"); ValueSet vs = context.fetchResource(ValueSet.class, value); if (vs == null) throw new TerminologyServiceException("Unable to find imported value set " + value); ValueSetExpansionOutcome vso = factory.getExpander().expand(vs, profile); if (vso.getError() != null) throw new TerminologyServiceException("Unable to expand imported value set: " + vso.getError()); if (vso.getService() != null) throw new TerminologyServiceException("Unable to expand imported value set " + value); if (vs.hasVersion()) if (!existsInParams(params, "version", new UriType(vs.getUrl() + "|" + vs.getVersion()))) params.add(new ValueSetExpansionParameterComponent().setName("version").setValue(new UriType(vs.getUrl() + "|" + vs.getVersion()))); for (ValueSetExpansionParameterComponent p : vso.getValueset().getExpansion().getParameter()) { if (!existsInParams(params, p.getName(), p.getValue())) params.add(p); } canBeHeirarchy = false; // if we're importing a value set, we have to be combining, so we won't try for a heirarchy return vso.getValueset(); }
@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; }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("identifier")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.identifier"); } else if (name.equals("timestamp")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.timestamp"); } else if (name.equals("total")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.total"); } else if (name.equals("offset")) { throw new FHIRException("Cannot call addChild on a primitive type ValueSet.offset"); } else if (name.equals("parameter")) { return addParameter(); } else if (name.equals("contains")) { return addContains(); } else return super.addChild(name); }
public ValueSetExpansionComponent copy() { ValueSetExpansionComponent dst = new ValueSetExpansionComponent(); copyValues(dst); dst.identifier = identifier == null ? null : identifier.copy(); dst.timestamp = timestamp == null ? null : timestamp.copy(); dst.total = total == null ? null : total.copy(); dst.offset = offset == null ? null : offset.copy(); if (parameter != null) { dst.parameter = new ArrayList<ValueSetExpansionParameterComponent>(); for (ValueSetExpansionParameterComponent i : parameter) dst.parameter.add(i.copy()); }; if (contains != null) { dst.contains = new ArrayList<ValueSetExpansionContainsComponent>(); for (ValueSetExpansionContainsComponent i : contains) dst.contains.add(i.copy()); }; return dst; }
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 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 static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.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.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) tgt.addParameter(convertValueSetExpansionParameterComponent(t)); for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) tgt.addContains(convertValueSetExpansionContainsComponent(t)); return tgt; }
public boolean hasExpansion() { return this.expansion != null && !this.expansion.isEmpty(); }