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);
}
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));
}
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);
}
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);
}
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());
}
Aggregations