Skip to content

Commit

Permalink
Rename DeviceSyncService (#8450)
Browse files Browse the repository at this point in the history
* Rename DeviceSyncService

* Address code smell
  • Loading branch information
emyl3 authored Jan 29, 2025
1 parent 494a51d commit 78e008a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.fasterxml.jackson.annotation.JsonView;
import gov.cdc.usds.simplereport.api.model.errors.DryRunException;
import gov.cdc.usds.simplereport.db.model.DeviceType;
import gov.cdc.usds.simplereport.service.DeviceTypeLIVDSyncService;
import gov.cdc.usds.simplereport.service.DeviceTypeProdSyncService;
import gov.cdc.usds.simplereport.service.DeviceTypeService;
import gov.cdc.usds.simplereport.service.DeviceTypeSyncService;
import jakarta.servlet.http.HttpServletRequest;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -20,14 +20,14 @@
@RestController
@Slf4j
public class DeviceTypeController {
@Autowired private DeviceTypeSyncService deviceTypeSyncService;
@Autowired private DeviceTypeLIVDSyncService deviceTypeLIVDSyncService;
@Autowired private DeviceTypeProdSyncService deviceTypeProdSyncService;
@Autowired private DeviceTypeService deviceTypeService;

@GetMapping("/devices/sync")
public void syncDevices(@RequestParam boolean dryRun) {
try {
deviceTypeSyncService.syncDevices(dryRun);
deviceTypeLIVDSyncService.syncDevices(dryRun);
} catch (DryRunException e) {
log.info("Dry run");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@RequiredArgsConstructor
@Slf4j
@Transactional(readOnly = true)
public class DeviceTypeSyncService {
public class DeviceTypeLIVDSyncService {
private static final Set<String> FluA_DEVICE_SYNC_BLOCK_LIST =
Set.of(
"BioCode CoV-2 Flu Plus Assay|Applied BioCode, Inc.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.springframework.test.context.TestPropertySource;

@TestPropertySource(properties = {"spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true"})
class DeviceTypeServiceIntegrationTest extends BaseServiceTest<DeviceTypeSyncService> {
class DeviceTypeLIVDSyncServiceIntegrationTest extends BaseServiceTest<DeviceTypeLIVDSyncService> {
@Autowired private DeviceTypeService deviceTypeService;
@Autowired private DeviceTypeRepository deviceTypeRepo;
@Autowired private SpecimenTypeRepository specimenTypeRepository;
Expand All @@ -52,11 +52,11 @@ class DeviceTypeServiceIntegrationTest extends BaseServiceTest<DeviceTypeSyncSer
private SpecimenType swab3;
private DeviceType devA;
private DeviceType devB;
private final String SPECIMEN_DESCRIPTION_ONE =
private final String specimenDescriptionOne =
"anterior nasal swabs (697989009^Anterior nares swab^SCT)\r";
private final String SPECIMEN_DESCRIPTION_TWO =
private final String specimenDescriptionTwo =
"nasopharyngeal swabs (258500001^Nasopharyngeal swab^SCT)\r";
private final String SPECIMEN_DESCRIPTION_THREE = "to be added (999999999^To Be Added^SCT)\r";
private final String specimenDescriptionThree = "to be added (999999999^To Be Added^SCT)\r";

@BeforeEach
void setup() {
Expand Down Expand Up @@ -120,7 +120,7 @@ void syncDevices_updatesDevices() {
LIVDResponse.builder()
.manufacturer("Manufacturer A")
.model("Model A")
.vendorSpecimenDescription(List.of(SPECIMEN_DESCRIPTION_ONE))
.vendorSpecimenDescription(List.of(specimenDescriptionOne))
.vendorAnalyteName("influenza A RNA Result")
.testPerformedLoincCode("7777777")
.testPerformedLoincLongName("7777777 plus some extra stuff")
Expand Down Expand Up @@ -161,7 +161,7 @@ void syncDevices_createsDevices(String vendorAnalyteName, String expectedDisease
LIVDResponse.builder()
.manufacturer("New Device Manufacturer")
.model("New Device Model")
.vendorSpecimenDescription(List.of(SPECIMEN_DESCRIPTION_ONE))
.vendorSpecimenDescription(List.of(specimenDescriptionOne))
.vendorAnalyteName(vendorAnalyteName)
.testPerformedLoincCode("8888888")
.testPerformedLoincLongName("8888888 plus some extra stuff")
Expand Down Expand Up @@ -205,7 +205,7 @@ void syncDevices_updatesSpecimenTypes() {
LIVDResponse.builder()
.manufacturer(devA.getManufacturer())
.model(devA.getModel())
.vendorSpecimenDescription(List.of(SPECIMEN_DESCRIPTION_ONE, SPECIMEN_DESCRIPTION_TWO))
.vendorSpecimenDescription(List.of(specimenDescriptionOne, specimenDescriptionTwo))
.vendorAnalyteName("influenza A RNA Result")
.testPerformedLoincCode("0123456")
.testPerformedLoincLongName("0123456 plus some extra stuff")
Expand All @@ -220,8 +220,7 @@ void syncDevices_updatesSpecimenTypes() {
LIVDResponse.builder()
.manufacturer(devB.getManufacturer())
.model(devB.getModel())
.vendorSpecimenDescription(
List.of(SPECIMEN_DESCRIPTION_ONE, SPECIMEN_DESCRIPTION_THREE))
.vendorSpecimenDescription(List.of(specimenDescriptionOne, specimenDescriptionThree))
.vendorAnalyteName("influenza A RNA Result")
.testPerformedLoincCode("0123456")
.testPerformedLoincLongName("0123456 plus some extra stuff")
Expand Down Expand Up @@ -274,7 +273,7 @@ void syncDevices_updatesAssociatedDeviceTypeDiseaseFields() {
LIVDResponse.builder()
.manufacturer("Manufacturer A")
.model("Model A")
.vendorSpecimenDescription(List.of(SPECIMEN_DESCRIPTION_ONE))
.vendorSpecimenDescription(List.of(specimenDescriptionOne))
.vendorAnalyteName("influenza A RNA Result")
.testPerformedLoincCode("7777777")
.testPerformedLoincLongName("7777777 plus some extra stuff")
Expand Down Expand Up @@ -312,7 +311,7 @@ void syncDevices_skipsNullUpdates() {
LIVDResponse.builder()
.manufacturer(existingDevice.getManufacturer())
.model(existingDevice.getModel())
.vendorSpecimenDescription(List.of(SPECIMEN_DESCRIPTION_ONE))
.vendorSpecimenDescription(List.of(specimenDescriptionOne))
.vendorAnalyteName("covid")
.testPerformedLoincCode("000000000")
.testPerformedLoincLongName("000000000 plus some extra stuff")
Expand Down Expand Up @@ -340,7 +339,7 @@ void syncDevices_skipsInvalidDiseases() {
LIVDResponse.builder()
.manufacturer("Some manufacturer")
.model("Some model")
.vendorSpecimenDescription(List.of(SPECIMEN_DESCRIPTION_ONE))
.vendorSpecimenDescription(List.of(specimenDescriptionOne))
.vendorAnalyteName("invalid disease!")
.testPerformedLoincCode("000000000")
.testPerformedLoincLongName("000000000 plus some extra stuff")
Expand Down Expand Up @@ -368,7 +367,7 @@ void syncDevices_avoidsDuplicateDeviceNames() {
LIVDResponse.builder()
.manufacturer("Shiny New Manufacturer")
.model("Device A")
.vendorSpecimenDescription(List.of(SPECIMEN_DESCRIPTION_ONE))
.vendorSpecimenDescription(List.of(specimenDescriptionOne))
.vendorAnalyteName("fluA")
.testPerformedLoincCode("000000000")
.testPerformedLoincLongName("000000000 plus some extra stuff")
Expand All @@ -395,7 +394,7 @@ void syncDevices_skipsConfiguredDevices() {
LIVDResponse.builder()
.manufacturer("Applied BioCode, Inc.")
.model("BioCode CoV-2 Flu Plus Assay")
.vendorSpecimenDescription(List.of(SPECIMEN_DESCRIPTION_ONE))
.vendorSpecimenDescription(List.of(specimenDescriptionOne))
.vendorAnalyteName("fluA")
.testPerformedLoincCode("000000000")
.testPerformedLoincLongName("000000000 plus some extra stuff")
Expand Down

0 comments on commit 78e008a

Please sign in to comment.