(no commit message)

This commit is contained in:
2025-11-04 11:01:43 -05:00
parent 8adeb14943
commit 0074689e91
2 changed files with 2 additions and 191 deletions

91
main.py
View File

@@ -1,100 +1,9 @@
from agent import PromptToSignatureAgent, PromptToSignatureConfig
from modaic import AutoAgent
agent = PromptToSignatureAgent(PromptToSignatureConfig())
CR_PROMPT = """ 1. Medical Record Information Extraction and Clinical Priority Classification
**INPUT FORMAT**: Raw clinical notes in free-text format, typically 200-2000 words, containing unstructured medical documentation from patient encounters including history, examination findings, diagnoses, treatment plans, and follow-up instructions.
**TASK DESCRIPTION**: You are a medical information extraction system. Analyze the provided clinical notes and perform comprehensive structured data extraction along with risk stratification. Your task involves multiple sub-tasks executed simultaneously.
**EXTRACTION REQUIREMENTS**:
- **Patient Demographics**: Extract full legal name, age (in years), biological sex/gender, date of birth (format: YYYY-MM-DD), medical record number (MRN) if present
- **Primary Diagnosis**: Identify the main diagnosis with corresponding ICD-10 code, include diagnostic certainty level (confirmed/suspected/rule-out)
- **Secondary Diagnoses**: List all comorbidities and additional conditions mentioned, each with ICD-10 codes where applicable
- **Medications**: Extract complete medication list including generic and brand names, dosages with units (mg, mcg, mL), frequency (BID, TID, QID, PRN), route of administration (PO, IV, IM, topical), and duration if specified
- **Allergies**: Document all allergies with allergen name, reaction type (rash, anaphylaxis, nausea, etc.), and severity classification (mild/moderate/severe/life-threatening)
- **Vital Signs**: Extract most recent measurements - blood pressure (systolic/diastolic in mmHg), heart rate (bpm), temperature (°F or °C with unit), respiratory rate (breaths/min), oxygen saturation (%), and pain score (0-10 scale)
- **Laboratory Results**: Identify all lab values mentioned with test name, numerical result, unit of measurement, reference range, and flag if abnormal (high/low/critical)
- **Appointments**: Extract scheduled follow-up dates, appointment types (follow-up, specialist referral, procedure), and provider names
**CLASSIFICATION REQUIREMENTS**:
- **Urgency Level**: Classify the case into one of four categories:
- ROUTINE: Stable patient, chronic condition management, no acute concerns
- URGENT: Requires attention within 24-48 hours, acute but not life-threatening condition
- EMERGENCY: Immediate intervention required, potentially life-threatening presentation
- CRITICAL: Life-threatening emergency requiring immediate intervention (ICU-level care)
**OUTPUT FORMAT**: Return the following schema as a pydantic model:
{
"patient_demographics": {
"name": "string",
"age": "integer",
"gender": "string",
"dob": "YYYY-MM-DD",
"mrn": "string or null"
},
"primary_diagnosis": {
"condition": "string",
"icd10_code": "integer",
"certainty": "confirmed|suspected|rule-out"
},
"secondary_diagnoses": [
{"condition": "string", "icd10_code": "string"}
],
"medications": [
{
"name": "string",
"dosage": "string",
"frequency": "string",
"route": "string",
"duration": "string or null"
}
],
"allergies": [
{
"allergen": "string",
"reaction": "string",
"severity": "mild|moderate|severe|life-threatening"
}
],
"vital_signs": {
"blood_pressure": "string (systolic/diastolic)",
"heart_rate": "integer",
"temperature": "float with unit",
"respiratory_rate": "integer",
"oxygen_saturation": "integer",
"pain_score": "integer (0-10)"
},
"lab_results": [
{
"test_name": "string",
"value": "float",
"unit": "string",
"reference_range": "string",
"flag": "normal|high|low|critical"
}
],
"appointments": [
{
"date": "YYYY-MM-DD",
"type": "string",
"provider": "string"
}
],
"urgency_classification": {
"level": "ROUTINE|URGENT|EMERGENCY|CRITICAL",
"reasoning": "string (brief explanation for classification)"
}
}
"""
agent = PromptToSignatureAgent(PromptToSignatureConfig())
def main():
agent.push_to_hub("fadeleke/prompt-to-signature", with_code=True)
if __name__ == "__main__":
main()