Skip to content

Commit

Permalink
add equipment uid type to livd sync (#6727)
Browse files Browse the repository at this point in the history
* add equipment uid type to builder objects

* update tests and types

* remove type from graphql objects

* lint

* add the gql types back in
  • Loading branch information
fzhao99 authored Oct 18, 2023
1 parent bd829b4 commit e3d085e
Show file tree
Hide file tree
Showing 14 changed files with 209 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class SupportedDiseaseTestPerformedInput {
UUID supportedDisease;
String testPerformedLoincCode;
String equipmentUid;
String equipmentUidType;
String testkitNameId;
String testOrderedLoincCode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class DeviceTypeDisease extends IdentifiedEntity {

@Column private String testPerformedLoincCode;
@Column private String equipmentUid;
@Column private String equipmentUidType;
@Column private String testkitNameId;
@Column private String testOrderedLoincCode;

Expand All @@ -45,6 +46,7 @@ public boolean equals(Object o) {
&& Objects.equals(testPerformedLoincCode, that.testPerformedLoincCode)
&& Objects.equals(testOrderedLoincCode, that.testOrderedLoincCode)
&& Objects.equals(equipmentUid, that.equipmentUid)
&& Objects.equals(equipmentUidType, that.equipmentUidType)
&& Objects.equals(testkitNameId, that.testkitNameId);
}

Expand All @@ -56,6 +58,7 @@ public int hashCode() {
testPerformedLoincCode,
testOrderedLoincCode,
equipmentUid,
equipmentUidType,
testkitNameId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import gov.cdc.usds.simplereport.db.model.DeviceTypeSpecimenTypeMapping;
import gov.cdc.usds.simplereport.db.model.SpecimenType;
import gov.cdc.usds.simplereport.db.repository.DeviceSpecimenTypeNewRepository;
import gov.cdc.usds.simplereport.db.repository.DeviceTypeDiseaseRepository;
import gov.cdc.usds.simplereport.db.repository.DeviceTypeRepository;
import gov.cdc.usds.simplereport.db.repository.SpecimenTypeRepository;
import gov.cdc.usds.simplereport.db.repository.SupportedDiseaseRepository;
Expand Down Expand Up @@ -41,6 +42,7 @@ public class DeviceTypeService {
private final DeviceSpecimenTypeNewRepository deviceSpecimenTypeNewRepository;
private final SpecimenTypeRepository specimenTypeRepository;
private final SupportedDiseaseRepository supportedDiseaseRepository;
private final DeviceTypeDiseaseRepository deviceTypeDiseaseRepository;

@Transactional
@AuthorizationConfiguration.RequireGlobalAdminUser
Expand Down Expand Up @@ -119,7 +121,7 @@ public DeviceType updateDeviceType(UpdateDeviceType updateDevice) {
}

if (updateDevice.getSupportedDiseaseTestPerformed() != null) {
var deviceTypeDiseaseList =
List<DeviceTypeDisease> deviceTypeDiseaseList =
createDeviceTypeDiseaseList(updateDevice.getSupportedDiseaseTestPerformed(), device);
device.getSupportedDiseaseTestPerformed().clear();
device.getSupportedDiseaseTestPerformed().addAll(deviceTypeDiseaseList);
Expand Down Expand Up @@ -190,6 +192,7 @@ public List<DeviceTypeDisease> createDeviceTypeDiseaseList(
.testPerformedLoincCode(input.getTestPerformedLoincCode())
.testOrderedLoincCode(input.getTestOrderedLoincCode())
.equipmentUid(input.getEquipmentUid())
.equipmentUidType(input.getEquipmentUidType())
.testkitNameId(input.getTestkitNameId())
.testOrderedLoincCode(input.getTestOrderedLoincCode())
.build()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ public void syncDevices(boolean dryRun) {
.testPerformedLoincCode(device.getTestPerformedLoincCode())
.testOrderedLoincCode(device.getTestOrderedLoincCode())
.equipmentUid(device.getEquipmentUid())
.equipmentUidType(device.getEquipmentUidType())
.testkitNameId(device.getTestKitNameId())
.build());
});
Expand Down Expand Up @@ -309,6 +310,7 @@ private DeviceType createDevice(
.testOrderedLoincCode(device.getTestOrderedLoincCode())
.testkitNameId(device.getTestKitNameId())
.equipmentUid(device.getEquipmentUid())
.equipmentUidType(device.getEquipmentUidType())
.build()))
.build();
log.info("Device created {}", createdDeviceType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ public class LIVDResponse {
private String testOrderedLoincCode;
private String testKitNameId;
private String equipmentUid;
private String equipmentUidType;
}
34 changes: 17 additions & 17 deletions backend/src/main/resources/graphql/main.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ type Facility {
isDeleted: Boolean
}

type FacilityStats{
usersSingleAccessCount:Int
type FacilityStats {
usersSingleAccessCount: Int
patientsSingleAccessCount: Int
}

Expand Down Expand Up @@ -80,6 +80,7 @@ input SupportedDiseaseTestPerformedInput {
supportedDisease: ID!
testPerformedLoincCode: String!
equipmentUid: String
equipmentUidType: String
testkitNameId: String
testOrderedLoincCode: String
}
Expand All @@ -98,6 +99,7 @@ type SupportedDiseaseTestPerformed {
supportedDisease: SupportedDisease!
testPerformedLoincCode: String!
equipmentUid: String
equipmentUidType: String
testkitNameId: String
testOrderedLoincCode: String
}
Expand Down Expand Up @@ -243,7 +245,7 @@ type Patient
preferredLanguage: String
@requiredPermissions(anyOf: ["READ_PATIENT_LIST", "UPDATE_TEST"])
notes: String
@requiredPermissions(anyOf: ["READ_PATIENT_LIST", "UPDATE_TEST"])
@requiredPermissions(anyOf: ["READ_PATIENT_LIST", "UPDATE_TEST"])
}

# TestResult and TestOrder should have the same properties
Expand Down Expand Up @@ -372,7 +374,7 @@ type UploadSubmissionPage {
content: [UploadResult!]!
}

type FeatureFlag{
type FeatureFlag {
name: String!
value: Boolean!
}
Expand Down Expand Up @@ -479,7 +481,8 @@ type Query {
users: [ApiUser] @requiredPermissions(allOf: ["MANAGE_USERS"])
usersWithStatus: [ApiUserWithStatus!]
@requiredPermissions(allOf: ["MANAGE_USERS"])
user(id: ID, email: String): User @requiredPermissions(allOf: ["MANAGE_USERS"])
user(id: ID, email: String): User
@requiredPermissions(allOf: ["MANAGE_USERS"])
whoami: User!
uploadSubmission(id: ID!): UploadResponse!
@requiredPermissions(allOf: ["UPLOAD_RESULTS_SPREADSHEET"])
Expand All @@ -493,15 +496,12 @@ type Query {
}

type Mutation {
updateFacility(
facilityInfo: UpdateFacilityInput!
): Facility @requiredPermissions(allOf: ["EDIT_FACILITY"])
addFacility(
facilityInfo: AddFacilityInput!
): Facility @requiredPermissions(allOf: ["EDIT_FACILITY"])
addUserToCurrentOrg(
userInput: UserInput!
): User @requiredPermissions(allOf: ["MANAGE_USERS"])
updateFacility(facilityInfo: UpdateFacilityInput!): Facility
@requiredPermissions(allOf: ["EDIT_FACILITY"])
addFacility(facilityInfo: AddFacilityInput!): Facility
@requiredPermissions(allOf: ["EDIT_FACILITY"])
addUserToCurrentOrg(userInput: UserInput!): User
@requiredPermissions(allOf: ["MANAGE_USERS"])
updateUser(
id: ID!
name: NameInput
Expand All @@ -525,7 +525,8 @@ type Mutation {
reactivateUser(id: ID!): User @requiredPermissions(allOf: ["MANAGE_USERS"])
resendActivationEmail(id: ID!): User
@requiredPermissions(allOf: ["MANAGE_USERS"])
reactivateUserAndResetPassword(id: ID!): User @requiredPermissions(allOf: ["MANAGE_USERS"])
reactivateUserAndResetPassword(id: ID!): User
@requiredPermissions(allOf: ["MANAGE_USERS"])
setCurrentUserTenantDataAccess(
organizationExternalId: String
justification: String
Expand Down Expand Up @@ -602,8 +603,7 @@ type Mutation {
id: ID!
deleted: Boolean!
orgExternalId: String
): Patient
@requiredPermissions(allOf: ["ARCHIVE_PATIENT"])
): Patient @requiredPermissions(allOf: ["ARCHIVE_PATIENT"])
submitQueueItem(
deviceTypeId: ID!
specimenTypeId: ID!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,10 +840,22 @@ void convertToObservation_Result_matchesJson() throws IOException {
var device = DeviceType.builder().build();
var covidDiseaseTestPerformedCode =
new DeviceTypeDisease(
null, covidDisease, "94500-6", "covidEquipmentUID", "covidTestkitNameId", "94500-0");
null,
covidDisease,
"94500-6",
"covidEquipmentUID",
"covidEquipmentUIDType",
"covidTestkitNameId",
"94500-0");
var fluDiseaseTestPerformedCode =
new DeviceTypeDisease(
null, fluDisease, "85477-8", "fluEquipmentUID", "fluTestkitNameId", "85477-0");
null,
fluDisease,
"85477-8",
"fluEquipmentUID",
"fluEquipmentUidType",
"fluTestkitNameId",
"85477-0");
ReflectionTestUtils.setField(
device,
"supportedDiseaseTestPerformed",
Expand Down Expand Up @@ -898,7 +910,13 @@ void convertToObservation_Result_correctionMatchesJson() throws IOException {
var device = DeviceType.builder().build();
var covidDiseaseTestPerformedCode =
new DeviceTypeDisease(
null, covidDisease, "94500-6", "covidEquipmentUID", "covidTestkitNameId", "94500-0");
null,
covidDisease,
"94500-6",
"covidEquipmentUID",
"covidEquipmentUIDType",
"covidTestkitNameId",
"94500-0");

ReflectionTestUtils.setField(result, "internalId", UUID.fromString(id));
ReflectionTestUtils.setField(
Expand Down Expand Up @@ -1641,14 +1659,27 @@ void createFhirBundle_TestEvent_matchesJson() throws IOException {
var testPerformedCodesList =
List.of(
new DeviceTypeDisease(
deviceTypeId, covidDisease, "333-123", "equipmentUID1", "testkitNameId1", null),
deviceTypeId,
covidDisease,
"333-123",
"equipmentUID1",
"equipmentUIDType1",
"testkitNameId1",
null),
new DeviceTypeDisease(
deviceTypeId, fluADisease, "444-123", "equipmentUID2", "testkitNameId2", "95422-2"),
deviceTypeId,
fluADisease,
"444-123",
"equipmentUID2",
"equipmentUIDType2",
"testkitNameId2",
"95422-2"),
new DeviceTypeDisease(
deviceTypeId,
fluBDisease,
"444-456",
"equipmentUID3",
"equipmentUIDType3",
"testkitNameId3",
"95422-2"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void getSupportedDiseases_happyPath() {
UUID supportedDisease2Id = UUID.randomUUID();
String testPerformedLoinc = "test123PerformedLoinc";
String equipmentUid = "testEquipmentUid";
String equipmentUidType = "testEquipmentUidType";
String testkitNameId = "testkitNameId";
String testOrderedLoinc = "test123OrderedLoinc";

Expand All @@ -67,20 +68,23 @@ void getSupportedDiseases_happyPath() {
supportedDisease1,
testPerformedLoinc,
equipmentUid,
equipmentUidType,
testkitNameId,
testOrderedLoinc),
new DeviceTypeDisease(
device2Id,
supportedDisease1,
testPerformedLoinc,
equipmentUid,
equipmentUidType,
testkitNameId,
testOrderedLoinc),
new DeviceTypeDisease(
device2Id,
supportedDisease2,
testPerformedLoinc,
equipmentUid,
equipmentUidType,
testkitNameId,
testOrderedLoinc)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ private Map<String, Object> getCreateDeviceTypeInput() {
.supportedDisease(supportedDiseaseIds.get(0))
.testPerformedLoincCode("loinc1")
.equipmentUid("equipmentUid1")
.equipmentUidType("equipmentUid1Type")
.testkitNameId("testkitNameId1")
.testOrderedLoincCode("loinc3")
.build()))
Expand Down Expand Up @@ -155,6 +156,7 @@ private Map<String, Object> getUpdateDeviceTypeInput(UUID internalId) {
.supportedDisease(supportedDiseaseIds.get(0))
.testPerformedLoincCode("loinc1")
.equipmentUid("equipmentUid1")
.equipmentUidType("equipmentUidType1")
.testkitNameId("testkitNameId1")
.testOrderedLoincCode("loinc3")
.build()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,15 @@ void sendPatientInfoWithCommonDeviceDiseaseInfo() {
dataFactory.getCovidDisease(),
"94500-6",
"covidEquipmentUID",
"covidEquipmentUIDType",
"covidTestkitNameId1",
"94500-0"),
new DeviceTypeDisease(
deviceType1.getInternalId(),
dataFactory.getCovidDisease(),
"94500-6",
"covidEquipmentUID",
"covidEquipmentUIDType",
"covidTestkitNameId2",
"94500-0")));
dataFactory.addDiseasesToDevice(
Expand All @@ -290,13 +292,15 @@ void sendPatientInfoWithCommonDeviceDiseaseInfo() {
dataFactory.getCovidDisease(),
"94500-6",
"covidEquipmentUID1",
"covidEquipmentUIDType",
"covidTestkitNameId",
"94500-0"),
new DeviceTypeDisease(
deviceType2.getInternalId(),
dataFactory.getCovidDisease(),
"94500-6",
"covidEquipmentUID2",
"covidEquipmentUIDType",
"covidTestkitNameId",
"94500-0")));

Expand Down
Loading

0 comments on commit e3d085e

Please sign in to comment.