Java Code Examples for org.hl7.fhir.dstu3.model.ValueSet#getUrl()

The following examples show how to use org.hl7.fhir.dstu3.model.ValueSet#getUrl() . 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: BaseWorkerContext.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public ValueSetExpansionOutcome expandOnServer(ValueSet vs, String fn) throws Exception {
  if (noTerminologyServer) {
    return new ValueSetExpansionOutcome(
      "Error expanding ValueSet: running without terminology services",
      TerminologyServiceErrorClass.NOSERVICE);
  }
  if (expProfile == null) {
    throw new Exception("No ExpansionProfile provided");
  }

  try {
    Map<String, String> params = new HashMap<String, String>();
    params.put("_limit", Integer.toString(expandCodesLimit));
    params.put("_incomplete", "true");
    tlog("Terminology Server: $expand on " + getVSSummary(vs));
    ValueSet result = txServer.expandValueset(vs, expProfile.setIncludeDefinition(false), params);
    return new ValueSetExpansionOutcome(result);
  } catch (Exception e) {
    return new ValueSetExpansionOutcome(
      "Error expanding ValueSet \"" + vs.getUrl() + ": " + e.getMessage(),
      TerminologyServiceErrorClass.UNKNOWN);
  }
}
 
Example 2
Source File: BaseWorkerContext.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
private ValidationResult verifyCodeInExpansion(ValueSet vs, String system, String code,
  String display) {
  ValueSetExpansionContainsComponent cc = findCode(vs.getExpansion().getContains(), code);
  if (cc == null) {
    return new ValidationResult(IssueSeverity.ERROR,
      "Unknown Code " + code + " in " + vs.getUrl());
  }
  if (display == null) {
    return new ValidationResult(
      new ConceptDefinitionComponent().setCode(code).setDisplay(cc.getDisplay()));
  }
  if (cc.hasDisplay()) {
    if (display.equalsIgnoreCase(cc.getDisplay())) {
      return new ValidationResult(
        new ConceptDefinitionComponent().setCode(code).setDisplay(cc.getDisplay()));
    }
    return new ValidationResult(IssueSeverity.WARNING,
      "Display Name for " + code + " must be '" + cc.getDisplay() + "'",
      new ConceptDefinitionComponent().setCode(code).setDisplay(cc.getDisplay()));
  }
  return null;
}
 
Example 3
Source File: ValueSetUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void checkShareable(ValueSet vs) {
  if (!vs.hasMeta())
    throw new Error("ValueSet "+vs.getUrl()+" is not shareable");
  for (UriType t : vs.getMeta().getProfile()) {
    if (t.getValue().equals("http://hl7.org/fhir/StructureDefinition/shareablevalueset"))
      return;
  }
  throw new Error("ValueSet "+vs.getUrl()+" is not shareable");    
}
 
Example 4
Source File: BaseWorkerContext.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public void seeValueSet(String url, ValueSet vs) throws Exception {
  if (valueSets.containsKey(vs.getUrl()) && !allowLoadingDuplicates) {
    throw new Exception("Duplicate value set " + vs.getUrl());
  }
  valueSets.put(vs.getId(), vs);
  valueSets.put(url, vs);
  valueSets.put(vs.getUrl(), vs);
}
 
Example 5
Source File: BaseWorkerContext.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private ValidationResult verifyCodeInExpansion(ValueSet vs, String code) throws FHIRException {
  if (vs.getExpansion()
    .hasExtension("http://hl7.org/fhir/StructureDefinition/valueset-toocostly")) {
    throw new FHIRException("Unable to validate core - value set is too costly to expand");
  } else {
    ValueSetExpansionContainsComponent cc = findCode(vs.getExpansion().getContains(), code);
    if (cc == null) {
      return new ValidationResult(IssueSeverity.ERROR,
        "Unknown Code " + code + " in " + vs.getUrl());
    }
    return null;
  }
}
 
Example 6
Source File: SimpleWorkerContext.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public void seeValueSet(String url, ValueSet vs) throws DefinitionException {
  if (Utilities.noString(url))
    url = vs.getUrl();
	if (valueSets.containsKey(vs.getUrl()) && !allowLoadingDuplicates)
		throw new DefinitionException("Duplicate Profile " + vs.getUrl());
	valueSets.put(vs.getId(), vs);
	valueSets.put(vs.getUrl(), vs);
	if (!vs.getUrl().equals(url))
		valueSets.put(url, vs);
}
 
Example 7
Source File: ValueSetExpansionCache.java    From org.hl7.fhir.core with Apache License 2.0 4 votes vote down vote up
private String makeCacheKey(ValueSet source, ExpansionProfile profile) {
  return profile == null ? source.getUrl() : source.getUrl() + " " + profile.getUrl()+" "+profile.getExcludeNested(); 
}