AI-powered EHR summarization using Transformer architecture to extract key clinical information from lengthy medical records
AI-powered EHR summarization using Transformer architecture to extract key clinical information from lengthy medical records. This skill processes lengthy Electronic Health Record (EHR) documents and generates structured, clinically accurate summaries.
Technical Difficulty: High
python scripts/main.py --input ehr_document.txt --output summary.json
{
"ehr_text": "Full EHR document text...",
"max_length": 300,
"extract_sections": ["allergies", "medications", "diagnoses", "family_history"]
}
{
"status": "success",
"data": {
"summary": "Structured bullet-point summary...",
"extracted_sections": {
"allergies": [...],
"medications": [...],
"diagnoses": [...],
"family_history": [...]
},
"metadata": {
"original_length": 2500,
"summary_length": 280,
"compression_ratio": 0.89
}
}
}
| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
--input, -i | string | - | Yes | Input EHR document text file path |
--output, -o | string | - | No | Output JSON file path |
--max-length | int | 300 | No | Maximum summary length in words |
--extract-sections | string | all | No | Comma-separated sections to extract |
--format | string | json | No | Output format (json, markdown, text) |
See references/requirements.txt for complete list.
Key dependencies:
references/requirements.txt - Python dependenciesreferences/guidelines.md - Clinical summarization guidelinesreferences/sample_input.json - Example input formatreferences/sample_output.json - Example output formatRun unit tests:
cd scripts
python test_main.py
All errors return semantic messages:
{
"status": "error",
"error": {
"type": "input_validation_error",
"message": "EHR text is empty or too short",
"suggestion": "Provide EHR text with at least 100 words"
}
}
| Risk Indicator | Assessment | Level |
|---|---|---|
| Code Execution | Python/R scripts executed locally | Medium |
| Network Access | No external API calls | Low |
| File System Access | Read input files, write output files | Medium |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | Output files saved to workspace | Low |
# Python dependencies
pip install -r requirements.txt