Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add equipment uid type to livd sync #6727

Merged
merged 5 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
32 changes: 15 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
}

Copy link
Contributor Author

@fzhao99 fzhao99 Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linter caught some whitespace changes here. should be a no-op outside the changes to the SupportedDisease objects

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

Expand Down Expand Up @@ -243,7 +243,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 +372,7 @@ type UploadSubmissionPage {
content: [UploadResult!]!
}

type FeatureFlag{
type FeatureFlag {
name: String!
value: Boolean!
}
Expand Down Expand Up @@ -479,7 +479,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 +494,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 +523,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 +601,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 @@ -852,10 +852,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 @@ -910,7 +922,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 @@ -1653,14 +1671,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