-
Notifications
You must be signed in to change notification settings - Fork 12
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
Changes from 1 commit
6e932cc
dd5d198
f15c26a
ab1172c
6f98645
3149a6c
c7dbd34
82d0bd4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,7 +6,9 @@ | |||||
|
||||||
import java.time.ZonedDateTime; | ||||||
import java.time.format.DateTimeFormatter; | ||||||
import java.util.Collections; | ||||||
import java.util.HashMap; | ||||||
import java.util.List; | ||||||
import java.util.Map; | ||||||
|
||||||
import static io.gatling.javaapi.core.CoreDsl.StringBody; | ||||||
|
@@ -162,37 +164,63 @@ public HttpRequestActionBuilder searchPatient(String searchQuery) { | |||||
"&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 GetDrugAllergens(String drugAllergenUuid) { | ||||||
return http("Get Drug Allergens") | ||||||
.get("/openmrs/ws/rest/v1/concept/" + drugAllergenUuid + "?v=full"); | ||||||
} | ||||||
|
||||||
public HttpRequestActionBuilder GetEnvironmentAllergens(String environmentalAllergenUuid) { | ||||||
return http("Get Environment Allergens") | ||||||
.get("/openmrs/ws/rest/v1/concept/" + environmentalAllergenUuid + "?v=full"); | ||||||
} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since it's the same API call, how about we make it a single call and use the passed parameter? ex:
|
||||||
|
||||||
public HttpRequestActionBuilder GetFoodAllergens(String foodAllergenUuid) { | ||||||
return http("Get Food Allergens") | ||||||
.get("/openmrs/ws/rest/v1/concept/" + foodAllergenUuid + "?v=full"); | ||||||
} | ||||||
|
||||||
public HttpRequestActionBuilder GetAllergicReactions(String allergyReactionUuid) { | ||||||
return http("Get Allergic Reactions") | ||||||
.get("/openmrs/ws/rest/v1/concept/" + allergyReactionUuid + "?v=full"); | ||||||
} | ||||||
|
||||||
public HttpRequestActionBuilder saveAllergies(String patientUuid) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
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" + | ||||||
"}"; | ||||||
Map<String, Object> payload = new HashMap<>(); | ||||||
|
||||||
Map<String,String> codedAllergen = new HashMap<>(); | ||||||
codedAllergen.put("uuid", "71617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's make the UUID a constant and move it to the Constants.java file. That way it’ll be super clear what this UUID is for and we can easily reuse it in other parts of the code. |
||||||
|
||||||
Map<String,Object>allergen = new HashMap<>(); | ||||||
allergen.put("allergenType", "DRUG"); | ||||||
allergen.put("codedAllergen", codedAllergen); | ||||||
|
||||||
Map<String,String>severity = new HashMap<>(); | ||||||
severity.put("uuid", "1498AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); | ||||||
|
||||||
Map<String, String> reactionUuid = new HashMap<>(); | ||||||
reactionUuid.put("uuid", "121677AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); | ||||||
|
||||||
Map<String, Object> reaction = new HashMap<>(); | ||||||
reaction.put("reaction", reactionUuid); | ||||||
List<Map<String, Object>> reactions = Collections.singletonList(reaction); | ||||||
|
||||||
payload.put("allergen", allergen); | ||||||
payload.put("severity", severity); | ||||||
payload.put("comment", "test"); | ||||||
payload.put("reactions", reactions); | ||||||
|
||||||
|
||||||
return http("Save Allergies of Patient") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
.get("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
.body(StringBody(payload)); | ||||||
.body(StringBody(payload.toString())); | ||||||
|
||||||
|
||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,10 +95,22 @@ public ChainBuilder openAllergiesTab(String patientUuid) { | |
return exec(httpService.getAllergies(patientUuid)); | ||
} | ||
|
||
public ChainBuilder addAllergies(String patientUuid) { | ||
public ChainBuilder OpenAllergiesForm(){ | ||
String drugAllergenUuid = "162555AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | ||
String environmentalAllergenUuid = "162552AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | ||
String foodAllergenUuid = "162554AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | ||
String allergyReactionUuid = "162553AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let’s add this to the constants.java file too. |
||
|
||
return exec( | ||
httpService.GetDrugAllergens(drugAllergenUuid), | ||
httpService.GetEnvironmentAllergens(environmentalAllergenUuid), | ||
httpService.GetFoodAllergens(foodAllergenUuid), | ||
httpService.GetAllergicReactions(allergyReactionUuid) | ||
); | ||
} | ||
|
||
public ChainBuilder addAllergies(String patientUuid) { | ||
return exec( | ||
httpService.searchPatient("test location test"), | ||
httpService.getAllergies(patientUuid), | ||
httpService.saveAllergies(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.OpenAllergiesForm()) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
.exec(registry.addAllergies("#{patient_uuid}")) | ||||||
jayasanka-sack marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
.exec(registry.openConditionsTab("#{patient_uuid}")) | ||||||
.exec(registry.openImmunizationsTab("#{patient_uuid}")) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method names should be named in lower camel case (starts with a lowercase).