Skip to content

Commit

Permalink
Add component descriptions and required columns
Browse files Browse the repository at this point in the history
  • Loading branch information
qqndrew committed Mar 9, 2023
1 parent 8312ecf commit 664ea2d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.apache.beam.sdk.values.PCollectionRowTuple;
import org.apache.beam.sdk.values.PCollectionTuple;
import org.apache.beam.sdk.values.Row;
import org.ohnlp.backbone.api.annotations.ComponentDescription;
import org.ohnlp.backbone.api.components.OneToManyTransform;
import org.ohnlp.backbone.api.exceptions.ComponentInitializationException;
import org.ohnlp.familyhistory.tasks.*;
Expand All @@ -14,7 +15,27 @@
import java.util.List;
import java.util.Map;

@ComponentDescription(
name = "Family History Postprocessing",
desc = "Extracts and Creates Family History Relations",
requires = {"org.ohnlp.medtagger.backbone.MedTaggerBackboneTransform"}
)
public class FHPostProcessingTransform extends OneToManyTransform {

public Schema getRequiredColumns(String inputTag) {
return Schema.of(
Schema.Field.of("note_id", Schema.FieldType.STRING),
Schema.Field.of("sentid", Schema.FieldType.STRING),
Schema.Field.of("concept_code", Schema.FieldType.STRING),
Schema.Field.of("matched_sentence", Schema.FieldType.STRING),
Schema.Field.of("certainty", Schema.FieldType.STRING),
Schema.Field.of("offset", Schema.FieldType.INT32),
Schema.Field.of("sent_offset", Schema.FieldType.INT32),
Schema.Field.of("semgroups", Schema.FieldType.STRING)
);
}


@Override
public Map<String, Schema> calculateOutputSchema(Schema schema) {
return Map.of(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package org.ohnlp.familyhistory;

import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.transforms.ParDo;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.PDone;
import org.apache.beam.sdk.values.Row;
import org.ohnlp.backbone.api.annotations.ComponentDescription;
import org.ohnlp.backbone.api.annotations.ConfigurationProperty;
import org.ohnlp.backbone.api.components.LoadFromOne;
import org.ohnlp.familyhistory.tasks.CreateFHIRResources;
Expand All @@ -14,13 +16,32 @@
import java.io.FileWriter;
import java.io.IOException;

@ComponentDescription(
name = "Generate Family History FHIR Resources",
desc = "Generates FamilyMemberHistory FHIR R4 resources embedded within a DocumentReference and outputs as " +
"JSON to a specified folder. Note that no patient linkage is performed and as such cross-reference of " +
"document to patient IDs may be desirable as a post-processing step.",
requires = {"org.ohnlp.familyhistory.FHPostProcessingTransform"}
)
public class GenerateFHIRFamilyHistoryResources extends LoadFromOne {
@ConfigurationProperty(
path = "fileSystemPath",
desc = "The path into which to write generated FHIR resources"
)
private String workingDir;

public Schema getRequiredColumns(String inputTag) {
return Schema.of(
Schema.Field.of("document_id", Schema.FieldType.STRING),
Schema.Field.of("family_member", Schema.FieldType.STRING),
Schema.Field.of("side", Schema.FieldType.STRING),
Schema.Field.of("clinical_entity", Schema.FieldType.STRING),
Schema.Field.of("concept_codes", Schema.FieldType.STRING),
Schema.Field.of("certainty", Schema.FieldType.STRING)
);
}


@Override
public void init() {
this.workingDir = this.workingDir + File.separator + "DocumentReference";
Expand Down

0 comments on commit 664ea2d

Please sign in to comment.