Closed yingxuepanyaleedu closed 6 months ago
Hi @yingxuepanyaleedu - I was able to reproduce this error.
It looks like grounding happens part of the way (e.g., with your input, I saw that Elevated liver function tests
gets grounded to SNOMEDCT:75540009
, which just corresponds to the elevated
part and not the rest of that phrase) but then uses an incorrect normalizer.
Looking into it.
Here's a workaround for now: comment out or remove the slot_usage
section from ConditionProblemDiagnosis
. The problem is caused by OntoGPT trying to expand the range of potential values defined in ConditionProblemDiagnosisIdentifier
, but right now it doesn't know how to do that for ontologies from Bioportal.
This likely isn't ideal as I see you just want SNOMEDCT terms from clinical finding
, and I suspect there's still another way to get this result (it may involve a bugfix in the oaklib
package).
You may also want to capture multiple conditions for a note - with the current schema, the extracted object will only include one. Modified example schema in the next comment:
id: http://w3id.org/ontogpt/condition
name: condition
title: condition FHIR Template
description: >-
A FHIR-compliant template for conditions mentioned in a clinical note
license: https://creativecommons.org/publicdomain/zero/1.0/
prefixes:
linkml: https://w3id.org/linkml/
condition: http://w3id.org/ontogpt/condition/
SNOMEDCT: http://purl.bioontology.org/ontology/SNOMEDCT
default_prefix: UNKNOWN
imports:
- linkml:types
- core
classes:
ConditionSet:
tree_root: true
attributes:
conditions:
range: Condition
multivalued: true
inlined_as_list: true
Condition:
#is_a: NamedEntity
attributes:
label:
description: The concise name of the condition, problem, or diagnosis.
clinical_status:
description: The clinical status of the condition.
range: ConditionClinicalStatus
ifabsent: string("unknown")
severity:
description: Subjective severity of condition.
range: ConditionDiagnosisSeverity
ifabsent: string("unknown")
code:
description: The condition, problem, or diagnosis found in this note.
range: ConditionProblemDiagnosis
ifabsent: string("unknown")
ConditionProblemDiagnosis:
is_a: NamedEntity
id_prefixes:
- SNOMEDCT
annotations:
annotators: bioportal:SNOMEDCT
# slot_usage:
# id:
# values_from:
# - ConditionProblemDiagnosisIdentifier
enums:
ConditionClinicalStatus:
permissible_values:
active:
description: The subject is currently experiencing the condition or situation, there is evidence of the condition or situation, or considered to be a significant risk.
recurrence:
description: The subject is experiencing a reoccurence or repeating of a previously resolved condition or situation, e.g. urinary tract infection, food insecurity.
relapse:
description: The subject is experiencing a return of a condition or situation after a period of improvement or remission, e.g. relapse of cancer, alcoholism.
inactive:
description: The subject is no longer experiencing the condition or situation and there is no longer evidence or appreciable risk of the condition or situation.
remission:
description: The subject is not presently experiencing the condition or situation, but there is a risk of the condition or situation returning.
resolved:
description: The subject is not presently experiencing the condition or situation and there is a negligible perceived risk of the condition or situation returning.
unknown:
description: The authoring/source system does not know which of the status values currently applies for this condition.
ConditionDiagnosisSeverity:
permissible_values:
severe:
meaning: SNOMEDCT:24484000
moderate:
meaning: SNOMEDCT:6736007
mild:
meaning: SNOMEDCT:255604002
ConditionProblemDiagnosisIdentifier:
reachable_from:
source_ontology: bioportal:SNOMEDCT
source_nodes:
- SNOMEDCT:404684003 ## clinical finding
With your input in discharge.txt
and this command:
ontogpt -vvv extract -i discharge1.txt -t condition -m MODEL_GPT_4_0125_PREVIEW
I get:
extracted_object:
conditions:
- label: Left malignant pleural effusion
clinical_status: unknown
severity: severe
code: SNOMEDCT:7771000
- label: Respiratory Failure
clinical_status: unknown
code: SNOMEDCT:409622000
- label: Postobstructive Pneumonia
clinical_status: unknown
code: SNOMEDCT:371072008
- label: Gastrointestinal bleed
clinical_status: unknown
code: AUTO:Gastrointestinal%20bleed
- label: Thrombocytopenia
clinical_status: unknown
code: SNOMEDCT:302215000
- label: Acute Renal Failure
clinical_status: unknown
code: AUTO:Acute%20Renal%20Failure
- label: Hyponatremia
clinical_status: unknown
code: SNOMEDCT:89627008
- label: Non-small cell lung CA
clinical_status: active
code: SNOMEDCT:264885008
- label: Leukemoid Reaction
clinical_status: unknown
code: SNOMEDCT:56478004
- label: Elevated Liver Function Tests
clinical_status: unknown
code: SNOMEDCT:75540009
named_entities:
- id: SNOMEDCT:7771000
label: Left malignant pleural effusion
- id: SNOMEDCT:409622000
label: Respiratory failure secondary to above
- id: SNOMEDCT:371072008
label: Likely postobstructive pneumonia
- id: AUTO:Gastrointestinal%20bleed
label: Gastrointestinal bleed
- id: SNOMEDCT:302215000
label: Thrombocytopenia
- id: AUTO:Acute%20Renal%20Failure
label: Acute Renal Failure
- id: SNOMEDCT:89627008
label: Hyponatremia
- id: SNOMEDCT:264885008
label: Non-small cell lung CA, possible metastases to the bones
- id: SNOMEDCT:56478004
label: Leukemoid reaction, likely secondary to malignancy
- id: SNOMEDCT:75540009
label: Elevated liver function tests
Some of the codes assignments, like SNOMEDCT:7771000
are not quite right and the clinical statuses may not quite align with what you're looking for, but the extraction is more comprehensive.
Great use of ifabsent
in the schema, by the way!
I've narrowed this down to a specific bug and will close this issue in favor of a new one.
Hi @caufieldjh, I encountered a bug with my custom schema. I am trying to use SNOMEDCT as my annotator and when I run the
extract
command with my template and input text, I get the following error. I have checked that my bioportal API key is set correctly and the database URL SNOMED CT seems correct too. I have no idea how to resolve this error. Can you please provide some guidance? I would really appreciate any help.My schema looks like this
And here is one of my input text