sujataprakashdatycs commited on
Commit
a997108
·
verified ·
1 Parent(s): 58fcbd6

Update PatientInfoExtractionEngine.py

Browse files
Files changed (1) hide show
  1. PatientInfoExtractionEngine.py +15 -8
PatientInfoExtractionEngine.py CHANGED
@@ -53,17 +53,23 @@ class PatientInfoExtractionEngine:
53
  )
54
 
55
  # Task 1: Demographics Extraction
 
56
  self.demographics_task = Task(
57
  description=(
58
- "Extract patient demographics from the patient chart including:\n"
 
 
 
 
 
59
  "- name\n"
60
  "- dob (date of birth)\n"
61
  "- age\n"
62
  "- gender\n"
63
- "- address (patient address only if present in chart,don't add any hospital name or medical centre name)\n\n"
64
  "- phone\n"
65
  "- patient_identifier (may appear as patient ID, MRN, or insurance ID in the chart)\n\n"
66
- "Return only a JSON object in the following format:\n"
67
  "{\n"
68
  " 'name': '',\n"
69
  " 'dob': '',\n"
@@ -74,14 +80,15 @@ class PatientInfoExtractionEngine:
74
  " 'patient_identifier': ''\n"
75
  "}\n\n"
76
  "Rules:\n"
77
- "- Only include values that are explicitly present in the chart.\n"
 
 
78
  "- If a value is missing or not mentioned, leave it as an empty string.\n"
79
- "- Do not hallucinate or guess missing information."
80
  ),
81
- expected_output="JSON object with demographics fields only, leaving missing ones empty.",
82
- agent=self.patient_info_agent,
83
  )
84
-
85
  # Combine agents and tasks in Crew
86
  self.crew = Crew(
87
  agents=[self.patient_info_agent],
 
53
  )
54
 
55
  # Task 1: Demographics Extraction
56
+
57
  self.demographics_task = Task(
58
  description=(
59
+ "Extract patient demographics from the patient chart. "
60
+ "All patient demographic information is usually located together in one section "
61
+ "(for example, at the beginning or in a 'Patient Information' block). "
62
+ "Extract details only from that section — do NOT search or aggregate information "
63
+ "from multiple parts of the chart.\n\n"
64
+ "Fields to extract:\n"
65
  "- name\n"
66
  "- dob (date of birth)\n"
67
  "- age\n"
68
  "- gender\n"
69
+ "- address (only patient’s residential address; exclude any hospital or medical centre names)\n"
70
  "- phone\n"
71
  "- patient_identifier (may appear as patient ID, MRN, or insurance ID in the chart)\n\n"
72
+ "Return the result strictly as a JSON object in the format:\n"
73
  "{\n"
74
  " 'name': '',\n"
75
  " 'dob': '',\n"
 
80
  " 'patient_identifier': ''\n"
81
  "}\n\n"
82
  "Rules:\n"
83
+ "- Extract data only from the section where all patient demographic information is grouped together.\n"
84
+ "- Do not collect or merge values scattered across different notes or sections.\n"
85
+ "- Only include values explicitly mentioned in the chart.\n"
86
  "- If a value is missing or not mentioned, leave it as an empty string.\n"
87
+ "- Do not hallucinate, infer, or guess missing details."
88
  ),
89
+ expected_output="A JSON object containing the extracted patient demographics.",
90
+ agent=self.patient_info_agent,
91
  )
 
92
  # Combine agents and tasks in Crew
93
  self.crew = Crew(
94
  agents=[self.patient_info_agent],