Exposure extraction¶
exposure_extraction.py finds environmental, occupational and other exposures studied as possible ALS risk factors, both from structured ICD-10-CM codes and from free text in notes and documents. Each category is linked to a term in the Environmental Conditions, Treatments and Exposures Ontology (ECTO) where one has been checked.
Exposure mentions in notes are often negated ("denies tobacco use") or about someone else ("father was a smoker"). Every text match is a candidate with a context cue and review_status set to needs_review.
Module source (exposure_extraction.py) Exposure dashboard demo
Coded records¶
Every coding on a record is checked. ICD-10-CM code titles were checked in November 2026.
| Category | ICD-10-CM codes |
|---|---|
| Smoking and tobacco | F17.200 to F17.290 (nicotine dependence), Z87.891 (history of nicotine dependence), Z57.31 and Z77.22 (environmental tobacco smoke) |
| Military service | Z91.82 (personal history of military deployment), Z56.82 (military deployment status) |
| Head trauma | Z87.820 (history of traumatic brain injury), S06.0X0A (concussion), S06.9X0A (unspecified intracranial injury) |
| Pesticides and agriculture | Z57.4 (occupational exposure to toxic agents in agriculture) |
| Heavy metals | Z77.010 (arsenic), Z77.011 (lead), Z77.018 (other hazardous metals) |
| Solvents and industrial chemicals | Z57.5, Z77.020 (aromatic amines), Z77.021 (benzene), Z77.028, Z77.098 |
| Asbestos | Z77.090 |
| Radiation | Z57.1, Z77.012 (uranium), Z77.123 (radon and other naturally occurring radiation) |
| Dusts and air contaminants | Z57.2, Z57.3, Z57.39 |
| Air, water and soil pollution | Z77.110, Z77.111, Z77.112 |
| Mold | Z77.120 |
| Cyanotoxins | Z77.121 (harmful algae and algae toxins) |
| Noise | Z57.0, Z77.122 |
| Other and unspecified | Z57.6 to Z57.9, Z77.118, Z77.128, Z77.21, Z77.29, Z77.9, Z65.8 |
These codes are seldom used in clinical practice, and most exposure information is written in social history sections. Read an absence of codes as an absence of codes, not of exposure.
Text patterns¶
| Category | What the patterns look for |
|---|---|
| Smoking | current or former smoker, pack-years, smokeless tobacco |
| Military service | military service; Gulf War, Operation Iraqi Freedom, Operation Enduring Freedom or Operation New Dawn deployment; Vietnam and Agent Orange; Camp Lejeune |
| Pesticides and agriculture | pesticides, herbicides or insecticides; organophosphates; paraquat; glyphosate; DDT; farming occupations |
| Heavy metals | lead, mercury, manganese (including welding fumes), arsenic, cadmium, heavy metals in general |
| Solvents and industrial chemicals | trichloroethylene (TCE) and perchloroethylene (PCE) with exposure context, benzene, formaldehyde, organic solvents, welding |
| Asbestos | asbestos exposure |
| Head trauma | traumatic brain injury or concussion history, football, other contact sports, blast injury |
| Electromagnetic fields and electrical work | electrical occupations and electromagnetic field exposure |
| Cyanotoxins | beta-methylamino-L-alanine (BMAA), cyanobacteria, blue-green algae |
| Mold | mold or mycotoxin exposure |
| Air pollution | particulate matter, diesel exhaust, traffic-related pollution |
| Occupational dust | silica, coal, wood, grain and cotton dust |
Some abbreviations have other meanings in ALS clinic notes, and the patterns are written to avoid them:
- NFL usually means neurofilament light chain, a blood biomarker, so it counts as football only with football words around it ("played in the NFL", "NFL career").
- PERC is also the Pulmonary Embolism Rule-out Criteria, so PCE matches need exposure context.
- TCE needs exposure, contamination or occupational context, so "TCE clinical trial" does not match.
ECTO terms¶
ECTO_CATEGORY_MAP gives each category a curation status:
| Status | Meaning |
|---|---|
verified |
An ECTO term is filled in and shown in the dashboard |
pending |
No term is filled in; the note says which term to look up |
catch_all |
A bucket for codes with no specific category; not an ECTO concept |
out_of_scope |
Exposures ECTO does not cover, such as psychosocial circumstances |
Terms filled in by the module:
| Category or agent | ECTO term | Label |
|---|---|---|
| Smoking (every smoking pattern) | ECTO:9000250 |
exposure to nicotine |
| Lead | ECTO:9000945 |
exposure to lead |
| Mercury | ECTO:0001571 |
exposure to mercury |
| Arsenic | ECTO:9000032 |
exposure to arsenic |
| Asbestos | ECTO:9000033 |
exposure to asbestos |
| Air pollution | ECTO:0000977 |
exposure to ultrafine respirable suspended particulate matter via inhalation |
ECTO terms change between releases. Before using them, check each against the current release in the EBI Ontology Lookup Service and fill in the pending categories with the closest term. ECTO is the terminology the GA4GH Phenopacket community uses for exposures.
Outputs¶
Both files are restricted: they hold participant IDs, dates and text. run_all.py writes them to restricted/.
exposure_codes.csv: patient_id, source_kind, source_id, code_system, code, recorded_display_name, forge_label (the code title from the module), category, effective_date.
exposure_extractions.csv: patient_id, source_kind, source_id, pattern, category, value, snippet, char_offset, description, ecto_seed (the agent-level ECTO term, where one is filled in), context_hint, review_status.
Running it¶
run_all.py runs exposure extraction and the exposure dashboard. To run it on its own:
import exposure_extraction
exposure_extraction.main(bundle_path='dashboard_data.json', out_root='restricted/')
Before using the results¶
- Read the context cue and the snippet for every candidate: negated and family-history mentions are common for smoking and military service.
- Check the patterns against social history sections from each contributing health system and add the phrasing you find.
- A mention of an exposure says nothing about dose, duration or timing; a study of exposure and ALS risk needs a structured exposure questionnaire or a validated assessment.