You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "Abacn (via GitHub)" <gi...@apache.org> on 2023/09/11 15:22:01 UTC

[GitHub] [beam] Abacn commented on a diff in pull request #28137: [WIP] Add a De-ID transform for Dicom IO

Abacn commented on code in PR #28137:
URL: https://github.com/apache/beam/pull/28137#discussion_r1321718418


##########
sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/healthcare/DicomIOIT.java:
##########
@@ -19,55 +19,67 @@
 
 import static org.apache.beam.sdk.io.gcp.healthcare.HL7v2IOTestUtil.HEALTHCARE_DATASET_TEMPLATE;
 
+import com.google.api.services.healthcare.v1.model.DeidentifyConfig;
 import java.io.IOException;
 import java.net.URISyntaxException;
-import org.apache.beam.sdk.PipelineResult;
-import org.apache.beam.sdk.testing.PAssert;
+import java.security.SecureRandom;
 import org.apache.beam.sdk.testing.TestPipeline;
-import org.apache.beam.sdk.transforms.Create;
 import org.junit.After;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
 @SuppressWarnings({"nullness", "uninitialized"})
-public class DicomIOReadIT {
-  private static final String TEST_FILE_PATH = "src/test/resources/DICOM/testDicomFile.dcm";
-  private static final String TEST_FILE_STUDY_ID = "study_000000000";
+public class DicomIOIT {
   @Rule public transient TestPipeline pipeline = TestPipeline.create();
 
   private String healthcareDataset;
   private String project;
   private HealthcareApiClient client;
-  private String storeName = "foo";
+  private final String dicomStoreId;
+  private final String dicomStoreName;
+  private final String deidDicomStoreId;
+  private final String deidDicomStoreName;
 
-  @Before
-  public void setup() throws IOException, URISyntaxException {
-    project =
+  public DicomIOIT() throws IOException {
+    this.client = new HttpHealthcareApiClient();
+    this.dicomStoreId =
+        "DICOM_store_" + System.currentTimeMillis() + "_" + new SecureRandom().nextInt(32);
+    this.deidDicomStoreId = dicomStoreId + "_deid";
+    this.project =
         TestPipeline.testingPipelineOptions()
             .as(HealthcareStoreTestPipelineOptions.class)
             .getStoreProjectId();
-    healthcareDataset = String.format(HEALTHCARE_DATASET_TEMPLATE, project);
-    client = new HttpHealthcareApiClient();
+    this.healthcareDataset = String.format(HEALTHCARE_DATASET_TEMPLATE, project);
+    final String dicomStorePrefix = healthcareDataset + "/dicomStores/";
+    this.dicomStoreName = dicomStorePrefix + dicomStoreId;
+    this.deidDicomStoreName = dicomStorePrefix + deidDicomStoreId;
+  }
 
-    client.createDicomStore(healthcareDataset, storeName);
-    client.uploadToDicomStore(healthcareDataset + "/dicomStores/" + storeName, TEST_FILE_PATH);
+  @Before
+  public void setup() throws IOException, URISyntaxException {
+    client.createDicomStore(healthcareDataset, dicomStoreName);
+    client.createDicomStore(healthcareDataset, deidDicomStoreName);
   }
 
   @After
-  public void deleteDicomStore() throws IOException {
-    client.deleteDicomStore(healthcareDataset + "/dicomStores/" + storeName);
+  public void deleteAllDicomStores() {
+    try {
+      client.deleteDicomStore(dicomStoreName);
+      client.deleteFhirStore(deidDicomStoreName);
+    } catch (IOException e) {
+      // Do nothing.
+    }
   }
 
   @Ignore("https://github.com/apache/beam/issues/28099")
-  @Test
+  /*@Test

Review Comment:
   The test is already ignored. It is not necessary to comment out them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org