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

[BEAM-11073] Dicom IO Connector for Java #13137

Merged
merged 26 commits into from Nov 30, 2020
Merged

[BEAM-11073] Dicom IO Connector for Java #13137

merged 26 commits into from Nov 30, 2020

Conversation

Aliraza-N
Copy link
Contributor

@Aliraza-N Aliraza-N commented Oct 19, 2020

We are looking to create a new Java Pipeline Connector to help facilitate Reading data from the Imaging API in GCP. Initially, this connector will be used to read study level metadata of Dicom instances.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Dataflow Flink Samza Spark Twister2
Go Build Status --- Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status --- Build Status --- Build Status ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status --- --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@Aliraza-N
Copy link
Contributor Author

R: @poojavenkatram

Copy link

@poojavenkatram poojavenkatram left a comment

Choose a reason for hiding this comment

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

Thanks Aliraza.

Best
Pooja

Copy link

@poojavenkatram poojavenkatram left a comment

Choose a reason for hiding this comment

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

Thanks Aliraza.

Best
Pooja

Copy link

@poojavenkatram poojavenkatram left a comment

Choose a reason for hiding this comment

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

Thanks Aliraza - looking great just a few more things.

Best
Pooja

Copy link

@poojavenkatram poojavenkatram left a comment

Choose a reason for hiding this comment

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

Thanks Aliraza looks great just a few more docs changes.

Best
Pooja

@Aliraza-N
Copy link
Contributor Author

R: @lukecwik
Hi, can you take a look at this PR? Thanks

@pabloem pabloem self-requested a review November 3, 2020 20:39
@pabloem
Copy link
Member

pabloem commented Nov 3, 2020

Run Java PreCommit

Copy link
Member

@pabloem pabloem left a comment

Choose a reason for hiding this comment

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

Can you add an integration test? You can refer to the FhirIO PR as an example: https://github.com/apache/beam/pull/11339/files

Specifically, FhirIOReadIT.java is an example of an integration test

@pabloem
Copy link
Member

pabloem commented Nov 5, 2020

can you add an integration test? Feel free to ping me to discuss why/why not to add one.

@Aliraza-N
Copy link
Contributor Author

I can't figure out how to reply directly to your comment above, but yes, I did start working on an integration test. Just not part of the prev commit.

@Aliraza-N
Copy link
Contributor Author

Run Java PreCommit

@Aliraza-N
Copy link
Contributor Author

retest this please

@SuppressWarnings({"nullness", "rawtypes"})
static class FetchStudyMetadataFn extends DoFn<String, String> {

private HealthcareApiClient dicomStore;
Copy link
Member

Choose a reason for hiding this comment

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

I suspect that if you do this, you can remove the nullness condition in SuppressWarnings?

Suggested change
private HealthcareApiClient dicomStore;
private HealthcareApiClient dicomStore = new HttpHealthcareApiClient();

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you also need to add null checks in process... up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I'm still failing compileJava.

Copy link
Member

@pabloem pabloem left a comment

Choose a reason for hiding this comment

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

Just a couple comments. Overall it's looking great.

@Aliraza-N
Copy link
Contributor Author

@pabloem Hi, can you take another look please? I'm still a little uncertain about removing the nullness warning suppression. I'm thinking adding some checks should be able to catch any error.

@pabloem
Copy link
Member

pabloem commented Nov 13, 2020

hm okay, feel free to re-add the suppression. Sorry about the trouble! And just the one comment about PAssert. LGTM after that.

@Aliraza-N
Copy link
Contributor Author

Aliraza-N commented Nov 13, 2020

All done! @pabloem

@aaltay
Copy link
Member

aaltay commented Nov 25, 2020

What is the next step for this PR?

@Aliraza-N
Copy link
Contributor Author

Hey, sorry this PR has been sitting here for a while. I have a couple of more commits (refactoring, clean up) for this PR. Should be on the tail-end of its life. I'll push these commits and notify the reviews in a few hours.

@Aliraza-N
Copy link
Contributor Author

@pabloem Hey I've made some changes after some feedback on my pipeline project. Can you take a look when you have a chance? thanks

@pabloem pabloem merged commit 978b812 into apache:master Nov 30, 2020
@pabloem
Copy link
Member

pabloem commented Nov 30, 2020

thanks! I've merged this @Aliraza-N

@TheNeuralBit
Copy link
Member

I think this broke Java Postcommit: https://ci-beam.apache.org/job/beam_PostCommit_Java/6904/

java.nio.file.NoSuchFileException: src/test/resources/DICOM/testDicomFile.dcm
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
	at java.nio.file.Files.newByteChannel(Files.java:361)
	at java.nio.file.Files.newByteChannel(Files.java:407)
	at java.nio.file.Files.readAllBytes(Files.java:3152)
	at org.apache.beam.sdk.io.gcp.healthcare.HttpHealthcareApiClient.uploadToDicomStore(HttpHealthcareApiClient.java:229)
	at org.apache.beam.sdk.io.gcp.healthcare.DicomIOReadIT.setup(DicomIOReadIT.java:55)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

@Aliraza-N
Copy link
Contributor Author

Aliraza-N commented Nov 30, 2020

I think this broke Java Postcommit: https://ci-beam.apache.org/job/beam_PostCommit_Java/6904/

java.nio.file.NoSuchFileException: src/test/resources/DICOM/testDicomFile.dcm
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
	at java.nio.file.Files.newByteChannel(Files.java:361)
	at java.nio.file.Files.newByteChannel(Files.java:407)
	at java.nio.file.Files.readAllBytes(Files.java:3152)
	at org.apache.beam.sdk.io.gcp.healthcare.HttpHealthcareApiClient.uploadToDicomStore(HttpHealthcareApiClient.java:229)
	at org.apache.beam.sdk.io.gcp.healthcare.DicomIOReadIT.setup(DicomIOReadIT.java:55)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Working on a fix. In the meantime, I'll add the @ Ignore tag

@TheNeuralBit
Copy link
Member

Thank you!

@Aliraza-N
Copy link
Contributor Author

This PR has the change needed to ignore the test. At first glance, it appears that the test input file is not available during the run.
#13440

@suztomo
Copy link
Contributor

suztomo commented Apr 5, 2021

@Aliraza-N The DiacomIOTest and other gcp healthcare service tests require default application credentials.

There are additional tests that suffer from this. They appear to be GCP integration tests, but have Test in the class name and so run under the :test task:
DicomIOTest. test_Dicom_failedMetadataRead
FhirIOTest. test_FhirIO_failedReads
FhirIOTest. test_FhirIO_failedWrites
HL7v2IOTest. test_HL7v2IO_failedReads
HL7v2IOTest. test_HL7v2IO_failedWrites

https://issues.apache.org/jira/browse/BEAM-11363?focusedCommentId=17242773&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17242773

Exception:

Caused by: java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
	at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:134)
	at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:119)
	at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:91)
	at org.apache.beam.sdk.io.gcp.healthcare.HttpHealthcareApiClient.initClient(HttpHealthcareApiClient.java:691)
	at org.apache.beam.sdk.io.gcp.healthcare.HttpHealthcareApiClient.<init>(HttpHealthcareApiClient.java:121)
	at org.apache.beam.sdk.io.gcp.healthcare.DicomIO$ReadStudyMetadata$FetchStudyMetadataFn.instantiateHealthcareClient(DicomIO.java:164)

Do you think they should be classified as integration tests?

If not, is there a way to run this test in GitHub Actions?

@pabloem
Copy link
Member

pabloem commented Apr 8, 2021

hmmm I think these should be run as IT tests indeed, and only whenever application default creds are available

@aaltay
Copy link
Member

aaltay commented Apr 22, 2021

hmmm I think these should be run as IT tests indeed, and only whenever application default creds are available

Who could make this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants