extract_all

RadReportExtractor.extract_all(text: str, include_key: bool = False, **kwargs)

Extract all sections from the radiology report text.

This is the top-level method for the RadReportExtractor() class. It extracts all available sections from the input text and returns them in a RadReport() object.

Parameters

Name Type Description Default
text str The input radiology report text required
include_key bool Whether to include section keys in output, by default False False
**kwargs Parameters passed to all child functions {}

Returns

Name Type Description
RadReport A RadReport object containing all extracted sections

Examples

from radreportparser import RadReportExtractor

extractor = RadReportExtractor()

text = '''
EMERGENCY MDCT OF THE BRAIN

HISTORY: 25-year-old female presents with headache. Physical examination reveals no focal neurological deficits.

TECHNIQUE: Axial helical scan of the brain performed using 2.5-mm (brain) and 1.25-mm (bone) slice thickness with coronal and sagittal reconstructions.

COMPARISON: None.

FINDINGS:
Cerebral parenchyma: Age-appropriate brain volume with normal parenchymal attenuation and gray-white differentiation. No acute large territorial infarction or intraparenchymal hemorrhage identified.

Cerebellum and posterior fossa: Normal.

Extraaxial spaces: No extra-axial collection.

Ventricles: Normal size. No intraventricular hemorrhage.

Midline shift: None.

Brain herniation: None.

Vascular system: Normal.

Calvarium and scalp: No fracture identified.

Skull base, sella and temporomandibular joints (TMJs): Normal.

Visualized orbits, paranasal sinuses and mastoid air cells: Unremarkable.

Visualized upper cervical spine: No fracture identified.

IMPRESSION:
- No intracranial hemorrhage, acute large territorial infarction, extra-axial collection, midline shift, brain herniation, or skull fracture identified.
'''

report = extractor.extract_all(text)
report
RadReport(title='EMERGENCY MDCT OF THE BRAIN', history='25-year-old female presents with headache. Physical examination reveals no focal neurological deficits.', technique='Axial helical scan of the brain performed using 2.5-mm (brain) and 1.25-mm (bone) slice thickness with coronal and sagittal reconstructions.', comparison='None.', findings='Cerebral parenchyma: Age-appropriate brain volume with normal parenchymal attenuation and gray-white differentiation. No acute large territorial infarction or intraparenchymal hemorrhage identified.\n\nCerebellum and posterior fossa: Normal.\n\nExtraaxial spaces: No extra-axial collection.\n\nVentricles: Normal size. No intraventricular hemorrhage.\n\nMidline shift: None.\n\nBrain herniation: None.\n\nVascular system: Normal.\n\nCalvarium and scalp: No fracture identified.\n\nSkull base, sella and temporomandibular joints (TMJs): Normal.\n\nVisualized orbits, paranasal sinuses and mastoid air cells: Unremarkable.\n\nVisualized upper cervical spine: No fracture identified.', impression='- No intracranial hemorrhage, acute large territorial infarction, extra-axial collection, midline shift, brain herniation, or skull fracture identified.')

Report by Element

report.title
'EMERGENCY MDCT OF THE BRAIN'
report.history
'25-year-old female presents with headache. Physical examination reveals no focal neurological deficits.'
report.impression
'- No intracranial hemorrhage, acute large territorial infarction, extra-axial collection, midline shift, brain herniation, or skull fracture identified.'

Convert to dictionary

report.to_dict()
{'title': 'EMERGENCY MDCT OF THE BRAIN',
 'history': '25-year-old female presents with headache. Physical examination reveals no focal neurological deficits.',
 'technique': 'Axial helical scan of the brain performed using 2.5-mm (brain) and 1.25-mm (bone) slice thickness with coronal and sagittal reconstructions.',
 'comparison': 'None.',
 'findings': 'Cerebral parenchyma: Age-appropriate brain volume with normal parenchymal attenuation and gray-white differentiation. No acute large territorial infarction or intraparenchymal hemorrhage identified.\n\nCerebellum and posterior fossa: Normal.\n\nExtraaxial spaces: No extra-axial collection.\n\nVentricles: Normal size. No intraventricular hemorrhage.\n\nMidline shift: None.\n\nBrain herniation: None.\n\nVascular system: Normal.\n\nCalvarium and scalp: No fracture identified.\n\nSkull base, sella and temporomandibular joints (TMJs): Normal.\n\nVisualized orbits, paranasal sinuses and mastoid air cells: Unremarkable.\n\nVisualized upper cervical spine: No fracture identified.',
 'impression': '- No intracranial hemorrhage, acute large territorial infarction, extra-axial collection, midline shift, brain herniation, or skull fracture identified.'}

Convert to JSON

report.to_json()
'{"title": "EMERGENCY MDCT OF THE BRAIN", "history": "25-year-old female presents with headache. Physical examination reveals no focal neurological deficits.", "technique": "Axial helical scan of the brain performed using 2.5-mm (brain) and 1.25-mm (bone) slice thickness with coronal and sagittal reconstructions.", "comparison": "None.", "findings": "Cerebral parenchyma: Age-appropriate brain volume with normal parenchymal attenuation and gray-white differentiation. No acute large territorial infarction or intraparenchymal hemorrhage identified.\\n\\nCerebellum and posterior fossa: Normal.\\n\\nExtraaxial spaces: No extra-axial collection.\\n\\nVentricles: Normal size. No intraventricular hemorrhage.\\n\\nMidline shift: None.\\n\\nBrain herniation: None.\\n\\nVascular system: Normal.\\n\\nCalvarium and scalp: No fracture identified.\\n\\nSkull base, sella and temporomandibular joints (TMJs): Normal.\\n\\nVisualized orbits, paranasal sinuses and mastoid air cells: Unremarkable.\\n\\nVisualized upper cervical spine: No fracture identified.", "impression": "- No intracranial hemorrhage, acute large territorial infarction, extra-axial collection, midline shift, brain herniation, or skull fracture identified."}'