Java Code Examples for org.hl7.fhir.dstu3.model.ValueSet#ConceptSetComponent

The following examples show how to use org.hl7.fhir.dstu3.model.ValueSet#ConceptSetComponent . 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: CodeSystemUpdateProvider.java    From cqf-ruler with Apache License 2.0 6 votes vote down vote up
/***
 * Perform union of codes within a ValueSet and CodeSystem
 *
 * @param valueSetCodes The codes contained within a ValueSet
 * @param codeSystem A CodeSystem resource
 * @return List of distinct codes strings
 */
private List<String> getUnionDistinctCodes(ValueSet.ConceptSetComponent valueSetCodes, CodeSystem codeSystem)
{
    if (!codeSystem.hasConcept())
    {
        return valueSetCodes.getConcept().stream().map(ValueSet.ConceptReferenceComponent::getCode).collect(Collectors.toList());
    }
    return Stream.concat(
            valueSetCodes.getConcept().stream().map(
                    ValueSet.ConceptReferenceComponent::getCode).collect(Collectors.toList()
            ).stream(),
            codeSystem.getConcept().stream().map(
                    CodeSystem.ConceptDefinitionComponent::getCode).collect(Collectors.toList()
            ).stream()
    )
            .distinct()
            .collect(Collectors.toList());
}
 
Example 2
Source File: CodeSystemUpdateProvider.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
public OperationOutcome performCodeSystemUpdate(ValueSet vs)
{
    OperationOutcomeBuilder responseBuilder = new OperationOutcomeBuilder();

    List<String> codeSystems = new ArrayList<>();
    if (vs.hasCompose() && vs.getCompose().hasInclude())
    {
        CodeSystem codeSystem;
        for (ValueSet.ConceptSetComponent csc : vs.getCompose().getInclude())
        {
            if (!csc.hasSystem()) continue;

            codeSystem = getCodeSystemByUrl(csc.getSystem());

            if (!csc.hasConcept()) continue;

            updateCodeSystem(
                    codeSystem.setUrl(csc.getSystem()),
                    getUnionDistinctCodes(csc, codeSystem)
            );

            codeSystems.add(codeSystem.getUrl());
        }
    }

    return responseBuilder.buildIssue(
            "information",
            "informational",
            "Successfully updated the following CodeSystems: " + String.join(", ", codeSystems)
    ).build();
}
 
Example 3
Source File: ValueSetComposeBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public ValueSetComposeBuilder buildIncludes(List<ValueSet.ConceptSetComponent> includes) {
    complexProperty.setInclude(includes);
    return this;
}
 
Example 4
Source File: ValueSetComposeBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public ValueSetComposeBuilder buildIncludes(ValueSet.ConceptSetComponent include) {
    complexProperty.addInclude(include);
    return this;
}
 
Example 5
Source File: ValueSetIncludesBuilder.java    From cqf-ruler with Apache License 2.0 4 votes vote down vote up
public ValueSetIncludesBuilder(ValueSet.ConceptSetComponent complexProperty) {
    super(complexProperty);
}
 
Example 6
Source File: CareConnectProfileDbValidationSupportSTU3.java    From careconnect-reference-implementation with Apache License 2.0 3 votes vote down vote up
@Override
  public ValueSet.ValueSetExpansionComponent expandValueSet(FhirContext fhirContext, ValueSet.ConceptSetComponent conceptSetComponent) {
      logW("CareConnect expandValueSet System="+conceptSetComponent.getSystem());



      // todo
       return null;
}