Example #1
0
 @Override
 public ValueSetExpansionComponent expandVS(ConceptSetComponent inc, boolean heirachical)
     throws TerminologyServiceException {
   ValueSet vs = new ValueSet();
   vs.setCompose(new ValueSetComposeComponent());
   vs.getCompose().getInclude().add(inc);
   ValueSetExpansionOutcome vse = expandVS(vs, true, heirachical);
   ValueSet valueset = vse.getValueset();
   if (valueset == null)
     throw new TerminologyServiceException("Error Expanding ValueSet: " + vse.getError());
   return valueset.getExpansion();
 }
Example #2
0
 private String determineCacheId(ValueSet vs, boolean heirarchical) throws Exception {
   // just the content logical definition is hashed
   ValueSet vsid = new ValueSet();
   vsid.setCompose(vs.getCompose());
   JsonParser parser = new JsonParser();
   parser.setOutputStyle(OutputStyle.NORMAL);
   ByteArrayOutputStream b = new ByteArrayOutputStream();
   parser.compose(b, vsid);
   b.close();
   String s = new String(b.toByteArray(), Charsets.UTF_8);
   // any code systems we can find, we add these too.
   for (ConceptSetComponent inc : vs.getCompose().getInclude()) {
     CodeSystem cs = fetchCodeSystem(inc.getSystem());
     if (cs != null) {
       String css = cacheValue(cs);
       s = s + css;
     }
   }
   s = s + "-" + Boolean.toString(heirarchical);
   String r = Integer.toString(s.hashCode());
   //    TextFile.stringToFile(s, Utilities.path(cache, r+".id.json"));
   return r;
 }