use of org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method expandVS.
@Override
public ValueSetExpansionComponent expandVS(ConceptSetComponent inc) {
ValueSet vs = new ValueSet();
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().getInclude().add(inc);
ValueSetExpansionOutcome vse = expandVS(vs, true);
return vse.getValueset().getExpansion();
}
use of org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSet method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("url"))
// UriType
this.url = castToUri(value);
else if (name.equals("identifier"))
// Identifier
this.identifier = castToIdentifier(value);
else if (name.equals("version"))
// StringType
this.version = castToString(value);
else if (name.equals("name"))
// StringType
this.name = castToString(value);
else if (name.equals("status"))
// Enumeration<ConformanceResourceStatus>
this.status = new ConformanceResourceStatusEnumFactory().fromType(value);
else if (name.equals("experimental"))
// BooleanType
this.experimental = castToBoolean(value);
else if (name.equals("publisher"))
// StringType
this.publisher = castToString(value);
else if (name.equals("contact"))
this.getContact().add((ValueSetContactComponent) value);
else if (name.equals("date"))
// DateTimeType
this.date = castToDateTime(value);
else if (name.equals("lockedDate"))
// DateType
this.lockedDate = castToDate(value);
else if (name.equals("description"))
// StringType
this.description = castToString(value);
else if (name.equals("useContext"))
this.getUseContext().add(castToCodeableConcept(value));
else if (name.equals("immutable"))
// BooleanType
this.immutable = castToBoolean(value);
else if (name.equals("requirements"))
// StringType
this.requirements = castToString(value);
else if (name.equals("copyright"))
// StringType
this.copyright = castToString(value);
else if (name.equals("extensible"))
// BooleanType
this.extensible = castToBoolean(value);
else if (name.equals("compose"))
// ValueSetComposeComponent
this.compose = (ValueSetComposeComponent) value;
else if (name.equals("expansion"))
// ValueSetExpansionComponent
this.expansion = (ValueSetExpansionComponent) value;
else
super.setProperty(name, value);
}
use of org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method expandVS.
@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();
}
use of org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method expandVS.
@Override
public ValueSetExpansionOutcome expandVS(ConceptSetComponent inc, boolean hierarchical) throws TerminologyServiceException {
ValueSet vs = new ValueSet();
vs.setStatus(PublicationStatus.ACTIVE);
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().getInclude().add(inc);
CacheToken cacheToken = txCache.generateExpandToken(vs, hierarchical);
ValueSetExpansionOutcome res;
res = txCache.getExpansion(cacheToken);
if (res != null) {
return res;
}
Parameters p = expParameters.copy();
p.setParameter("includeDefinition", false);
p.setParameter("excludeNested", !hierarchical);
boolean cached = addDependentResources(p, vs);
if (cached) {
p.addParameter().setName("cache-id").setValue(new StringType(cacheId));
}
for (ConceptSetComponent incl : vs.getCompose().getInclude()) {
codeSystemsUsed.add(incl.getSystem());
}
for (ConceptSetComponent incl : vs.getCompose().getExclude()) {
codeSystemsUsed.add(incl.getSystem());
}
if (noTerminologyServer) {
return new ValueSetExpansionOutcome(formatMessage(I18nConstants.ERROR_EXPANDING_VALUESET_RUNNING_WITHOUT_TERMINOLOGY_SERVICES), TerminologyServiceErrorClass.NOSERVICE);
}
Map<String, String> params = new HashMap<String, String>();
params.put("_limit", Integer.toString(expandCodesLimit));
params.put("_incomplete", "true");
tlog("$expand on " + txCache.summary(vs));
try {
ValueSet result = txClient.expandValueset(vs, p, params);
res = new ValueSetExpansionOutcome(result).setTxLink(txLog.getLastId());
} catch (Exception e) {
res = new ValueSetExpansionOutcome(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), TerminologyServiceErrorClass.UNKNOWN);
if (txLog != null) {
res.setTxLink(txLog.getLastId());
}
}
txCache.cacheExpansion(cacheToken, res, TerminologyCache.PERMANENT);
return res;
}
use of org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpanderSimple method handleCompose.
private void handleCompose(ValueSetComposeComponent compose, ValueSetExpansionComponent exp, Parameters expParams, String ctxt, List<Extension> extensions, ValueSet valueSet) throws ETooCostly, FileNotFoundException, IOException, FHIRException {
compose.checkNoModifiers("ValueSet.compose", "expanding");
// Exclude comes first because we build up a map of things to exclude
for (ConceptSetComponent inc : compose.getExclude()) excludeCodes(inc, exp.getParameter(), ctxt);
canBeHeirarchy = !expParams.getParameterBool("excludeNested") && excludeKeys.isEmpty() && excludeSystems.isEmpty();
includeAbstract = !expParams.getParameterBool("excludeNotForUI");
boolean first = true;
for (ConceptSetComponent inc : compose.getInclude()) {
if (first == true)
first = false;
else
canBeHeirarchy = false;
includeCodes(inc, exp, expParams, canBeHeirarchy, compose.hasInactive() && !compose.getInactive(), extensions, valueSet);
}
}
Aggregations