5222 storage cr hapifhirretrieveprovider terminology paging bug (#5224)

* update query iterable to page results, update config for batching

* add test for large valueset issue

---------

Co-authored-by: justin.mckelvy <justin.mckelvy@smilecdr.com>
This commit is contained in:
Justin McKelvy 2023-08-22 16:05:05 -06:00 committed by GitHub
parent 943a052a0b
commit bbcc6148ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13298 additions and 2 deletions

View File

@ -101,11 +101,12 @@ public class HapiFhirRetrieveProvider extends SearchParamFhirRetrieveProvider im
@Override
public boolean hasNext() {
// initial load of first query results
if (currentResult == null && index < queries.size()) {
if (currentResult == null) {
currentResult = loadNext();
}
// loop through all batches of results
// when query results exhaust load next query
else if (!currentResult.hasNext()) {
while (currentResult != null && !currentResult.hasNext()) {
currentResult = loadNext();
}
// hasNext on current query result

View File

@ -111,6 +111,7 @@ public abstract class BaseClinicalReasoningConfig {
provider.setTerminologyProvider(t);
provider.setExpandValueSets(true);
provider.setMaxCodesPerQuery(500);
provider.setQueryBatchThreshold(500);
provider.setModelResolver(theModelResolver);
}
return new CompositeDataProvider(theModelResolver, provider);

View File

@ -147,5 +147,23 @@ class R4MeasureOperationProviderIT extends BaseCrR4TestServer
}
@Test
void testLargeValuesetMeasure() {
this.loadBundle("largeValueSetMeasureTest-Bundle.json");
var returnMeasureReport = runEvaluateMeasure("2023-01-01", "2024-01-01", null, "CMSTest", "population", null);
String populationName = "numerator";
int expectedCount = 1;
Optional<MeasureReport.MeasureReportGroupPopulationComponent> population = returnMeasureReport.getGroup().get(0)
.getPopulation().stream().filter(x -> x.hasCode() && x.getCode().hasCoding()
&& x.getCode().getCoding().get(0).getCode().equals(populationName))
.findFirst();
assertEquals(population.get().getCount(), expectedCount,
String.format("expected count for population \"%s\" did not match", populationName));
}
}

File diff suppressed because one or more lines are too long