Skip to content

Commit

Permalink
dont add medtagger prefix as it messes with legacy configs
Browse files Browse the repository at this point in the history
  • Loading branch information
qqndrew committed Feb 15, 2023
1 parent d399138 commit d1815f9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.ohnlp.medtagger</groupId>
<artifactId>medtagger</artifactId>
<version>1.0.51</version>
<version>1.0.52</version>
<description>The MedTagger biomedical information extraction pipeline</description>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ public void initFromConfig(JsonNode config) throws ComponentInitializationExcept
@Override
public Schema calculateOutputSchema(Schema schema) {
List<Schema.Field> fields = new ArrayList<>(schema.getFields());
fields.add(Schema.Field.of("medtagger_matched_text", Schema.FieldType.STRING));
fields.add(Schema.Field.of("medtagger_concept_code", Schema.FieldType.STRING));
fields.add(Schema.Field.of("medtagger_matched_sentence", Schema.FieldType.STRING));
fields.add(Schema.Field.of("medtagger_section_id", Schema.FieldType.INT32));
fields.add(Schema.Field.of("medtagger_nlp_run_dtm", Schema.FieldType.DATETIME));
fields.add(Schema.Field.of("medtagger_certainty", Schema.FieldType.STRING));
fields.add(Schema.Field.of("medtagger_experiencer", Schema.FieldType.STRING));
fields.add(Schema.Field.of("medtagger_status", Schema.FieldType.STRING));
fields.add(Schema.Field.of("medtagger_offset", Schema.FieldType.INT32));
fields.add(Schema.Field.of("medtagger_semgroups", Schema.FieldType.STRING).withNullable(true));
fields.add(Schema.Field.of("matched_text", Schema.FieldType.STRING));
fields.add(Schema.Field.of("concept_code", Schema.FieldType.STRING));
fields.add(Schema.Field.of("matched_sentence", Schema.FieldType.STRING));
fields.add(Schema.Field.of("section_id", Schema.FieldType.INT32));
fields.add(Schema.Field.of("nlp_run_dtm", Schema.FieldType.DATETIME));
fields.add(Schema.Field.of("certainty", Schema.FieldType.STRING));
fields.add(Schema.Field.of("experiencer", Schema.FieldType.STRING));
fields.add(Schema.Field.of("status", Schema.FieldType.STRING));
fields.add(Schema.Field.of("offset", Schema.FieldType.INT32));
fields.add(Schema.Field.of("semgroups", Schema.FieldType.STRING).withNullable(true));
this.outputSchema = Schema.of(fields.toArray(new Schema.Field[0]));
return this.outputSchema;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,42 +99,42 @@ public void processElement(@Element Row input, OutputReceiver<Row> output) throw
// Generate an output row
Row.Builder rowBuild = Row.withSchema(schema)
.addValues(input.getValues())
.addValue(input.getInt32("medtagger_section_id"))
.addValue(input.getString("medtagger_matched_text"))
.addValue(input.getString("medtagger_matched_sentence"));
.addValue(input.getInt32("section_id"))
.addValue(input.getString("matched_text"))
.addValue(input.getString("matched_sentence"));
switch (resources.toUpperCase(Locale.ROOT)) {
case "NONE": {
try {
rowBuild = rowBuild.addValue(Integer.valueOf(Optional.ofNullable(input.getString("medtagger_concept_code")).orElse("0")));
rowBuild = rowBuild.addValue(Integer.valueOf(Optional.ofNullable(input.getString("concept_code")).orElse("0")));
} catch (NumberFormatException e) {
throw new IllegalArgumentException("OHDSI requires integer concept codes, value "
+ input.getString("medtagger_concept_code") + " was instead provided with mapping ruleset 'NONE'");
+ input.getString("concept_code") + " was instead provided with mapping ruleset 'NONE'");
}
break;
}
case "UMLS": {
String conceptCode = input.getString("medtagger_concept_code");
String conceptCode = input.getString("concept_code");
// Only take first portion as CUI, remainder is top freq lexeme in current dict format.
String cui = conceptCode.contains(":") ? conceptCode.split(":")[0].toUpperCase(Locale.ROOT)
: conceptCode.toUpperCase(Locale.ROOT);
int ohdsicid = ohdsiConceptMap.getOrDefault(cui, -99999);
rowBuild = rowBuild.addValue(ohdsicid);
}
default: {
rowBuild = rowBuild.addValue(ohdsiConceptMap.getOrDefault(input.getString("medtagger_concept_code"), 0));
rowBuild = rowBuild.addValue(ohdsiConceptMap.getOrDefault(input.getString("concept_code"), 0));
}
}
Row out = rowBuild
.addValue(0)
.addValue(input.getDateTime("medtagger_nlp_run_dtm"))
.addValue(input.getDateTime("nlp_run_dtm"))
.addValue(
String.format("certainty=%1$s,experiencer=%2$s,status=%3$s",
input.getString("medtagger_certainty"),
input.getString("medtagger_experiencer"),
input.getString("medtagger_status")
input.getString("certainty"),
input.getString("experiencer"),
input.getString("status")
)
)
.addValue(input.getInt32("medtagger_offset"))
.addValue(input.getInt32("offset"))
.addValue(version.trim())
.build();
output.output(out);
Expand Down

0 comments on commit d1815f9

Please sign in to comment.