@Override
  public ValueSet expandByIdentifier(String theUri, String theFilter) {
    if (isBlank(theUri)) {
      throw new InvalidRequestException("URI must not be blank or missing");
    }

    ValueSet source = new ValueSet();

    source.getCompose().addImport(theUri);

    if (isNotBlank(theFilter)) {
      ConceptSetComponent include = source.getCompose().addInclude();
      ConceptSetFilterComponent filter = include.addFilter();
      filter.setProperty("display");
      filter.setOp(FilterOperator.EQUAL);
      filter.setValue(theFilter);
    }

    ValueSet retVal = doExpand(source);
    return retVal;

    // if (defaultValueSet != null) {
    // source = getContext().newJsonParser().parseResource(ValueSet.class,
    // getContext().newJsonParser().encodeResourceToString(defaultValueSet));
    // } else {
    // IBundleProvider ids = search(ValueSet.SP_URL, new UriParam(theUri));
    // if (ids.size() == 0) {
    // throw new InvalidRequestException("Unknown ValueSet URI: " + theUri);
    // }
    // source = (ValueSet) ids.getResources(0, 1).get(0);
    // }
    //
    // return expand(defaultValueSet, theFilter);

  }
Exemplo n.º 2
0
 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;
 }