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

O3-4357: Add Allergy Recording to Patient Visit Scenario #54

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Next Next commit
O3-4357:Add Allergy Recording to Patient Visit Scenario
  • Loading branch information
Bawanthathilan committed Jan 21, 2025
commit 6e932ccba3f1c0c63f6a96d1931d969595793a9d
43 changes: 43 additions & 0 deletions src/test/java/org/openmrs/performance/http/DoctorHttpService.java
Original file line number Diff line number Diff line change
@@ -60,6 +60,8 @@ public HttpRequestActionBuilder getActiveVisitOfPatient(String patientUuid) {
return http("Get Active Visits of Patient")
.get("/openmrs/ws/rest/v1/visit?patient=" + patientUuid + "&v=" + customRepresentation + "&includeInactive=false");
}



public HttpRequestActionBuilder getProgramEnrollments(String patientUuid) {
String customRepresentation = "custom:(uuid,display,program,dateEnrolled,dateCompleted," +
@@ -148,11 +150,52 @@ public HttpRequestActionBuilder getDrugOrders(String patientUuid) {
"&status=any&orderType=" + DRUG_ORDER +
"&v=" + customRepresentation);
}

public HttpRequestActionBuilder searchPatient(String searchQuery) {
Copy link
Member

Choose a reason for hiding this comment

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

Unused method

String customRepresentation = """
custom:(patientId,uuid,identifiers,display,patientIdentifier:(uuid,identifier),person:(gender,age,birthdate,birthdateEstimated,personName,addresses,display,dead,deathDate),attributes:(value,attributeType:(uuid,display)))
""";
return http("Get Orders")
.get("/openmrs/ws/rest/v1/patient" +
"?q=" + searchQuery +
"&v=" + customRepresentation +
"&includeDead=" + true +
"&limit=" + 10);
}


public HttpRequestActionBuilder getAllergies(String patientUuid) {
return http("Get Allergies of Patient")
.get("/openmrs/ws/fhir2/R4/AllergyIntolerance?patient=" + patientUuid + "&_summary=data");
}

public HttpRequestActionBuilder saveAllergies(String patientUuid) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public HttpRequestActionBuilder saveAllergies(String patientUuid) {
public HttpRequestActionBuilder saveAllergy(String patientUuid) {

String payload = "{\n" +
" \"allergen\": {\n" +
" \"allergenType\": \"DRUG\",\n" +
" \"codedAllergen\": {\n" +
" \"uuid\": \"71617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\n" +
" }\n" +
" },\n" +
" \"severity\": {\n" +
" \"uuid\": \"1498AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\n" +
" },\n" +
" \"comment\": \"test\",\n" +
" \"reactions\": [\n" +
" {\n" +
" \"reaction\": {\n" +
" \"uuid\": \"121677AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\n" +
" }\n" +
" }\n" +
" ]\n" +
"}";

return http("Save Allergies of Patient")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return http("Save Allergies of Patient")
return http("Save an Allergy")

.get("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.get("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")
.post("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")

.body(StringBody(payload));


}

public HttpRequestActionBuilder getConditions(String patientUuid) {
return http("Get Conditions of Patient")
Original file line number Diff line number Diff line change
@@ -94,6 +94,14 @@ public ChainBuilder openLabResultsTab(String patientUuid) {
public ChainBuilder openAllergiesTab(String patientUuid) {
return exec(httpService.getAllergies(patientUuid));
}

public ChainBuilder addAllergies(String patientUuid) {
return exec(
httpService.searchPatient("test location test"),
httpService.getAllergies(patientUuid),
httpService.saveAllergies(patientUuid)
);
}

public ChainBuilder openConditionsTab(String patientUuid) {
return exec(httpService.getConditions(patientUuid));
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ public ScenarioBuilder getScenarioBuilder() {
.exec(registry.openOrdersTab("#{patient_uuid}"))
.exec(registry.openLabResultsTab("#{patient_uuid}"))
.exec(registry.openAllergiesTab("#{patient_uuid}"))
.exec(registry.addAllergies("#{patient_uuid}"))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.exec(registry.addAllergies("#{patient_uuid}"))
.exec(registry.recordAllergy("#{patient_uuid}"))

.exec(registry.openConditionsTab("#{patient_uuid}"))
.exec(registry.openImmunizationsTab("#{patient_uuid}"))
.exec(registry.openAttachmentsTab("#{patient_uuid}"))