-
Notifications
You must be signed in to change notification settings - Fork 80
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
Support for fetching FHIR resources via Bulk export mode #1082
base: master
Are you sure you want to change the base?
Support for fetching FHIR resources via Bulk export mode #1082
Conversation
8c12502
to
9a7b464
Compare
aaf488e
to
dbc61d0
Compare
dbc61d0
to
c779d2d
Compare
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 @chandrashekar-s for the change and sorry for the delay caused by DevDays and issues around it. I had a look at most of the non-test code and my main/major comment is about whether we should create temporary files or not (I am suggesting not).
* @throws BulkExportException | ||
* @throws IOException | ||
*/ | ||
public static List<Path> triggerBulkExportAndDownloadFiles( |
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.
In general, it is better to avoid static
methods for non-trivial tasks as it makes the modules more tightly coupled and harder to unit-test. For example, here I would make this a non-static method and call it on an instance of BulkExportUtil
when needed. I would also make fhirSearchUtil
as instance property.
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.
Agreed, changes have been made as suggested.
pipelines/batch/src/main/java/com/google/fhir/analytics/BulkExportUtil.java
Show resolved
Hide resolved
pipelines/batch/src/main/java/com/google/fhir/analytics/BulkExportUtil.java
Outdated
Show resolved
Hide resolved
pipelines/batch/src/main/java/com/google/fhir/analytics/FhirEtl.java
Outdated
Show resolved
Hide resolved
pipelines/batch/src/main/java/com/google/fhir/analytics/BulkExportUtil.java
Outdated
Show resolved
Hide resolved
pipelines/batch/src/main/java/com/google/fhir/analytics/FhirSearchUtil.java
Outdated
Show resolved
Hide resolved
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; | ||
|
||
/** Model class for holding the details of the bulk export job output */ | ||
@Data |
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.
For pure data objects, I have found the "new" record construct is also useful.
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 pointing this out, I didn't know about it. For time being, I have not made these changes as there are many fields in the Pojo and by default the record
construct only creates all arguments constructor. I will revisit this later if this fine for you.
MethodOutcome methodOutcome = | ||
fetchUtil.performServerOperation( | ||
"export", fetchBulkExportParameters(fhirVersionEnum, resourceTypes), headers); | ||
if ((methodOutcome.getResponseStatusCode() / 100) != 2) { |
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.
I would guess httpcore
probably has a isStatusSuccess()
method or something similar that is more readable; if not, maybe define one?
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.
I didnt find this method in the apache http util classes, so I created one.
private IBaseParameters fetchBulkExportParameters( | ||
FhirVersionEnum fhirVersionEnum, List<String> resourceTypes) throws BulkExportException { | ||
switch (fhirVersionEnum) { | ||
case R4: |
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.
Why we only have support for R4
here?
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.
Added support for DSTU3 now.
import lombok.Data; | ||
|
||
/** The response body of the bulk export job status */ | ||
@Data |
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.
ditto
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.
Have provided my reasons in the other comment.
c779d2d
to
30b4fe9
Compare
5d36f23
to
739e8e7
Compare
Thanks @bashir2 for the review. I have addressed the comments in the latest commit. |
Description of what I changed
Fixes #1031
fhirFetchMode
has been added, which explicitly specifies which mode the application should use to fetch FHIR resources from source (this avoids the confusion of dynamically figuring out the mode from the parameters configured).E2E test
TESTED:
Checklist: I completed these to help reviewers :)
I have read and will follow the review process.
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.
My IDE is configured to follow the Google code styles.
No? Unsure? -> configure your IDE.
I have added tests to cover my changes. (If you refactored existing code that was well tested you do not have to add tests)
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.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master