Search in sources :

Example 1 with UriParam

use of ca.uhn.fhir.rest.param.UriParam in project cqf-ruler by DBCG.

the class Searches method byUrls.

// TODO: versioned version
public static SearchParameterMap byUrls(List<String> theUrls) {
    checkNotNull(theUrls);
    UriOrListParam params = new UriOrListParam();
    theUrls.forEach(theUrl -> {
        checkNotNull(theUrl);
        params.addOr(new UriParam(theUrl));
    });
    return sync().add(ID_SP, params);
}
Also used : UriOrListParam(ca.uhn.fhir.rest.param.UriOrListParam) UriParam(ca.uhn.fhir.rest.param.UriParam)

Example 2 with UriParam

use of ca.uhn.fhir.rest.param.UriParam in project cqf-ruler by DBCG.

the class Searches method byUrl.

public static SearchParameterMap byUrl(String theUrl, String theVersion) {
    checkNotNull(theUrl);
    checkNotNull(theVersion);
    return byParam(URL_SP, new UriParam(theUrl)).add(VERSION_SP, new StringParam(theVersion));
}
Also used : StringParam(ca.uhn.fhir.rest.param.StringParam) UriParam(ca.uhn.fhir.rest.param.UriParam)

Example 3 with UriParam

use of ca.uhn.fhir.rest.param.UriParam in project pathling by aehrc.

the class DefaultTerminologyServiceTest method testIntersectFiltersIllegalAndUnknownCodings.

@SuppressWarnings("ConstantConditions")
@Test
void testIntersectFiltersIllegalAndUnknownCodings() {
    final ValueSet responseExpansion = new ValueSet();
    responseExpansion.getExpansion().getContains().addAll(Arrays.asList(fromSimpleCoding(CODING1_VERSION1), fromSimpleCoding(CODING2_VERSION1)));
    when(terminologyClient.expand(any(), any())).thenReturn(responseExpansion);
    // setup SYSTEM1 as known system
    when(terminologyClient.searchCodeSystems(refEq(new UriParam(SYSTEM1)), any())).thenReturn(Collections.singletonList(new CodeSystem()));
    final Set<SimpleCoding> actualExpansion = terminologyService.intersect("uuid:value-set", Arrays.asList(CODING1_VERSION1, CODING2_VERSION1, CODING3_VERSION1, new SimpleCoding(SYSTEM1, null), new SimpleCoding(null, "code1"), new SimpleCoding(null, null), null));
    final Set<SimpleCoding> expectedExpansion = ImmutableSet.of(CODING1_VERSION1, CODING2_VERSION1);
    assertEquals(expectedExpansion, actualExpansion);
    // verify behaviour
    verify(terminologyClient).searchCodeSystems(refEq(new UriParam(SYSTEM1)), any());
    verify(terminologyClient).searchCodeSystems(refEq(new UriParam(SYSTEM2)), any());
    final ValueSet requestValueSet = new ValueSet();
    final List<ConceptSetComponent> includes = requestValueSet.getCompose().getInclude();
    includes.add(new ConceptSetComponent().addValueSet("uuid:value-set").setSystem(SYSTEM1).setVersion("version1").addConcept(new ConceptReferenceComponent().setCode("code1")).addConcept(new ConceptReferenceComponent().setCode("code2")));
    verify(terminologyClient).expand(deepEq(requestValueSet), deepEq(new IntegerType(2)));
    verifyNoMoreInteractions(terminologyClient);
}
Also used : IntegerType(org.hl7.fhir.r4.model.IntegerType) ConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent) SimpleCoding(au.csiro.pathling.fhirpath.encoding.SimpleCoding) ValueSet(org.hl7.fhir.r4.model.ValueSet) UriParam(ca.uhn.fhir.rest.param.UriParam) CodeSystem(org.hl7.fhir.r4.model.CodeSystem) ConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with UriParam

use of ca.uhn.fhir.rest.param.UriParam in project pathling by aehrc.

the class DefaultTerminologyServiceTest method testSubsumesFiltersIllegalAndUnknownCodings.

@Test
@SuppressWarnings("ConstantConditions")
void testSubsumesFiltersIllegalAndUnknownCodings() {
    // CODING1 subsumes CODING2
    final ConceptMap responseMap = ConceptMapBuilder.empty().withSubsumes(CODING2_VERSION1.toCoding(), CODING1_VERSION1.toCoding()).build();
    when(terminologyClient.closure(any(), any())).thenReturn(responseMap);
    // setup SYSTEM1 as known system
    when(terminologyClient.searchCodeSystems(refEq(new UriParam(SYSTEM1)), any())).thenReturn(Collections.singletonList(new CodeSystem()));
    final Relation actualRelation = terminologyService.getSubsumesRelation(Arrays.asList(CODING1_VERSION1, CODING1_UNVERSIONED, CODING2_VERSION1, CODING3_VERSION1, new SimpleCoding(SYSTEM1, null), new SimpleCoding(null, "code1"), new SimpleCoding(null, null), null));
    final Relation expectedRelation = RelationBuilder.empty().add(CODING1_VERSION1.toCoding(), CODING2_VERSION1.toCoding()).build();
    assertEquals(expectedRelation, actualRelation);
    // verify behaviour
    verify(terminologyClient).searchCodeSystems(refEq(new UriParam(SYSTEM1)), any());
    verify(terminologyClient).searchCodeSystems(refEq(new UriParam(SYSTEM2)), any());
    verify(terminologyClient).initialiseClosure(deepEq(new StringType(TEST_UUID_AS_STRING)));
    verify(terminologyClient).closure(deepEq(new StringType(TEST_UUID_AS_STRING)), argThat(new CodingSetMatcher(Arrays.asList(CODING1_VERSION1, CODING1_UNVERSIONED, CODING2_VERSION1))));
    verifyNoMoreInteractions(terminologyClient);
}
Also used : SimpleCoding(au.csiro.pathling.fhirpath.encoding.SimpleCoding) StringType(org.hl7.fhir.r4.model.StringType) ConceptMap(org.hl7.fhir.r4.model.ConceptMap) UriParam(ca.uhn.fhir.rest.param.UriParam) CodeSystem(org.hl7.fhir.r4.model.CodeSystem) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 5 with UriParam

use of ca.uhn.fhir.rest.param.UriParam in project pathling by aehrc.

the class DefaultTerminologyService method isKnownSystem.

private boolean isKnownSystem(@Nonnull final String codeSystem) {
    final UriParam uri = new UriParam(codeSystem);
    final List<CodeSystem> knownSystems = terminologyClient.searchCodeSystems(uri, new HashSet<>(Collections.singletonList("id")));
    return !(knownSystems == null || knownSystems.isEmpty());
}
Also used : UriParam(ca.uhn.fhir.rest.param.UriParam)

Aggregations

UriParam (ca.uhn.fhir.rest.param.UriParam)5 SimpleCoding (au.csiro.pathling.fhirpath.encoding.SimpleCoding)2 CodeSystem (org.hl7.fhir.r4.model.CodeSystem)2 Test (org.junit.jupiter.api.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 StringParam (ca.uhn.fhir.rest.param.StringParam)1 UriOrListParam (ca.uhn.fhir.rest.param.UriOrListParam)1 ConceptMap (org.hl7.fhir.r4.model.ConceptMap)1 IntegerType (org.hl7.fhir.r4.model.IntegerType)1 StringType (org.hl7.fhir.r4.model.StringType)1 ValueSet (org.hl7.fhir.r4.model.ValueSet)1 ConceptReferenceComponent (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent)1 ConceptSetComponent (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent)1