Rename class, test, and variables. Fix tests. Create a general CR Spring config class to be used by both DSTU3 and R4.
This commit is contained in:
parent
991f3f6cee
commit
9ce0bfe9e0
|
@ -0,0 +1,35 @@
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR - Clinical Reasoning
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package ca.uhn.fhir.cr.config;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.cr.r4.measure.MeasureReportPeriodRequestValidatorAndConverter;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class CrBaseConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
MeasureReportPeriodRequestValidatorAndConverter measureReportPeriodService() {
|
||||||
|
return new MeasureReportPeriodRequestValidatorAndConverter(ZoneOffset.UTC);
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ package ca.uhn.fhir.cr.config.dstu3;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||||
|
import ca.uhn.fhir.cr.config.CrBaseConfig;
|
||||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||||
import ca.uhn.fhir.cr.config.RepositoryConfig;
|
import ca.uhn.fhir.cr.config.RepositoryConfig;
|
||||||
|
@ -39,7 +40,7 @@ import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Import({RepositoryConfig.class})
|
@Import({RepositoryConfig.class, CrBaseConfig.class})
|
||||||
public class CrDstu3Config {
|
public class CrDstu3Config {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -23,6 +23,7 @@ import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
import ca.uhn.fhir.cr.common.IRepositoryFactory;
|
||||||
import ca.uhn.fhir.cr.common.RepositoryFactoryForRepositoryInterface;
|
import ca.uhn.fhir.cr.common.RepositoryFactoryForRepositoryInterface;
|
||||||
|
import ca.uhn.fhir.cr.config.CrBaseConfig;
|
||||||
import ca.uhn.fhir.cr.config.ProviderLoader;
|
import ca.uhn.fhir.cr.config.ProviderLoader;
|
||||||
import ca.uhn.fhir.cr.config.ProviderSelector;
|
import ca.uhn.fhir.cr.config.ProviderSelector;
|
||||||
import ca.uhn.fhir.cr.config.RepositoryConfig;
|
import ca.uhn.fhir.cr.config.RepositoryConfig;
|
||||||
|
@ -39,7 +40,7 @@ import ca.uhn.fhir.cr.r4.measure.CareGapsOperationProvider;
|
||||||
import ca.uhn.fhir.cr.r4.measure.CollectDataOperationProvider;
|
import ca.uhn.fhir.cr.r4.measure.CollectDataOperationProvider;
|
||||||
import ca.uhn.fhir.cr.r4.measure.DataRequirementsOperationProvider;
|
import ca.uhn.fhir.cr.r4.measure.DataRequirementsOperationProvider;
|
||||||
import ca.uhn.fhir.cr.r4.measure.MeasureOperationsProvider;
|
import ca.uhn.fhir.cr.r4.measure.MeasureOperationsProvider;
|
||||||
import ca.uhn.fhir.cr.r4.measure.MeasureReportPeriodRequestProcessingService;
|
import ca.uhn.fhir.cr.r4.measure.MeasureReportPeriodRequestValidatorAndConverter;
|
||||||
import ca.uhn.fhir.cr.r4.measure.SubmitDataProvider;
|
import ca.uhn.fhir.cr.r4.measure.SubmitDataProvider;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
import org.opencds.cqf.fhir.cql.EvaluationSettings;
|
||||||
|
@ -58,13 +59,12 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
import java.time.ZoneOffset;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Import({RepositoryConfig.class})
|
@Import({RepositoryConfig.class, CrBaseConfig.class})
|
||||||
public class CrR4Config {
|
public class CrR4Config {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -149,9 +149,9 @@ public class CrR4Config {
|
||||||
@Bean
|
@Bean
|
||||||
MeasureOperationsProvider r4MeasureOperationsProvider(
|
MeasureOperationsProvider r4MeasureOperationsProvider(
|
||||||
IMeasureServiceFactory theR4MeasureServiceFactory,
|
IMeasureServiceFactory theR4MeasureServiceFactory,
|
||||||
MeasureReportPeriodRequestProcessingService theMeasureReportPeriodRequestProcessingService) {
|
MeasureReportPeriodRequestValidatorAndConverter theMeasureReportPeriodRequestValidatorAndConverter) {
|
||||||
return new MeasureOperationsProvider(
|
return new MeasureOperationsProvider(
|
||||||
theR4MeasureServiceFactory, theMeasureReportPeriodRequestProcessingService);
|
theR4MeasureServiceFactory, theMeasureReportPeriodRequestValidatorAndConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -173,9 +173,4 @@ public class CrR4Config {
|
||||||
|
|
||||||
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
|
return new ProviderLoader(theRestfulServer, theApplicationContext, selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
MeasureReportPeriodRequestProcessingService measureReportPeriodService() {
|
|
||||||
return new MeasureReportPeriodRequestProcessingService(ZoneOffset.UTC);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,13 +37,13 @@ import org.opencds.cqf.fhir.utility.monad.Eithers;
|
||||||
|
|
||||||
public class MeasureOperationsProvider {
|
public class MeasureOperationsProvider {
|
||||||
private final IMeasureServiceFactory myR4MeasureServiceFactory;
|
private final IMeasureServiceFactory myR4MeasureServiceFactory;
|
||||||
private final MeasureReportPeriodRequestProcessingService myMeasureReportPeriodRequestProcessingService;
|
private final MeasureReportPeriodRequestValidatorAndConverter myMeasureReportPeriodRequestProcessingService;
|
||||||
|
|
||||||
public MeasureOperationsProvider(
|
public MeasureOperationsProvider(
|
||||||
IMeasureServiceFactory theR4MeasureServiceFactory,
|
IMeasureServiceFactory theR4MeasureServiceFactory,
|
||||||
MeasureReportPeriodRequestProcessingService theMeasureReportPeriodRequestProcessingService) {
|
MeasureReportPeriodRequestValidatorAndConverter theMeasureReportPeriodRequestValidatorAndConverter) {
|
||||||
myR4MeasureServiceFactory = theR4MeasureServiceFactory;
|
myR4MeasureServiceFactory = theR4MeasureServiceFactory;
|
||||||
myMeasureReportPeriodRequestProcessingService = theMeasureReportPeriodRequestProcessingService;
|
myMeasureReportPeriodRequestProcessingService = theMeasureReportPeriodRequestValidatorAndConverter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,8 +53,8 @@ import java.util.function.Function;
|
||||||
* <li>yyyy-MM-ddTHH:mm:ss</li>
|
* <li>yyyy-MM-ddTHH:mm:ss</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*/
|
*/
|
||||||
public class MeasureReportPeriodRequestProcessingService {
|
public class MeasureReportPeriodRequestValidatorAndConverter {
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(MeasureReportPeriodRequestProcessingService.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(MeasureReportPeriodRequestValidatorAndConverter.class);
|
||||||
|
|
||||||
private static final DateTimeFormatter DATE_TIME_FORMATTER_YYYY_INPUT = DateTimeFormatter.ofPattern("yyyy");
|
private static final DateTimeFormatter DATE_TIME_FORMATTER_YYYY_INPUT = DateTimeFormatter.ofPattern("yyyy");
|
||||||
private static final DateTimeFormatter DATE_TIME_FORMATTER_YYYY_MM_INPUT = DateTimeFormatter.ofPattern("yyyy-MM");
|
private static final DateTimeFormatter DATE_TIME_FORMATTER_YYYY_MM_INPUT = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||||
|
@ -74,7 +74,7 @@ public class MeasureReportPeriodRequestProcessingService {
|
||||||
|
|
||||||
private final ZoneId myFallbackTimezone;
|
private final ZoneId myFallbackTimezone;
|
||||||
|
|
||||||
public MeasureReportPeriodRequestProcessingService(ZoneId theFallbackTimezone) {
|
public MeasureReportPeriodRequestValidatorAndConverter(ZoneId theFallbackTimezone) {
|
||||||
myFallbackTimezone = theFallbackTimezone;
|
myFallbackTimezone = theFallbackTimezone;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package ca.uhn.fhir.cr.r4;
|
package ca.uhn.fhir.cr.r4;
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
|
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
|
||||||
|
import jakarta.annotation.Nullable;
|
||||||
import org.hl7.fhir.r4.model.DateType;
|
import org.hl7.fhir.r4.model.DateType;
|
||||||
import org.hl7.fhir.r4.model.IdType;
|
import org.hl7.fhir.r4.model.IdType;
|
||||||
import org.hl7.fhir.r4.model.MeasureReport;
|
import org.hl7.fhir.r4.model.MeasureReport;
|
||||||
|
@ -12,6 +13,8 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||||
|
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@ -69,17 +72,17 @@ class MeasureOperationProviderTest extends BaseCrR4TestServer {
|
||||||
void testHedis2022() {
|
void testHedis2022() {
|
||||||
|
|
||||||
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-5", 0, 0, 0, 0, false,
|
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-5", 0, 0, 0, 0, false,
|
||||||
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.999]");
|
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.000]");
|
||||||
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-7", 1, 1, 0, 0, true,
|
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-7", 1, 1, 0, 0, true,
|
||||||
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.999]");
|
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.000]");
|
||||||
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-9", 0, 0, 0, 0, true,
|
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-9", 0, 0, 0, 0, true,
|
||||||
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.999]");
|
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.000]");
|
||||||
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-21", 1, 0, 1, 0, true,
|
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-21", 1, 0, 1, 0, true,
|
||||||
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.999]");
|
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.000]");
|
||||||
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-23", 1, 1, 0, 0, true,
|
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-23", 1, 1, 0, 0, true,
|
||||||
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.999]");
|
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.000]");
|
||||||
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-65", 1, 1, 0, 1, true,
|
runWithPatient("BCSEHEDISMY2022", "Patient/Patient-65", 1, 1, 0, 1, true,
|
||||||
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.999]");
|
"Interval[2020-10-01T00:00:00.000, 2022-12-31T23:59:59.000]");
|
||||||
}
|
}
|
||||||
|
|
||||||
void testClientNonPatientBasedMeasureEvaluate() {
|
void testClientNonPatientBasedMeasureEvaluate() {
|
||||||
|
|
|
@ -17,11 +17,10 @@ import java.util.stream.Stream;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
|
|
||||||
class MeasureReportPeriodRequestProcessingServiceTest {
|
class MeasureReportPeriodRequestValidatorAndConverterTest {
|
||||||
|
|
||||||
private final MeasureReportPeriodRequestProcessingService myTestSubject = new MeasureReportPeriodRequestProcessingService(ZoneOffset.UTC);
|
private final MeasureReportPeriodRequestValidatorAndConverter myTestSubject = new MeasureReportPeriodRequestValidatorAndConverter(ZoneOffset.UTC);
|
||||||
|
|
||||||
// LUKETODO: what happens if only one is null?
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@CsvSource( nullValues = {"null"},
|
@CsvSource( nullValues = {"null"},
|
||||||
value={
|
value={
|
Loading…
Reference in New Issue