Java Code Examples for org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent#getValueSet()

The following examples show how to use org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent#getValueSet() . 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 6 votes vote down vote up
private void includeCodes(ConceptSetComponent inc, List<ValueSetExpansionParameterComponent> params, Parameters expParams, boolean heirarchical) throws ETooCostly, FileNotFoundException, IOException, FHIRException {
  inc.checkNoModifiers("Compose.include", "expanding");
  List<ValueSet> imports = new ArrayList<ValueSet>();
  for (UriType imp : inc.getValueSet()) {
    imports.add(importValueSet(imp.getValue(), params, expParams));
  }

  if (!inc.hasSystem()) {
    if (imports.isEmpty()) // though this is not supposed to be the case
      return;
    ValueSet base = imports.get(0);
    imports.remove(0);
    base.checkNoModifiers("Imported ValueSet", "expanding");
    copyImportContains(base.getExpansion().getContains(), null, expParams, imports);
  } else {
    CodeSystem cs = context.fetchCodeSystem(inc.getSystem());
    if ((cs == null || cs.getContent() != CodeSystemContentMode.COMPLETE)) {
      doServerIncludeCodes(inc, heirarchical, params, imports, expParams);
    } else {
      doInternalIncludeCodes(inc, params, expParams, imports, cs);
    }
  }
}
 
Example 2
Source File: TerminologyCache.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
private String getIncSummary(ConceptSetComponent cc) {
  CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
  for (UriType vs : cc.getValueSet())
    b.append(vs.asStringValue());
  String vsd = b.length() > 0 ? " where the codes are in the value sets ("+b.toString()+")" : "";
  String system = cc.getSystem();
  if (cc.hasConcept())
    return Integer.toString(cc.getConcept().size())+" codes from "+system+vsd;
  if (cc.hasFilter()) {
    String s = "";
    for (ConceptSetFilterComponent f : cc.getFilter()) {
      if (!Utilities.noString(s))
        s = s + " & ";
      s = s + f.getProperty()+" "+f.getOp().toCode()+" "+f.getValue();
    }
    return "from "+system+" where "+s+vsd;
  }
  return "All codes from "+system+vsd;
}