Skip to content

Commit

Permalink
:recyclec: refactor(FhirMappingJobManagerTest): Add a real erroneous …
Browse files Browse the repository at this point in the history
…csv to tests.
  • Loading branch information
Okanmercan99 authored and suatgonul committed Oct 8, 2023
1 parent 39c464c commit 9efc236
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 11 additions & 0 deletions tofhir-engine/src/test/resources/test-data/patients-erroneous.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pid,gender,birthDate,deceasedDateTime,homePostalCode
p1,male,2000-05-10,,
p2,male,1985-05-08,2017-03-10,G02547
p3,male,1997-02,,
p4,male,1999-06-05,,H10564
p5,male,1965-10-01,2019-04-21,G02547
p6,,1991-03
p7,female,1972-10-25,,V13135
p8,female,2010-01-10,,Z54564
p9,female,1999-05-12,,
p10,female,2003-11,,
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class FhirMappingJobManagerTest extends AsyncFlatSpec with BeforeAndAfterAll wit
sourceContext = Map("source" -> FileSystemSource(path = "patients.csv"))
)

val patientMappingTaskWithError: FhirMappingTask = FhirMappingTask(
mappingRef = "https://aiccelerate.eu/fhir/mappings/patient-mapping",
sourceContext = Map("source" -> FileSystemSource(path = "patients-erroneous.csv"))
)

val patientMappingTaskWithPreprocess: FhirMappingTask = FhirMappingTask(
mappingRef = "https://aiccelerate.eu/fhir/mappings/patient-mapping",
sourceContext = Map("source" ->
Expand Down Expand Up @@ -250,7 +255,6 @@ class FhirMappingJobManagerTest extends AsyncFlatSpec with BeforeAndAfterAll wit
it should "halt execute the mapping job when encounter with an error" in {
assume(fhirServerIsAvailable)

val patientMappingTaskWithError = patientMappingTask.copy(sourceContext = Map("source" -> FileSystemSource(path = "wrong.csv")))
val fhirMappingJobManager = new FhirMappingJobManager(mappingRepository, contextLoader, schemaRepository, Map(FhirPathUtilFunctionsFactory.defaultPrefix -> FhirPathUtilFunctionsFactory), sparkSession, mappingErrorHandling, runningJobRegistry)

val future = fhirMappingJobManager.executeMappingJob(mappingJobExecution = FhirMappingJobExecution(
Expand All @@ -270,7 +274,6 @@ class FhirMappingJobManagerTest extends AsyncFlatSpec with BeforeAndAfterAll wit
it should "continue execute the mapping job when encounter without an error" in {
assume(fhirServerIsAvailable)

val patientMappingTaskWithError = patientMappingTask.copy(sourceContext = Map("source" -> FileSystemSource(path = "wrong.csv")))
val fhirMappingJobManager = new FhirMappingJobManager(mappingRepository, contextLoader, schemaRepository, Map(FhirPathUtilFunctionsFactory.defaultPrefix -> FhirPathUtilFunctionsFactory), sparkSession, mappingErrorHandling, runningJobRegistry)

val future = fhirMappingJobManager.executeMappingJob(mappingJobExecution = FhirMappingJobExecution(
Expand Down

0 comments on commit 9efc236

Please sign in to comment.