@Override public ValueSet expand(ValueSet source, String theFilter) { ValueSet retVal = new ValueSet(); retVal.setDate(DateTimeDt.withCurrentTime()); /* * Add composed concepts */ for (ComposeInclude nextInclude : source.getCompose().getInclude()) { for (ComposeIncludeConcept next : nextInclude.getConcept()) { if (isBlank(theFilter)) { addCompose(retVal, nextInclude.getSystem(), next.getCode(), next.getDisplay()); } else { String filter = theFilter.toLowerCase(); if (next.getDisplay().toLowerCase().contains(filter) || next.getCode().toLowerCase().contains(filter)) { addCompose(retVal, nextInclude.getSystem(), next.getCode(), next.getDisplay()); } } } } /* * Add defined concepts */ for (CodeSystemConcept next : source.getCodeSystem().getConcept()) { addCompose(theFilter, retVal, source, next); } return retVal; }
private Observation initializeObservation( Patient p, DeviceMetric metric, GlucoseRecord r, QuantityDt qdt) { log("Initializing observation"); Observation o = newObservation(qdt); o.setCode(createCode(r.unit)); o.setSubject(newResourceReference(p.getId())); o.setDevice(newResourceReference(metric.getId())); // set date and time for observation DateTimeDt dt = new DateTimeDt(); dt.setValue(r.time.getTime()); o.setEffective(dt); o.setIdentifier( Arrays.asList( getIdentifier( "/devices/".concat("" + deviceInfo.getSysID()), "" + r.getSequenceNumber()))); // set narrative o.setText(getNarrative(o)); log("Initializing observation done"); return o; }