use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class Loinc2HpoAnnotation method fromAnnotationLine.
public static Loinc2HpoAnnotation fromAnnotationLine(String line) {
String[] fields = line.split("\t");
if (fields.length != EXPECTED_NUMBER_OF_FIELDS) {
System.err.printf("Malformed line with %d fields: %s%n", fields.length, line);
}
LoincId loincId = new LoincId(fields[0]);
LoincScale scale = LoincScale.fromString(fields[1]);
TermId hpoId = TermId.of(fields[3]);
String curation = fields[5];
String comment = fields[6];
String outcomeString = fields[2];
Outcome outcome;
if (scale.equals(LoincScale.NOMINAL)) {
outcome = Outcome.nominal(outcomeString);
} else {
outcome = new Outcome(ShortCode.fromShortCode(outcomeString));
}
if (fields[4].equals(".")) {
return new Loinc2HpoAnnotation(loincId, scale, outcome, hpoId, curation, comment);
}
TermId supplementalId = TermId.of(fields[4]);
return new Loinc2HpoAnnotation(loincId, scale, outcome, hpoId, supplementalId, curation, comment);
}
use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class Dstu3ObservationTest method testGlucoseLow.
@Test
void testGlucoseLow() throws IOException {
String jsonPath = "json/glucoseLow.fhir";
Observation glucoseAbnormal = importDstu3Observation(jsonPath);
Uberobservation uberobservation = new ObservationDtu3(glucoseAbnormal);
LoincId expectedLoincId = new LoincId("15074-8");
Optional<LoincId> opt = uberobservation.getLoincId();
assertTrue(opt.isPresent());
assertEquals(expectedLoincId, opt.get());
Optional<Outcome> opt2 = uberobservation.getOutcome();
assertTrue(opt2.isPresent());
assertEquals(Outcome.LOW(), opt2.get());
assertNotEquals(Outcome.NORMAL(), opt2.get());
assertNotEquals(Outcome.HIGH(), opt2.get());
}
use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class ObservationWithCodedValueTest method testEcoliBloodCulture.
@Test
public void testEcoliBloodCulture() {
Observation ecoliObservation = ecoliNoInterpretationBloodCulture();
Uberobservation uberobservation = new ObservationDtu3(ecoliObservation);
LoincId loincId = new LoincId("600-7");
Optional<LoincId> loincOpt = uberobservation.getLoincId();
assertTrue(loincOpt.isPresent());
assertEquals(loincId, loincOpt.get());
Optional<Outcome> outcomeOpt = uberobservation.getOutcome();
assertTrue(outcomeOpt.isPresent());
Outcome outcome = outcomeOpt.get();
assertTrue(outcome.isNominal());
assertEquals("112283007:http://snomed.info/sct:Escherichia coli", outcome.getOutcome());
}
use of org.monarchinitiative.loinc2hpocore.loinc.LoincId in project loinc2hpo by monarch-initiative.
the class AnnotationQcCommand method run.
@Override
public void run() {
System.out.println(annotPath);
Loinc2HpoAnnotationParser parser = new Loinc2HpoAnnotationParser(annotPath);
List<Loinc2HpoAnnotation> entries = parser.getEntries();
System.out.println("[INFO] Got " + entries.size() + " LOINC annotations.");
Ontology ontology = OntologyLoader.loadOntology(new File(hpJsonPath));
System.out.println("[INFO] Got " + ontology.countNonObsoleteTerms() + " HPO terms in hp.json.");
checkValidityOfHpoTerms(entries, ontology);
Map<LoincId, LoincAnnotation> mymap = parser.loincToHpoAnnotationMap();
System.out.println("[INFO] " + mymap.size() + " annotated LOINC terms");
checkValidityOfLoincAnnotations(mymap);
}
Aggregations