Skip to content

Commit

Permalink
Add Concept json tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ramari16 committed Nov 20, 2024
1 parent c2203d1 commit 052e7c4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
import java.util.Map;

@JsonIgnoreProperties(ignoreUnknown = true)
public record Concept(String type, String conceptPath, String name, String display, String dataset, String description, Map<String, String> meta) {
public record Concept(String conceptPath, String name, String display, String dataset, String description, Map<String, String> meta) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public void writeHeader(String[] data) {
.fields()
.requiredString("concept_path")
.name("drs_uri").type(SchemaBuilder.array().items(SchemaBuilder.nullable().stringType())).noDefault()
.nullableString("type", "null")
.nullableString("display", "null")
.nullableString("dataset", "null")
.nullableString("description", "null")
Expand Down Expand Up @@ -165,7 +164,6 @@ private void writeDataDictionary() {
}
}
}
dataDictionaryData.put("type", concept.type());
dataDictionaryData.put("display", concept.display());
dataDictionaryData.put("dataset", concept.dataset());
dataDictionaryData.put("description", concept.description());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ public class ConceptTest {

@Test
public void jsonSerialization() throws JsonProcessingException {
Concept[] concepts = new Concept[]{new Concept("Categorical", "\\demographics\\age\\", "age", "AGE", null, "patient age", Map.of("drs_uri", "[\"a-drs.uri\", \"another-drs.uri\"]"))};
Concept[] concepts = new Concept[]{new Concept("\\demographics\\age\\", "age", "AGE", null, "patient age", Map.of("drs_uri", "[\"a-drs.uri\", \"another-drs.uri\"]"))};
ObjectMapper objectMapper = new ObjectMapper();

String serialized = objectMapper.writeValueAsString(concepts);
//String serialized = "[{\"type\":\"Categorical\",\"conceptPath\":\"\\\\phs003578\\\\AGE_CAT\\\\\",\"name\":\"AGE_CAT\",\"display\":\"Participant age, 4 categories\",\"dataset\":\"phs003578\",\"description\":\"Participant age, 4 categories\",\"values\":[\"16-29 years\",\"30-49 years\",\"50-64 years\",\"65+ years\"],\"allowFiltering\":true,\"studyAcronym\":\"RESPONSE\",\"children\":null,\"meta\":{\"values\":\"[\\\"16-29 years\\\",\\\"30-49 years\\\",\\\"50-64 years\\\",\\\"65+ years\\\"]\",\"description\":\"Participant age, 4 categories\",\"drs_uri\":\"[\\\"drs://dg.4503:dg.4503%2F0aa2fcab-5a40-40d9-86b5-ba42f3b71ab0\\\"]\",\"stigmatized\":\"false\"},\"table\":null,\"study\":{\"ref\":\"phs003578\",\"fullName\":\"REDS-IV-P Epidemiology, Surveillance and Preparedness of the Novel SARS-CoV-2 Epidemic\",\"abbreviation\":\"RESPONSE\",\"description\":\"Leveraging access to the blood supply and blood donors, the REDS-IV-P program began conducting the RESPONSE study (REDS-IV-P Epidemiology, Surveillance and Preparedness of the Novel SARS-CoV-2 Epidemic) in early 2020 in order to 1) evaluate if SARS-CoV-2 RNA was found in blood donations in the U.S. using an assay that could potentially be used to screen the blood supply if evidence of SARS-CoV-2 transfusion-transmission became apparent 2) conduct serosurveys using optimized assays/algorithms to monitor antibody reactivity in blood donor populations over time, 3) enroll SARS-CoV-2 positive donors and others into a longitudinal cohort study to answer fundamental questions about the evolution of viremia and immune responses, and 4) establish a sharable biorepository that includes specimens collected early on in the infection and potentially large volumes of plasma from infected/convalescent donors.Screening for SARS-CoV-2 RNAemia was completed using a SARS-CoV-2 nucleic acid test (NAT) performed on retained blood donor minipool samples from six geographic regions in the US. The study also included serosurveillance (i.e. testing for antibody directed against the SARS-CoV2 spike protein) of donations from the same six regions to document accruing seroincidence in blood donor populations and to project these rates in the general population. To enrich for donors with acute SARS-CoV-2 infection, another part of the study focused on donors reporting post-donation information (PDI) consistent with COVID-19 by testing plasma from all available PDI donations for SARS-CoV-2 RNA by NAT. Subjects who were diagnosed with COVID-19 based on PDI reports or who tested positive by SARS-CoV-2 NAT on index donation plasma were enrolled into a longitudinal follow-up study which collected multiple samples for up to one-year post-infection. The longitudinal follow-up study also enrolled community members who reported a new positive SARS-CoV-2 NAT test in the prior 7-14 days.The specific aims of the RESPONSE study were to:1. Establish the incidence of SARS-CoV-2 RNAemia in blood donations from the American Red Cross (ARC) regions in Los Angeles, Boston, and Minneapolis metropolitan areas, Bloodworks Northwest (BWNW), New York Blood Center (NYBC), and Vitalant San Francisco Bay Area, monthly between March and September of 20202. Conduct serosurveys to study antibody reactivity in same six areas as above monthly for March to August 20203. Document rates of Post Donation Information (PDI) reports to determine PDI rates relevant to SARS-CoV-2 clinical disease and test index donation plasma from PDI donors for SARS-CoV-2 RNA4. Enroll SARS-CoV-2 infected subjects into a longitudinal cohort study to answer fundamental questions on the evolution of viremia, early immune responses and waning of immunity over 3-12 months of follow-up5. Establish a sharable biorepository of samples from all of the above Aims for future researchThe data from Aims 3 and 4 above is being made available in BioData Catalyst.\",\"meta\":{\"study_link\":\"https://www.ncbi.nlm.nih.gov/projects/gap/cgi-bin/study.cgi?study_id=phs003578.v1.p1\",\"phase\":\"p1\",\"sponsor\":\"National Heart, Lung, and Blood Institute\",\"study_accession\":\"phs003578.v1.p1\",\"study_design\":\"Prospective Longitudinal Cohort\",\"data_type\":\"P\",\"study_focus\":\"SARS-CoV-2\",\"version\":\"v1\"}},\"type\":\"Categorical\"}]";

Concept[] deserialized = objectMapper.readValue(serialized, Concept[].class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void writeValidPFB() {
PfbWriter pfbWriter = new PfbWriter(new File("target/test-result.avro"), UUID.randomUUID().toString(), dictionaryService);

Mockito.when(dictionaryService.getConcepts(List.of("patient_id", "\\demographics\\age\\", "\\phs123\\stroke\\")))
.thenReturn(List.of(new Concept("Categorical", "\\demographics\\age\\", "age", "AGE", null, "patient age", Map.of("drs_uri", "[\"a-drs.uri\", \"another-drs.uri\"]"))));
.thenReturn(List.of(new Concept("\\demographics\\age\\", "age", "AGE", null, "patient age", Map.of("drs_uri", "[\"a-drs.uri\", \"another-drs.uri\"]"))));

pfbWriter.writeHeader(new String[] {"patient_id", "\\demographics\\age\\", "\\phs123\\stroke\\"});
List<List<String>> nullableList = new ArrayList<>();
Expand Down

0 comments on commit 052e7c4

Please sign in to comment.