From d149826e05e1f9a766c59727a98e80999f9ad9d5 Mon Sep 17 00:00:00 2001 From: Ryan Amari Date: Mon, 22 Jul 2024 15:29:44 -0400 Subject: [PATCH] ALS-6511: Fix null value handling --- .../harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriter.java | 2 +- .../hms/dbmi/avillach/hpds/processing/io/PfbWriterTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriter.java b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriter.java index 31f8c9b7..2d098a7a 100644 --- a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriter.java +++ b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriter.java @@ -52,7 +52,7 @@ public void writeHeader(String[] data) { SchemaBuilder.FieldAssembler patientRecords = SchemaBuilder.record("patientData") .fields(); - fields.forEach(patientRecords::requiredString); + fields.forEach(field -> patientRecords.nullableString(field, "null")); patientDataSchema = patientRecords.endRecord(); Schema objectSchema = Schema.createUnion(metadataSchema, patientDataSchema); diff --git a/processing/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriterTest.java b/processing/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriterTest.java index 9a527838..4094dd93 100644 --- a/processing/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriterTest.java +++ b/processing/src/test/java/edu/harvard/hms/dbmi/avillach/hpds/processing/io/PfbWriterTest.java @@ -19,7 +19,7 @@ public void writeValidPFB() { pfbWriter.writeHeader(new String[] {"\\demographics\\age\\", "\\phs123\\stroke\\"}); pfbWriter.writeEntity(List.of(new String[]{"80", "Y"}, new String[]{"70", "N"}, - new String[]{"75", "N"} + new String[]{"75", null} )); pfbWriter.close(); // todo: validate this programatically