-
Notifications
You must be signed in to change notification settings - Fork 93
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
Implementation of --activePeriod
feature.
#152
Conversation
Codecov Report
@@ Coverage Diff @@
## master #152 +/- ##
============================================
- Coverage 42.76% 35.50% -7.27%
- Complexity 97 102 +5
============================================
Files 21 24 +3
Lines 774 969 +195
Branches 67 87 +20
============================================
+ Hits 331 344 +13
- Misses 421 597 +176
- Partials 22 28 +6
Continue to review full report at Codecov.
|
throw new IllegalArgumentException("--activePeriod is not supported in JDBC mode."); | ||
} | ||
Set<String> resourceSet = Sets.newHashSet(options.getResourceList().split(",")); | ||
if (resourceSet.contains("Patinet")) { |
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.
Patient?
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.
Done.
Please note that I changed the way Patient resources are handled in the --activePeriod
mode. Hence, this check is now different.
|
||
@VisibleForTesting | ||
static String getSubjectPatientIdOrNull(Resource resource) { | ||
String patinetId = null; |
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.
NIT: patientId
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.
Done.
@@ -24,7 +24,7 @@ ENV OPENMRS_PASSWORD="Admin123" | |||
ENV SINK_PATH="" | |||
ENV SINK_USERNAME="" | |||
ENV SINK_PASSWORD="" | |||
ENV SEARCH_LIST="Patient,Encounter,Observation" | |||
ENV RESOURCE_LIST="Patient,Encounter,Observation" |
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.
It would be nice to change docker-compose files e.g here https://github.com/GoogleCloudPlatform/openmrs-fhir-analytics/blob/353cb17d30ee0e74816a58d1d56eddfecb8c77a3/docker/docker-compose.yaml#L32
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.
Done and thanks for catching this. Also updated the JDBC code-paths for consistency.
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.
This looks great, just a few NITs. I'll also comment on the results from yesterday's discussion!
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.
Given the tests we did last week, I changed this new feature to fetch Patient resources separately. The reason is that fetching all Patients may still time-out if there are millions of them. With the new implementation, only Patient resources are fetched that have an Observation/Encounter in the active period.
@@ -24,7 +24,7 @@ ENV OPENMRS_PASSWORD="Admin123" | |||
ENV SINK_PATH="" | |||
ENV SINK_USERNAME="" | |||
ENV SINK_PASSWORD="" | |||
ENV SEARCH_LIST="Patient,Encounter,Observation" | |||
ENV RESOURCE_LIST="Patient,Encounter,Observation" |
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.
Done and thanks for catching this. Also updated the JDBC code-paths for consistency.
|
||
@VisibleForTesting | ||
static String getSubjectPatientIdOrNull(Resource resource) { | ||
String patinetId = null; |
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.
Done.
throw new IllegalArgumentException("--activePeriod is not supported in JDBC mode."); | ||
} | ||
Set<String> resourceSet = Sets.newHashSet(options.getResourceList().split(",")); | ||
if (resourceSet.contains("Patinet")) { |
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.
Done.
Please note that I changed the way Patient resources are handled in the --activePeriod
mode. Hence, this check is now different.
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.
Thanks for addressing the suggestion! This looks great!
Description of what I changed
This implements issue #128 by adding an
--activePeriod
feature. For details, see this comment.E2E test
TESTED:
Ran:
Then compared the list of
patientId
s for whom the historical resources were fetched touuid
s of the following MySQL query (this is not a perfect query but works for this case):This list includes 171 patients (with the big test DB) and there are 17321 Observations associated to these patients which was confirmed by this MySQL query:
Also ran this to check the two dates version of
--activePeriod
:Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
No? Unsure? -> configure your IDE, format the code and add the changes with
git add . && git commit --amend
I am familiar with Google Style Guides for the language I have coded in.
No? Please take some time and review Java and Python style guides. Note, when in conflict, OpenMRS style guide overrules.
I have added tests to cover my changes. (If you refactored existing code that was well tested you do not have to add tests) [More unit-tests as TODO.]
No? -> write tests and add them to this commit
git add . && git commit --amend
I ran
mvn clean package
right before creating this pull request and added all formatting changes to my commit.All new and existing tests passed.
No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master