-
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6e932cc
O3-4357:Add Allergy Recording to Patient Visit Scenario
Bawanthathilan dd5d198
O3-4357:break into two actions
Bawanthathilan f15c26a
O3-4357:add constants
Bawanthathilan ab1172c
O3-4357:add getAllergen function
Bawanthathilan 6f98645
O3-4357:fix save allergies endpoint
Bawanthathilan 3149a6c
O3-4357:fix some tab spacing issue
Bawanthathilan c7dbd34
O3-4357:fix some tab spacing issue
Bawanthathilan 82d0bd4
O3-4357:remove unwanted spacing
Bawanthathilan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -6,21 +6,26 @@ | |||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
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; | ||||||||||||||||||||||||||||||||||||
import static io.gatling.javaapi.core.CoreDsl.bodyString; | ||||||||||||||||||||||||||||||||||||
import static io.gatling.javaapi.core.CoreDsl.jsonPath; | ||||||||||||||||||||||||||||||||||||
import static io.gatling.javaapi.http.HttpDsl.http; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.ALLERGY_REACTION_UUID; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.CARE_SETTING_UUID; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.CODED_ALLERGEN_UUID; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.DAYS; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.DEFAULT_DOSING_TYPE; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.DRUG_ORDER; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.ONCE_DAILY; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.ORAL; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.ORDER; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.OUTPATIENT_CLINIC_LOCATION_UUID; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.SEVERITY_UUID; | ||||||||||||||||||||||||||||||||||||
import static org.openmrs.performance.Constants.TABLET; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public class DoctorHttpService extends HttpService { | ||||||||||||||||||||||||||||||||||||
|
@@ -60,6 +65,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," + | ||||||||||||||||||||||||||||||||||||
|
@@ -152,6 +159,49 @@ public HttpRequestActionBuilder getDrugOrders(String patientUuid) { | |||||||||||||||||||||||||||||||||||
public HttpRequestActionBuilder getAllergies(String patientUuid) { | ||||||||||||||||||||||||||||||||||||
return http("Get Allergies of Patient") | ||||||||||||||||||||||||||||||||||||
.get("/openmrs/ws/fhir2/R4/AllergyIntolerance?patient=" + patientUuid + "&_summary=data"); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public HttpRequestActionBuilder getAllergen(String allergenType, String allergenUuid) { | ||||||||||||||||||||||||||||||||||||
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
|
||||||||||||||||||||||||||||||||||||
return http("Get " + allergenType + " Allergens") | ||||||||||||||||||||||||||||||||||||
.get("/openmrs/ws/rest/v1/concept/" + allergenUuid + "?v=full"); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public HttpRequestActionBuilder saveAllergy(String patientUuid) { | ||||||||||||||||||||||||||||||||||||
Map<String, Object> payload = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Map<String,String> codedAllergen = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||
codedAllergen.put("uuid", CODED_ALLERGEN_UUID); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Map<String,Object>allergen = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||
allergen.put("allergenType", "DRUG"); | ||||||||||||||||||||||||||||||||||||
allergen.put("codedAllergen", codedAllergen); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Map<String,String>severity = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||
severity.put("uuid", SEVERITY_UUID); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Map<String, String> reactionUuid = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||
reactionUuid.put("uuid", ALLERGY_REACTION_UUID); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
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); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
try{ | ||||||||||||||||||||||||||||||||||||
return http("Save an Allergy") | ||||||||||||||||||||||||||||||||||||
.post("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy") | ||||||||||||||||||||||||||||||||||||
.body(StringBody(new ObjectMapper().writeValueAsString(payload))); | ||||||||||||||||||||||||||||||||||||
}catch (JsonProcessingException e) { | ||||||||||||||||||||||||||||||||||||
throw new RuntimeException(e); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
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
|
||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public HttpRequestActionBuilder getConditions(String patientUuid) { | ||||||||||||||||||||||||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -29,6 +29,8 @@ 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.recordAllergy("#{patient_uuid}")) | ||||||
.exec(registry.openConditionsTab("#{patient_uuid}")) | ||||||
.exec(registry.openImmunizationsTab("#{patient_uuid}")) | ||||||
.exec(registry.openAttachmentsTab("#{patient_uuid}")) | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There's an extra space here.