Skip to content

Commit

Permalink
Restructure Alz extraction template; split into two variants (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh authored Jun 28, 2024
2 parents 98a25a6 + d3ac2a4 commit bd74181
Show file tree
Hide file tree
Showing 4 changed files with 596 additions and 78 deletions.
35 changes: 16 additions & 19 deletions src/ontogpt/templates/alzrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,22 @@ class AnnotatorResult(ConfiguredBaseModel):


class Document(NamedEntity):
sections: Optional[List[DocumentSection]] = Field(default_factory=list, description="""A semicolon-separated list of full sections of the document. If semicolons are present in the section text, they should be replaced with (SEMICOLON) to avoid parsing errors. A section is a major division of the document, such as an abstract, introduction, methods, results, discussion, or conclusion, or a subsection of one of these. The text should include the section title. A single phrase or ID is not a section. Do not format in Markdown.""")
summary: Optional[str] = Field(None, description="""A brief summary of the input text, suitable for display in a table of contents or search results. This should be no more than three sentences. Do not format in Markdown.""")
article_type: Optional[str] = Field(None, description="""The type of article, e.g., \"research article\", \"review\", \"case report\".""")
modeling_approach: Optional[str] = Field(None, description="""A brief description of the modeling approach used in the input text, e.g., \"experimental\", \"observational\", \"computational\", \"review\".""")
modeling_summary: Optional[str] = Field(None, description="""A brief summary of the modeling approach used in the input text, suitable for display in a table of contents or search results. Include any details about how a model of disease is defined, including the use of model organisms, cell lines, or in silico models, as well as the experimental metrics used to model human disease. If this is a study of human subjects, include details about the study design and the human subjects involved. This should be no more than three sentences. Do not format in Markdown.""")
taxa: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of taxa or species of organisms mentioned in the input text. Where possible, translate to the binomial species name (e.g., change \"mouse\" to \"Mus musculus\"), unless a different species name is provided in the text. If no taxon is mentioned, return NOT FOUND.""")
diagnostics: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of diagnostic procedures mentioned in the input text. If no diagnostic procedures are mentioned, return NOT FOUND.""")
diseases: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of diseases or conditions mentioned in the input text. If no diseases are mentioned, return NOT FOUND.""")
chemical: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of chemicals, drugs, or other substances mentioned in the input text. If no chemicals are mentioned, return NOT FOUND.""")
environmental_exposures: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of environmental exposures mentioned in the input text. These may include exposure to general classes of materials, e.g., \"exposure to pesticides\", or other phenomena, e.g., \"chronic stress\". If no environmental exposures are mentioned, return NOT FOUND.""")
experimental_metrics_and_indicators: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of of experimental metrics, signs, symptoms, or outcomes used to measure the progression of Alzheimer's disease and related dementias, mentioned in the input text. These may be quantitative or qualitative measures, including biomolecular assays. In experimental animal models these are analogues of cognitive impairment or indicators of disease progression modeling those observed in humans. Examples are Amyloid beta (Aβ) levels, Morris water maze test, tau phosphorylation, neurofibrillary tangles, and cognitive decline. If no experimental metrics are mentioned, return NOT FOUND.""")
experimental_metrics_to_taxon_relationships: Optional[List[ExperimentalMetricToTaxonRelationship]] = Field(default_factory=list, description="""Semicolon-separated list of relationships between a specific experimental metric, sign, symptom, or outcome and a taxon, as described in the input text. These are cases in which the relationship is used to measure progression of Alzheimer's disease and related dementias, or an experimental analogue, in the taxon. For example, \"Amyloid beta (Aβ) levels are measured in Mus musculus\" or \"Morris water maze test is measured with Rattus norvegicus\".""")
experimental_metric_to_disease_relationships: Optional[List[ExperimentalMetricToDiseaseRelationship]] = Field(default_factory=list, description="""Semicolon-separated list of relationships between a specific experimental metric, sign, symptom, or outcome and a disease or condition, as described in the input text. These are cases in which the relationship is used as an experimental model of progression or presence of a disease. For example, \"Amyloid beta (Aβ) levels are used to model Alzheimer's disease\" or \"Morris water maze test is used to model Parkinson's disease\".""")
id: str = Field(..., description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")


class DocumentSection(CompoundExpression):
taxon: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of taxa or species of organisms mentioned in the section. Where possible, translate to the binomial species name (e.g., change \"mouse\" to \"Mus musculus\"), unless a different species name is provided in the text.""")
part_of: Optional[str] = Field(None, description="""The major document division that this section is a part of. Examples are \"introduction\", \"methods\", \"results\", \"discussion\", or \"conclusions\". Do not format in Markdown.""")
summary: Optional[str] = Field(None, description="""A brief summary of the section, suitable for display in a table of contents or search results. This should be a single sentence or phrase, not a full paragraph. Do not format in Markdown.""")
diagnostics: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of diagnostic procedures mentioned in the section. If no diagnostic procedures are mentioned, return NONE.""")
diseases: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of diseases or conditions mentioned in the section. If no diseases are mentioned, return NONE.""")
chemical: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of chemicals, drugs, or other substances mentioned in the section. If no chemicals are mentioned, return NONE.""")
environmental_exposures: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of environmental exposures mentioned in the section. These may include exposure to general classes of materials, e.g., \"exposure to pesticides\", or other phenomena, e.g., \"chronic stress\". If no environmental exposures are mentioned, return NONE.""")
experimental_metrics_and_indicators: Optional[List[str]] = Field(default_factory=list, description="""A semicolon-separated list of of a experimental metrics, signs, symptoms, or outcomes used to measure the progression of Alzheimer's disease and related dementias. These may be quantitative or qualitative measures, including biomolecular assays. In experimental animal models these are analogues of cognitive impairment or indicators of disease progression modeling those observed in humans. Examples are Amyloid beta (Aβ) levels, Morris water maze test, tau phosphorylation, neurofibrillary tangles, and cognitive decline. If no experimental metrics are mentioned, return NONE.""")
experimental_metrics_to_taxon_relationships: Optional[List[ExperimentalMetricToTaxonRelationship]] = Field(default_factory=list, description="""Semicolon-separated list of relationships between a specific experimental metric, sign, symptom, or outcome and a taxon, where the relationship is used to measure progression of Alzheimer's disease and related dementias, or an experimental analogue, in the taxon. For example, \"Amyloid beta (Aβ) levels are measured in Mus musculus\" or \"Morris water maze test is measured with Rattus norvegicus\".""")
experimental_metric_to_disease_relationships: Optional[List[ExperimentalMetricToDiseaseRelationship]] = Field(default_factory=list, description="""Semicolon-separated list of relationships between a specific experimental metric, sign, symptom, or outcome and a disease or condition, where the relationship is used as an experimental model of progression or presence of a disease. For example, \"Amyloid beta (Aβ) levels are used to model Alzheimer's disease\" or \"Morris water maze test is used to model Parkinson's disease\".""")


class MetricOrIndicator(NamedEntity):
id: str = Field(..., description="""A unique identifier for the named entity""")
label: Optional[str] = Field(None, description="""The label (name) of the named thing""")
Expand Down Expand Up @@ -178,8 +176,8 @@ class ExperimentalMetricToTaxonRelationship(Triple):
predicate: Optional[str] = Field(None, description="""The relationship type, generally MEASURED_IN to indicate a metric is measured in a taxon.""")
object: Optional[str] = Field(None, description="""The taxon or species of the model organism in which the experimental metric is measured. For example, Mus musculus, Rattus norvegicus.""")
qualifier: Optional[str] = Field(None, description="""A qualifier for the statements, e.g. \"NOT\" for negation""")
subject_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the taxon. This may include a strain or genetic background of the model organism.""")
object_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the experimental metric. This may include the method of measurement or the specific assay used.""")
subject_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the taxon, as described in the input text. This may include a strain or genetic background of the model organism.""")
object_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the experimental metric, as described in the input text. This may include the method of measurement or the specific assay used.""")


class ExperimentalMetricToDiseaseRelationship(Triple):
Expand All @@ -190,8 +188,8 @@ class ExperimentalMetricToDiseaseRelationship(Triple):
predicate: Optional[str] = Field(None, description="""The relationship type, generally USED_TO_MODEL to indicate a metric is used to model a disease or condition.""")
object: Optional[str] = Field(None, description="""The name of a disease or condition. Examples are Alzheimer's disease, Parkinson's disease, Huntington's disease.""")
qualifier: Optional[str] = Field(None, description="""A qualifier for the statements, e.g. \"NOT\" for negation""")
subject_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the experimental metric. This may include the method of measurement or the specific assay used.""")
object_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the disease or condition. This may include the stage or subtype of the disease.""")
subject_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the experimental metric, as described in the input text. This may include the method of measurement or the specific assay used.""")
object_qualifier: Optional[str] = Field(None, description="""An optional qualifier or modifier for the disease or condition, as described in the input text. This may include the stage or subtype of the disease.""")


# Model rebuild
Expand All @@ -206,7 +204,6 @@ class ExperimentalMetricToDiseaseRelationship(Triple):
Publication.model_rebuild()
AnnotatorResult.model_rebuild()
Document.model_rebuild()
DocumentSection.model_rebuild()
MetricOrIndicator.model_rebuild()
Diagnostic.model_rebuild()
Disease.model_rebuild()
Expand Down
Loading

0 comments on commit bd74181

Please sign in to comment.