From b2d73a43211b122689ae8241b4026481fcc82e7a Mon Sep 17 00:00:00 2001 From: Franz Matthies Date: Fri, 8 Nov 2024 16:27:22 +0100 Subject: [PATCH] fixed bug with feature resolution --- .../contrib/external_server_consumer.py | 6 +- .../contrib/external_uima_classifier.py | 2 +- .../{Albers.txt.xmi => Albers.deid.xmi} | 0 .../tests/resources/Baastrup.general.xmi | 88 + ...ers_TypeSystem.xml => deid_TypeSystem.xml} | 0 .../tests/resources/general_TypeSystem.xml | 3842 +++++++++++++++++ .../tests/test_external_server_consumer.py | 23 - .../tests/test_recommender.py | 56 + 8 files changed, 3990 insertions(+), 27 deletions(-) rename inception_ahd_recommender/tests/resources/{Albers.txt.xmi => Albers.deid.xmi} (100%) create mode 100644 inception_ahd_recommender/tests/resources/Baastrup.general.xmi rename inception_ahd_recommender/tests/resources/{albers_TypeSystem.xml => deid_TypeSystem.xml} (100%) create mode 100644 inception_ahd_recommender/tests/resources/general_TypeSystem.xml delete mode 100644 inception_ahd_recommender/tests/test_external_server_consumer.py create mode 100644 inception_ahd_recommender/tests/test_recommender.py diff --git a/inception_ahd_recommender/ariadne/contrib/external_server_consumer.py b/inception_ahd_recommender/ariadne/contrib/external_server_consumer.py index d6efecd..1e2ac8e 100644 --- a/inception_ahd_recommender/ariadne/contrib/external_server_consumer.py +++ b/inception_ahd_recommender/ariadne/contrib/external_server_consumer.py @@ -199,10 +199,10 @@ def process(self, response) -> "response_consumer_return_value": if _dupl is not None: logging.warning( f"Removed {_dupl} from 'add_feature' for entry '{check_dict.entry_name}_{_label}'.") - for k, v in check_dict.additional_feats.items(): # Provide the "add_feature" values - _feat_val = anno.get(k) + for target_feature, mapping_tuple in check_dict.additional_feats.items(): # Provide the "add_feature" values + _feat_val = mapping_tuple[0](anno,mapping_tuple[1]) if _feat_val is not None: - _final_features[k] = _feat_val + _final_features[target_feature] = _feat_val self.count += 1 break # Stacking layers is not allowed # else: diff --git a/inception_ahd_recommender/ariadne/contrib/external_uima_classifier.py b/inception_ahd_recommender/ariadne/contrib/external_uima_classifier.py index b70153c..2d1ef8c 100644 --- a/inception_ahd_recommender/ariadne/contrib/external_uima_classifier.py +++ b/inception_ahd_recommender/ariadne/contrib/external_uima_classifier.py @@ -383,7 +383,7 @@ def add_prediction_to_cas( feature, _begin, _end, - response.labels[i] if feature not in response.features[i] else response.features[i], + response.labels[i] if feature not in response.features[i] else response.features[i][feature], response.score[i], ) cas.add(prediction) diff --git a/inception_ahd_recommender/tests/resources/Albers.txt.xmi b/inception_ahd_recommender/tests/resources/Albers.deid.xmi similarity index 100% rename from inception_ahd_recommender/tests/resources/Albers.txt.xmi rename to inception_ahd_recommender/tests/resources/Albers.deid.xmi diff --git a/inception_ahd_recommender/tests/resources/Baastrup.general.xmi b/inception_ahd_recommender/tests/resources/Baastrup.general.xmi new file mode 100644 index 0000000..026ed3d --- /dev/null +++ b/inception_ahd_recommender/tests/resources/Baastrup.general.xmi @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inception_ahd_recommender/tests/resources/albers_TypeSystem.xml b/inception_ahd_recommender/tests/resources/deid_TypeSystem.xml similarity index 100% rename from inception_ahd_recommender/tests/resources/albers_TypeSystem.xml rename to inception_ahd_recommender/tests/resources/deid_TypeSystem.xml diff --git a/inception_ahd_recommender/tests/resources/general_TypeSystem.xml b/inception_ahd_recommender/tests/resources/general_TypeSystem.xml new file mode 100644 index 0000000..d70c4ca --- /dev/null +++ b/inception_ahd_recommender/tests/resources/general_TypeSystem.xml @@ -0,0 +1,3842 @@ + + + + + + + + de.averbis.extraction.types.CoreAnnotation + + + + uima.tcas.Annotation + + + + + + componentId + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + confidenceKind + + + + uima.cas.String + + + + + + + + + + de.averbis.textanalysis.types.evaluation.EvaluationAnnotation + + + + de.averbis.extraction.types.CoreAnnotation + + + + + + annotation + + + + uima.tcas.Annotation + + + + + + reason + + + + uima.cas.String + + + + + + + + + + de.averbis.textanalysis.types.evaluation.FalseNegative + + + + de.averbis.textanalysis.types.evaluation.EvaluationAnnotation + + + + + + de.averbis.textanalysis.types.evaluation.FalsePositive + + + + de.averbis.textanalysis.types.evaluation.EvaluationAnnotation + + + + + + de.averbis.textanalysis.types.evaluation.PartialPositive + + + + de.averbis.textanalysis.types.evaluation.TruePositive + + + + + + de.averbis.textanalysis.types.evaluation.TruePositive + + + + de.averbis.textanalysis.types.evaluation.EvaluationAnnotation + + + + + + de.averbis.textanalysis.types.search.DoubleSortKey + + + + de.averbis.textanalysis.types.search.SortKey + + + + + + value + + + + uima.cas.Double + + + + + + + + + + de.averbis.textanalysis.types.search.SortKey + + + + de.averbis.extraction.types.CoreAnnotation + + + + + + name + + + + uima.cas.String + + + + + + + + + + de.averbis.textanalysis.types.search.StringSortKey + + + + de.averbis.textanalysis.types.search.SortKey + + + + + + value + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.ATCCode + + + + de.averbis.types.health.Concept + + + + + + de.averbis.types.health.Age + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.Anatomy + + + + de.averbis.types.health.Concept + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.BiologicallyDerivedProduct + + + + de.averbis.types.health.Concept + + + + + + quantity + + + + uima.cas.Double + + + + + + time + + + + de.averbis.types.health.Timex3 + + + + + + + + + + de.averbis.types.health.BloodPressure + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + systolic + + + + de.averbis.types.health.Measurement + + + + + + diastolic + + + + de.averbis.types.health.Measurement + + + + + + interpretation + + + + uima.cas.String + + + + + + method + + + + uima.cas.String + + + + + + status + + + + uima.cas.String + + + + + + date + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.BreslowScore + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + score + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Chimerism + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + date + + + + uima.cas.String + + + + + + kind + + + + uima.cas.String + + + + + + value + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.ClarkLevel + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + level + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.ClinicalSection + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + keyword + + + + de.averbis.types.health.ClinicalSectionKeyword + + + + + + label + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.ClinicalSectionKeyword + + + + de.averbis.types.health.Concept + + + + + + de.averbis.types.health.Concept + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + conceptID + + + + uima.cas.String + + + + + + dictCanon + + + + uima.cas.String + + + + + + matchedTerm + + + + uima.cas.String + + + + + + negatedBy + + + + uima.cas.String + + + + + + source + + + + uima.cas.String + + + + + + uniqueID + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Contact + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + kind + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.Date + + + + de.averbis.types.health.Timex3 + + + + + + day + + + + uima.cas.String + + + + + + month + + + + uima.cas.String + + + + + + year + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.DateInterval + + + + de.averbis.types.health.Timex3 + + + + + + startDate + + + + uima.cas.String + + + + + + endDate + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.DayTimeDoseFrequency + + + + de.averbis.types.health.DoseFrequency + + + + + + morning + + + + uima.cas.Double + + + + + + midday + + + + uima.cas.Double + + + + + + evening + + + + uima.cas.Double + + + + + + atNight + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.DeidentifiedDocument + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + kind + + + + uima.cas.String + + + + + + deidentifiedText + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Department + + + + de.averbis.types.health.Concept + + + + + + departmentType + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Diagnosis + + + + de.averbis.types.health.Concept + + + + + + approach + + + + uima.cas.String + + + + + + belongsTo + + + + uima.cas.String + + + + + + clinicalStatus + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + kind + + + + uima.cas.String + + + + + + onsetDate + + + + uima.cas.String + + + + + + laterality + + + + uima.cas.String + + + + + + verificationStatus + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.DiagnosisCandidate + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + approach + + + + uima.cas.String + + + + + + belongsTo + + + + uima.cas.String + + + + + + clinicalStatus + + + + uima.cas.String + + + + + + conceptID + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + dictCanon + + + + uima.cas.String + + + + + + verificationStatus + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.DocumentAnnotation + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + language + + + + uima.cas.String + + + + + + version + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Dosage + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + de.averbis.types.health.DoseForm + + + + de.averbis.types.health.Concept + + + + + + de.averbis.types.health.DoseFrequency + + + + de.averbis.types.health.Concept + + + + + + interval + + + + uima.cas.String + + + + + + totalCount + + + + uima.cas.Double + + + + + + totalDose + + + + de.averbis.types.health.Measurement + + + + + + + + + + de.averbis.types.health.Drug + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + ingredient + + + + de.averbis.types.health.Ingredient + + + + + + strength + + + + de.averbis.types.health.Strength + + + + + + + + + + de.averbis.types.health.ECOG + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + stage + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Entity + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + label + + + + uima.cas.String + + + + + + value + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.EstrogenReceptor + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + percentage + + + + de.averbis.types.health.Measurement + + + + + + status + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + uima.tcas.Annotation + + + + + + de.averbis.types.health.GleasonScore + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + primaryGrade + + + + uima.cas.String + + + + + + score + + + + uima.cas.String + + + + + + secondaryGrade + + + + uima.cas.String + + + + + + occasion + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.GvHD + + + + de.averbis.types.health.Diagnosis + + + + + + continuanceStatus + + + + uima.cas.String + + + + + + date + + + + uima.cas.String + + + + + + grade + + + + uima.cas.String + + + + + + organ + + + + uima.cas.String + + + + + + stage + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.HER2 + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + percentage + + + + de.averbis.types.health.Measurement + + + + + + status + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.HLA + + + + de.averbis.types.health.Concept + + + + + + female + + + + de.averbis.types.health.HLAValue + + + + + + male + + + + de.averbis.types.health.HLAValue + + + + + + date + + + + uima.cas.String + + + + + + samplingDate + + + + uima.cas.String + + + + + + receiptDate + + + + uima.cas.String + + + + + + belongsTo + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.HLAValue + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + alleleGroup + + + + uima.cas.String + + + + + + expressionNote + + + + uima.cas.String + + + + + + noncodingRegionVariant + + + + uima.cas.String + + + + + + protein + + + + uima.cas.String + + + + + + synonymousDNA + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Hospitalisation + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + admissionDate + + + + uima.cas.String + + + + + + dischargeDate + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.ID + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + kind + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.Ingredient + + + + de.averbis.types.health.Concept + + + + + + de.averbis.types.health.Irradiation + + + + de.averbis.types.health.Concept + + + + + + irradiationDose + + + + de.averbis.types.health.IrradiationDose + + + + + + dateInterval + + + + de.averbis.types.health.DateInterval + + + + + + + + + + de.averbis.types.health.IrradiationDose + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + dose + + + + de.averbis.types.health.Measurement + + + + + + kind + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.LaboratoryParameter + + + + de.averbis.types.health.Concept + + + + + + de.averbis.types.health.LaboratoryValue + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + confidence + + + + uima.cas.Double + + + + + + belongsTo + + + + uima.cas.String + + + + + + fact + + + + de.averbis.types.health.Measurement + + + + + + factAssessment + + + + uima.cas.String + + + + + + interpretation + + + + uima.cas.String + + + + + + parameter + + + + de.averbis.types.health.LaboratoryParameter + + + + + + upperLimit + + + + de.averbis.types.health.Measurement + + + + + + qualitativeValue + + + + de.averbis.types.health.QualitativeValue + + + + + + lowerLimit + + + + de.averbis.types.health.Measurement + + + + + + date + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Location + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + kind + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.Measurement + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + value + + + + uima.cas.Double + + + + + + dimension + + + + uima.cas.String + + + + + + normalizedUnit + + + + uima.cas.String + + + + + + normalizedValue + + + + uima.cas.Double + + + + + + unit + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Medication + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + confidence + + + + uima.cas.Double + + + + + + administrations + + + + uima.cas.StringArray + + true + + + + + + atc + + + + uima.cas.String + + + + + + atcCodes + + + + uima.cas.FSArray + + de.averbis.types.health.ATCCode + + true + + + + + + brandName + + + + uima.cas.String + + + + + + date + + + + de.averbis.types.health.Timex3 + + + + + + dosage + + + + uima.cas.FSArray + + de.averbis.types.health.Dosage + + true + + + + + + doseForm + + + + de.averbis.types.health.DoseForm + + + + + + doseFrequency + + + + de.averbis.types.health.DoseFrequency + + + + + + drugs + + + + uima.cas.FSArray + + de.averbis.types.health.Drug + + true + + + + + + rateQuantity + + + + uima.cas.Double + + + + + + status + + + + uima.cas.String + + + + + + category + + + + uima.cas.String + + + + + + termTypes + + + + uima.cas.FSArray + + de.averbis.types.health.TTY + + true + + + + + + + + + + de.averbis.types.health.Morphology + + + + de.averbis.types.health.Concept + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.NYHA + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + stage + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Name + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + kind + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.Ophthalmology + + + + de.averbis.types.health.Concept + + + + + + laterality + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Organism + + + + de.averbis.types.health.Concept + + + + + + kind + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Organization + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + correspondence + + + + uima.cas.String + + + + + + organizationType + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.PHIOther + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.PathologyDocumentation + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + confidence + + + + uima.cas.Double + + + + + + category + + + + de.averbis.types.health.TumorCategory + + + + + + diagnosis + + + + de.averbis.types.health.Diagnosis + + + + + + grading + + + + uima.cas.String + + + + + + location + + + + uima.cas.String + + + + + + lymphnodesAffected + + + + uima.cas.Integer + + + + + + lymphnodesTested + + + + uima.cas.Integer + + + + + + lnAffected + + + + uima.cas.String + + + + + + lnTested + + + + uima.cas.String + + + + + + metastasis + + + + uima.cas.String + + + + + + morphology + + + + de.averbis.types.health.Morphology + + + + + + node + + + + uima.cas.String + + + + + + rClass + + + + uima.cas.String + + + + + + sentinelLymphnodesAffected + + + + uima.cas.Integer + + + + + + sentinelLymphnodesTested + + + + uima.cas.Integer + + + + + + slnAffected + + + + uima.cas.String + + + + + + slnTested + + + + uima.cas.String + + + + + + side + + + + uima.cas.String + + + + + + topography + + + + de.averbis.types.health.Topography + + + + + + thickness + + + + de.averbis.types.health.TumorThickness + + + + + + tumor + + + + uima.cas.String + + + + + + lymphaticInvasion + + + + uima.cas.String + + + + + + vascularInvasion + + + + uima.cas.String + + + + + + perineuralInvasion + + + + uima.cas.String + + + + + + resultDate + + + + uima.cas.String + + + + + + diagnosisDate + + + + uima.cas.String + + + + + + tPrefix + + + + uima.cas.String + + + + + + nPrefix + + + + uima.cas.String + + + + + + mPrefix + + + + uima.cas.String + + + + + + ySymbol + + + + uima.cas.String + + + + + + rSymbol + + + + uima.cas.String + + + + + + aSymbol + + + + uima.cas.String + + + + + + mSymbol + + + + uima.cas.String + + + + + + scores + + + + de.averbis.types.health.PathologyScore + + + + + + punchesAffected + + + + uima.cas.String + + + + + + punchesTested + + + + uima.cas.String + + + + + + maxPunchInfestation + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.PathologyScore + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + gleasonScore + + + + uima.cas.String + + + + + + gleasonScorePrimary + + + + uima.cas.String + + + + + + gleasonScoreSecondary + + + + uima.cas.String + + + + + + gleasonScoreOccasion + + + + uima.cas.String + + + + + + clarkLevel + + + + uima.cas.String + + + + + + breslowScore + + + + uima.cas.String + + + + + + psaValue + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.PatientInformation + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + deathDate + + + + uima.cas.String + + + + + + birthDate + + + + uima.cas.String + + + + + + deceased + + + + uima.cas.Boolean + + + + + + firstName + + + + uima.cas.String + + + + + + gender + + + + uima.cas.String + + + + + + lastName + + + + uima.cas.String + + + + + + age + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.PhysicalTherapy + + + + de.averbis.types.health.Concept + + + + + + status + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Procedure + + + + de.averbis.types.health.Concept + + + + + + date + + + + uima.cas.String + + + + + + laterality + + + + uima.cas.String + + + + + + status + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.ProcedureCandidate + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + approach + + + + uima.cas.String + + + + + + conceptID + + + + uima.cas.String + + + + + + dictCanon + + + + uima.cas.String + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.Profession + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.ProgesteroneReceptor + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + percentage + + + + de.averbis.types.health.Measurement + + + + + + status + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.QualitativeValue + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + modifier + + + + uima.cas.String + + + + + + value + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Refraction + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + axis + + + + uima.cas.Double + + + + + + cylinder + + + + uima.cas.Double + + + + + + sphere + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.Relation + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + subject + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + predicate + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + object + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + value + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.RelevantVisualAcuity + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + leftEye + + + + de.averbis.types.health.VisualAcuityValue + + + + + + rightEye + + + + de.averbis.types.health.VisualAcuityValue + + + + + + + + + + de.averbis.types.health.Specimen + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + descriptions + + + + uima.cas.StringArray + + true + + + + + + diagnosis + + + + de.averbis.types.health.Diagnosis + + + + + + identifier + + + + uima.cas.String + + + + + + laterality + + + + uima.cas.String + + + + + + morphology + + + + de.averbis.types.health.Morphology + + + + + + topography + + + + de.averbis.types.health.Topography + + + + + + + + + + de.averbis.types.health.Strength + + + + de.averbis.types.health.Concept + + + + + + value + + + + uima.cas.Double + + + + + + dimension + + + + uima.cas.String + + + + + + normalizedUnit + + + + uima.cas.String + + + + + + normalizedValue + + + + uima.cas.Double + + + + + + unit + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.TNMAdditional + + + + de.averbis.types.health.TNMEntity + + + + + + de.averbis.types.health.TNMBasic + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + value + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.TNMElement + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + value + + + + uima.cas.String + + + + + + prefix + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.TNMEntity + + + + de.averbis.types.health.TNMBasic + + + + + + label + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.TNMGrading + + + + de.averbis.types.health.TNMElement + + + + + + de.averbis.types.health.TNMMetastasis + + + + de.averbis.types.health.TNMElement + + + + + + de.averbis.types.health.TNMModifier + + + + de.averbis.types.health.TNMBasic + + + + + + de.averbis.types.health.TNMNode + + + + de.averbis.types.health.TNMElement + + + + + + de.averbis.types.health.TNMPostModifier + + + + de.averbis.types.health.TNMBasic + + + + + + de.averbis.types.health.TNMTumor + + + + de.averbis.types.health.TNMElement + + + + + + de.averbis.types.health.TTY + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + kind + + + + uima.cas.String + + + + + + code + + + + uima.cas.String + + + + + + description + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Tensio + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + leftEye + + + + de.averbis.types.health.Measurement + + + + + + rightEye + + + + de.averbis.types.health.Measurement + + + + + + + + + + de.averbis.types.health.TimeMeasurementDoseFrequency + + + + de.averbis.types.health.DoseFrequency + + + + + + de.averbis.types.health.Timex3 + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + kind + + + + uima.cas.String + + + + + + value + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.Topography + + + + de.averbis.types.health.Concept + + + + + + confidence + + + + uima.cas.Double + + + + + + + + + + de.averbis.types.health.TumorCategory + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + confidence + + + + uima.cas.Double + + + + + + label + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.TumorStage + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + modifier + + + + uima.cas.String + + + + + + stage + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.TumorThickness + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + value + + + + uima.cas.Double + + + + + + unit + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.VisualAcuity + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + leftEye + + + + de.averbis.types.health.VisualAcuityValue + + + + + + rightEye + + + + de.averbis.types.health.VisualAcuityValue + + + + + + + + + + de.averbis.types.health.VisualAcuityAdditionalInformation + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + normalized + + + + uima.cas.String + + + + + + + + + + de.averbis.types.health.VisualAcuityValue + + + + de.averbis.types.health.ExternalCoreAnnotation + + + + + + additionalInformation + + + + de.averbis.types.health.VisualAcuityAdditionalInformation + + + + + + correction + + + + uima.cas.String + + + + + + fact + + + + uima.cas.String + + + + + + meter + + + + uima.cas.Boolean + + + + + + pinHole + + + + uima.cas.Boolean + + + + + + refraction + + + + de.averbis.types.health.Refraction + + + + + + + + + + de.averbis.types.health.WeekDayDoseFrequency + + + + de.averbis.types.health.DoseFrequency + + + + + + uima.tcas.DocumentAnnotation + + + + uima.tcas.Annotation + + + + + + language + + + + uima.cas.String + + + + + + + + + + diff --git a/inception_ahd_recommender/tests/test_external_server_consumer.py b/inception_ahd_recommender/tests/test_external_server_consumer.py deleted file mode 100644 index eb97214..0000000 --- a/inception_ahd_recommender/tests/test_external_server_consumer.py +++ /dev/null @@ -1,23 +0,0 @@ -import pathlib - -import cassis -import pytest - -from ariadne.contrib.external_server_consumer import MappingConsumer, ProcessorType - -_config = "../prefab-mapping-files/general_mapping_singlelayer.json" - -@pytest.fixture -def cas_mapping_consumer(): - return MappingConsumer(config=_config, processor=ProcessorType.CAS) - -@pytest.fixture -def typesystem(): - return cassis.load_typesystem(pathlib.Path("resources/albers_TypeSystem.xml")) - -@pytest.fixture -def cas_server_response(typesystem): - return cassis.load_cas_from_xmi(pathlib.Path("resources/Albers.txt.xmi"), typesystem=typesystem) - -def test_mapping_consumer(cas_mapping_consumer, cas_server_response): - cas_mapping_consumer.process(cas_server_response) \ No newline at end of file diff --git a/inception_ahd_recommender/tests/test_recommender.py b/inception_ahd_recommender/tests/test_recommender.py new file mode 100644 index 0000000..65cb2ae --- /dev/null +++ b/inception_ahd_recommender/tests/test_recommender.py @@ -0,0 +1,56 @@ +import logging +import pathlib + +import cassis +import pytest + +from ariadne.contrib.external_server_consumer import MappingConsumer, ProcessorType +from ariadne.contrib.external_uima_classifier import add_prediction_to_cas + +logging.getLogger().setLevel(logging.INFO) +scenario_dict = { + "general": { + "xmi": "resources/Baastrup.general.xmi", + "ts": "resources/general_TypeSystem.xml", + "mapping": "../prefab-mapping-files/general_mapping_singlelayer.json", + "layer": "Core", + "feature": "kind" + }, + "deid": { + "xmi": "resources/Albers.deid.xmi", + "ts": "resources/deid_TypeSystem.xml", + "mapping": "../prefab-mapping-files/deid_mapping_singlelayer.json", + "layer": "PHI", + "feature": "kind" + } +} +scenario_switch = "general" + +@pytest.fixture +def cas_mapping_consumer(): + return MappingConsumer(config=scenario_dict.get(scenario_switch).get("mapping"), processor=ProcessorType.CAS) + +@pytest.fixture +def typesystem(): + return cassis.load_typesystem(pathlib.Path(scenario_dict.get(scenario_switch).get("ts"))) + +@pytest.fixture +def cas_server_response(typesystem): + return cassis.load_cas_from_xmi(pathlib.Path(scenario_dict.get(scenario_switch).get("xmi")), typesystem=typesystem) + +def test_mapping_consumer(cas_mapping_consumer, cas_server_response): + logging.info(cas_mapping_consumer.process(cas_server_response).features) + +def test_add_prediction_to_cas(cas_mapping_consumer, cas_server_response, typesystem): + add_prediction_to_cas( + cas=cassis.Cas( + typesystem=typesystem, + sofa_string=cas_server_response.sofa_string + ), + layer=scenario_dict.get(scenario_switch).get("layer"), + feature=scenario_dict.get(scenario_switch).get("feature"), + project_id="0", + document_id="0", + user_id="0", + response=cas_mapping_consumer.process(cas_server_response) + ) \ No newline at end of file