use of au.csiro.pathling.terminology.TerminologyService in project pathling by aehrc.
the class SubsumptionMapperWithPreview method preview.
@Override
@Nonnull
public Relation preview(@Nonnull final Iterator<ImmutablePair<List<SimpleCoding>, List<SimpleCoding>>> input) {
// Add the request ID to the logging context, so that we can track the logging for this
// request across all workers.
MDC.put("requestId", requestId);
// Collect all distinct tokens used on both in inputs and arguments in this partition
// Rows in which either input or argument are NULL are excluded as they do not need
// to be included in closure request.
// Also, we only include codings with both system and code defined as only they can
// be expected to be meaningfully represented to the terminology server
final Set<SimpleCoding> codings = Streams.streamOf(input).filter(r -> r.getLeft() != null && r.getRight() != null).flatMap(r -> concat(r.getLeft().stream(), r.getRight().stream())).filter(Objects::nonNull).collect(Collectors.toSet());
final TerminologyService terminologyService = terminologyServiceFactory.buildService(log);
return terminologyService.getSubsumesRelation(codings);
}
use of au.csiro.pathling.terminology.TerminologyService in project pathling by aehrc.
the class TranslateMapperWithPreview method preview.
@Override
@Nonnull
public ConceptTranslator preview(@Nonnull final Iterator<List<SimpleCoding>> input) {
if (!input.hasNext() || equivalences.isEmpty()) {
return new ConceptTranslator();
}
// Add the request ID to the logging context, so that we can track the logging for this
// request across all workers.
MDC.put("requestId", requestId);
final Set<SimpleCoding> uniqueCodings = Streams.streamOf(input).filter(Objects::nonNull).flatMap(List::stream).collect(Collectors.toSet());
final TerminologyService terminologyService = terminologyServiceFactory.buildService(log);
return terminologyService.translate(uniqueCodings, conceptMapUrl, reverse, equivalences);
}
use of au.csiro.pathling.terminology.TerminologyService in project pathling by aehrc.
the class MemberOfMapperWithPreview method preview.
@Override
@Nonnull
public Set<SimpleCoding> preview(@Nonnull final Iterator<List<SimpleCoding>> input) {
MDC.put("requestId", requestId);
final Set<SimpleCoding> codings = Streams.streamOf(input).filter(Objects::nonNull).flatMap(List::stream).collect(Collectors.toSet());
final TerminologyService terminologyService = terminologyServiceFactory.buildService(log);
return terminologyService.intersect(valueSetUri, codings);
}
Aggregations