private void addCodes(ValueSetExpansionComponent expand, List<ValueSetExpansionParameterComponent> params, Parameters expParams, List<ValueSet> filters) throws ETooCostly, FHIRException { if (expand != null) { 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, expParams, filters); } }
private boolean existsInParams(List<ValueSetExpansionParameterComponent> params, String name, Type value) { for (ValueSetExpansionParameterComponent p : params) { if (p.getName().equals(name) && PrimitiveType.compareDeep(p.getValue(), value, false)) return true; } return false; }
private void doServerIncludeCodes(ConceptSetComponent inc, boolean heirarchical, List<ValueSetExpansionParameterComponent> params, List<ValueSet> imports, Parameters expParams) throws FHIRException { ValueSetExpansionOutcome vso = context.expandVS(inc, heirarchical); if (vso.getError() != null) throw new TerminologyServiceException("Unable to expand imported value set: " + vso.getError()); ValueSet vs = vso.getValueset(); 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); } for (ValueSetExpansionContainsComponent cc : vs.getExpansion().getContains()) { addCodeAndDescendents(cc, null, expParams, imports); } }
private ValueSet importValueSet(String value, List<ValueSetExpansionParameterComponent> params, Parameters expParams) 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 = new ValueSetExpanderSimple(context).expand(vs, expParams); if (vso.getError() != null) throw new TerminologyServiceException("Unable to expand imported value set: " + vso.getError()); 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(); }
private void doServerIncludeCodes(ConceptSetComponent inc, boolean heirarchical, List<ValueSetExpansionParameterComponent> params, List<ValueSet> imports, Parameters expParams) throws FHIRException { ValueSetExpansionOutcome vso = context.expandVS(inc, heirarchical); if (vso.getError() != null) throw new TerminologyServiceException("Unable to expand imported value set: " + vso.getError()); ValueSet vs = vso.getValueset(); 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); } for (ValueSetExpansionContainsComponent cc : vs.getExpansion().getContains()) { addCodeAndDescendents(cc, null, expParams, imports); } }
public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); copyElement(src, tgt); tgt.setName(src.getName()); tgt.setValue(convertType(src.getValue())); return tgt; }
private void addCodes(ValueSetExpansionComponent expand, List<ValueSetExpansionParameterComponent> params, Parameters expParams, List<ValueSet> filters) throws ETooCostly, FHIRException { if (expand != null) { 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, expParams, filters); } }
public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent(); copyElement(src, tgt); tgt.setName(src.getName()); tgt.setValue(convertType(src.getValue())); return tgt; }
private boolean existsInParams(List<ValueSetExpansionParameterComponent> params, String name, Type value) { for (ValueSetExpansionParameterComponent p : params) { if (p.getName().equals(name) && PrimitiveType.compareDeep(p.getValue(), value, false)) return true; } return false; }
private ValueSet importValueSet(String value, List<ValueSetExpansionParameterComponent> params, Parameters expParams) 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 = new ValueSetExpanderSimple(context).expand(vs, expParams); if (vso.getError() != null) throw new TerminologyServiceException("Unable to expand imported value set: " + vso.getError()); 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(); }
public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent(); copyElement(src, tgt); tgt.setName(src.getName()); tgt.setValue(convertType(src.getValue())); return tgt; }
public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); copyElement(src, tgt); tgt.setName(src.getName()); tgt.setValue(convertType(src.getValue())); return tgt; }