h-adminsim 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. h_adminsim/__init__.py +5 -0
  2. h_adminsim/admin_staff.py +280 -0
  3. h_adminsim/assets/configs/data4primary.yaml +47 -0
  4. h_adminsim/assets/configs/data4secondary.yaml +47 -0
  5. h_adminsim/assets/configs/data4tertiary.yaml +47 -0
  6. h_adminsim/assets/country/address.json +141859 -0
  7. h_adminsim/assets/country/country_code.json +244 -0
  8. h_adminsim/assets/departments/department.json +85 -0
  9. h_adminsim/assets/departments/symptom.json +4530 -0
  10. h_adminsim/assets/fhir.schema.json +75253 -0
  11. h_adminsim/assets/names/firstname.txt +1219 -0
  12. h_adminsim/assets/names/lastname.txt +88799 -0
  13. h_adminsim/assets/prompts/cancel_patient_system.txt +38 -0
  14. h_adminsim/assets/prompts/intake_staff_task_user.txt +16 -0
  15. h_adminsim/assets/prompts/intake_supervisor_system.txt +8 -0
  16. h_adminsim/assets/prompts/intake_supervisor_user.txt +31 -0
  17. h_adminsim/assets/prompts/reschedule_patient_system.txt +38 -0
  18. h_adminsim/assets/prompts/schedule_patient_rejected_system.txt +42 -0
  19. h_adminsim/assets/prompts/schedule_patient_system.txt +36 -0
  20. h_adminsim/assets/prompts/schedule_staff_reasoning.txt +57 -0
  21. h_adminsim/assets/prompts/schedule_staff_sc_tool_calling.txt +13 -0
  22. h_adminsim/assets/prompts/schedule_staff_system.txt +10 -0
  23. h_adminsim/assets/prompts/schedule_staff_tool_calling.txt +41 -0
  24. h_adminsim/client/__init__.py +3 -0
  25. h_adminsim/client/google_client.py +209 -0
  26. h_adminsim/client/openai_client.py +199 -0
  27. h_adminsim/client/vllm_client.py +160 -0
  28. h_adminsim/environment/__init__.py +1 -0
  29. h_adminsim/environment/hospital.py +462 -0
  30. h_adminsim/environment/op_scheduling_simulation.py +1126 -0
  31. h_adminsim/pipeline/__init__.py +3 -0
  32. h_adminsim/pipeline/data_generator.py +192 -0
  33. h_adminsim/pipeline/evaluator.py +33 -0
  34. h_adminsim/pipeline/simulation.py +231 -0
  35. h_adminsim/registry/__init__.py +5 -0
  36. h_adminsim/registry/errors.py +89 -0
  37. h_adminsim/registry/models.py +126 -0
  38. h_adminsim/registry/phrases.py +10 -0
  39. h_adminsim/registry/pydantic_models.py +21 -0
  40. h_adminsim/registry/variables.py +9 -0
  41. h_adminsim/supervisor.py +182 -0
  42. h_adminsim/task/agent_task.py +900 -0
  43. h_adminsim/task/fhir_manager.py +222 -0
  44. h_adminsim/task/schedule_assign.py +151 -0
  45. h_adminsim/tools/__init__.py +5 -0
  46. h_adminsim/tools/agent_data_builder.py +124 -0
  47. h_adminsim/tools/data_converter.py +536 -0
  48. h_adminsim/tools/data_synthesizer.py +365 -0
  49. h_adminsim/tools/evaluator.py +258 -0
  50. h_adminsim/tools/sanity_checker.py +216 -0
  51. h_adminsim/tools/scheduling_rule.py +420 -0
  52. h_adminsim/utils/__init__.py +136 -0
  53. h_adminsim/utils/common_utils.py +698 -0
  54. h_adminsim/utils/fhir_utils.py +190 -0
  55. h_adminsim/utils/filesys_utils.py +135 -0
  56. h_adminsim/utils/image_preprocess_utils.py +188 -0
  57. h_adminsim/utils/random_utils.py +358 -0
  58. h_adminsim/version.txt +1 -0
  59. h_adminsim-1.0.0.dist-info/LICENSE +30 -0
  60. h_adminsim-1.0.0.dist-info/METADATA +494 -0
  61. h_adminsim-1.0.0.dist-info/RECORD +62 -0
  62. h_adminsim-1.0.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,494 @@
1
+ Metadata-Version: 2.1
2
+ Name: h_adminsim
3
+ Version: 1.0.0
4
+ Summary: A Python package for simulating hospital administrative tasks.
5
+ License: BSD-3-Clause
6
+ Author: Jun-Min Lee
7
+ Author-email: ljm56897@gmail.com
8
+ Requires-Python: >=3.11,<3.13
9
+ Classifier: License :: OSI Approved :: BSD License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Dist: aiohttp (==3.9.0)
14
+ Requires-Dist: beautifulsoup4 (==4.13.5)
15
+ Requires-Dist: datasets (==2.16.1)
16
+ Requires-Dist: dotenv (==0.9.9)
17
+ Requires-Dist: fastapi (==0.115.12)
18
+ Requires-Dist: google-genai (==1.19.0)
19
+ Requires-Dist: langchain (==0.3.27)
20
+ Requires-Dist: langchain-google-genai (==2.1.8)
21
+ Requires-Dist: langchain-openai (==0.3.28)
22
+ Requires-Dist: matplotlib (==3.10.3)
23
+ Requires-Dist: numpy (==1.26.4)
24
+ Requires-Dist: openai (>=1.99.1,<=1.108.0)
25
+ Requires-Dist: orjson (==3.10.18)
26
+ Requires-Dist: patientsim (>=1.0.0,<2.0.0)
27
+ Requires-Dist: peft (==0.14.0)
28
+ Requires-Dist: pillow (==11.2.1)
29
+ Requires-Dist: sconf (==0.2.5)
30
+ Requires-Dist: streamlit (==1.45.1)
31
+ Requires-Dist: streamlit-chat (==0.1.1)
32
+ Requires-Dist: tqdm (==4.65.0)
33
+ Requires-Dist: transformers (>=4.53.2,<=4.56.1)
34
+ Requires-Dist: uvicorn (==0.34.3)
35
+ Requires-Dist: vllm (>=0.10.2,<0.11.0)
36
+ Project-URL: Source, https://github.com/ljm565/H-AdminSim
37
+ Description-Content-Type: text/markdown
38
+
39
+ # H-AdminSim
40
+
41
+ ---
42
+ ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/h-adminsim)
43
+ ![PyPI Version](https://img.shields.io/pypi/v/h-adminsim)
44
+ ![Downloads](https://img.shields.io/pypi/dm/h-adminsim)
45
+ ![DOI](https://img.shields.io/badge/DOI-10.48550/arXiv.2602.05407-blue)
46
+ ---
47
+
48
+ ## Overview 📚
49
+ H-AdminSim is an official Python package for simulating interactions between hospital administrative staff and first-visit outpatients using LLM agents.
50
+ It provides a standardized evaluation testbed for assessing LLM performance across key administrative tasks across multiple care levels (primary, secondary, and tertiary), with optional [FHIR](https://www.hl7.org/fhir/) integration and support for heterogeneous deployment environments, allowing flexible simulation workflows tailored to diverse hospital systems.
51
+
52
+ Large hospitals often handle 10,000+ outpatient encounters per day, and prior reports indicate limited specialization among administrative staff despite high workload.
53
+ H-AdminSim is designed to help address these challenges by offering a realistic, reproducible simulation environment that supports future hospital automation and LLM-assisted administrative workflows.
54
+
55
+ * Paper: https://arxiv.org/abs/2602.05407
56
+ * PyPI Package: https://pypi.org/project/h-adminsim/
57
+
58
+ &nbsp;
59
+
60
+
61
+
62
+ ### 1. Care level-specific data synthesis
63
+ We provide [configuration examples](https://github.com/ljm565/H-AdminSim/blob/master/src/h_adminsim/assets/configs/) for simulating primary, secondary, and tertiary care settings.
64
+ Each configuration reflects key characteristics of its hospital level:
65
+
66
+ * Hospital time granularity: `tertiary` < `secondary` = `primary` (coarser in lower levels)
67
+ * Number of departments: `primary` < `secondary` < `tertiary`
68
+ * Number of physicians: `primary` < `secondary` < `tertiary`
69
+ * Patient referral rate: `primary` < `secondary` < `tertiary`
70
+ * Proportion of patients with preferred `physician`/`date`: `primary` < `secondary` = `tertiary`
71
+
72
+ You may also define your own conditions using a custom configuration file (e.g., [data_synthesis.yaml](https://github.com/ljm565/H-AdminSim/blob/master/config/data_synthesis.yaml))
73
+
74
+
75
+ &nbsp;
76
+
77
+ ### 2. Hospital Administration Simulation
78
+ #### 2.1. Patient Intake Simulation
79
+ We extend the previously emergency department-focused [PatientSim](https://github.com/ljm565/patientsim-pkg) to enable realistic conversations between administrative staff and first-visit outpatients with diverse backgrounds.
80
+ * **Disease profile**: One of 194 disease–symptom pairs across 9 internal-medicine departments (`gastroenterology`, `cardiology`, `pulmonology`, `endocrinology/metabolism`, `nephrology`, `hematology/oncology`, `allergy`, `infectious diseases`, `rheumatology`)
81
+ * **Medical referral status**: Dialogue flow adapts based on whether the patient has a referral
82
+ * **Tasks**: Department recommendation, information extraction, structured data construction
83
+
84
+
85
+ #### 2.2. Appointment Scheduling Simulation
86
+ We simulate realistic scheduling interactions between administrative staff and patients, reflecting diverse scheduling behaviors and hospital-level constraints.
87
+ * **Time flow**: Users can define the simulation period and starting point, enabling the agent to perform time-related tasks based on the progression of simulated time.
88
+ * **Patient preferences**: `ASAP` (earliest slot), `physician` (specific physician requested), `date` (preferred date range start)
89
+ * **Random requests**: `cancellation`, `rescheduling`
90
+ * **Tasks**: New appointment scheduling, rescheduling, schdule cancellation
91
+
92
+
93
+ #### 2.3. FHIR Integration
94
+ We provide optional support for integrating with FHIR, allowing the simulator to operate flexibly across heterogeneous hospital environments as long as FHIR-compatible data is available. For instructions on running a FHIR server, please refer to the [FHIR Server Execution](https://github.com/ljm565/fhir_server) repository.
95
+
96
+ &nbsp;
97
+
98
+ &nbsp;
99
+
100
+ ---
101
+ ## Recent updates 📣
102
+ * *December 2025 (v1.0.0)*: H-AdminSim package has been released.
103
+ * *December 2025 (v0.7.2)*: Rule-based and tool calling-based scheduling logics have been supported.
104
+ * *November 2025 (v0.7.1)*: Self-corrective feedback logic has been supported.
105
+ * *October 2025 (v0.7.0)*: Simulation has been improved reflecting feedbacks from experts.
106
+ * *September 2025 (v0.6.0)*: Simulation has been improved reflecting feedbacks from experts.
107
+ * *August 2025 (v0.5.2)*: We has supported vLLM inference of the Hugging Face models.
108
+ * *August 2025 (v0.5.1)*: Now you can easily set the virtual environment using Poetry.
109
+ * *August 2025 (v0.5.0)*: We integrated the FHIR server to retrieve hospital information during hospital administration office agent simulation.
110
+ <!-- * *July 2025 (v0.4.2)*: We have supported LangChain's JsonOutputParser funtion as well as naive LLM API methods.
111
+ * *July 2025 (v0.4.1)*: Add functionality to schedule appointments based on the hospital's current time (the time the patient contacted for booking).
112
+ * *July 2025 (v0.4.0)*: Added a hospital simulation environment to enable rescheduling based on patient priority, flexibility, and other constraints.
113
+ * *July 2025 (v0.3.1)*: Added agent results evaluation codes.
114
+ * *July 2025 (v0.3.0)*: This repository has supported Gemini- and GPT-based LLM agent task testing: 'department', 'schedule', 'fhir_resource', 'fhir_api'.
115
+ * *June 2025 (v0.2.2)*: Added *PractitionerRole* resource type and function to make more realistic data.
116
+ * *June 2025 (v0.2.1)*: Fixed *Appointment* resource type error and added function to show failed files during creating data to FHIR.
117
+ * *June 2025 (v0.2.0)*: Added function to map synthetic data to some *workflow* resource types in FHIR.
118
+ * *June 2025 (v0.1.2)*: The data synthesis speed has been improved, and a sanity check feature has been added during synthesis.
119
+ * *June 2025 (v0.1.1)*: Added random patient data synthesizing codes and completed sanity check.
120
+ * *June 2025 (v0.1.0)*: Added random hospital data synthesizing codes and completed sanity check.
121
+ * *June 2025 (v0.0.5)*: Enhanced and fixed the FHIR manager operations.
122
+ * *June 2025 (v0.0.4)*: Updated documents (environment setting, CRUD guides)
123
+ * *June 2025 (v0.0.3)*: Now we has supported FHIR CRUD.
124
+ * *June 2025 (v0.0.2)*: Created chat demo `README.md`.
125
+ * *June 2025 (v0.0.1)*: Created chat demo codes using FastAPI communication. -->
126
+
127
+ &nbsp;
128
+
129
+ &nbsp;
130
+
131
+ ---
132
+ ## Quick Starts 🚀
133
+ ### 1. Installation
134
+ ```bash
135
+ pip install h_adminsim
136
+ ```
137
+ ```python
138
+ import h_adminsim
139
+ print(h_adminsim.__version__)
140
+ ```
141
+
142
+ &nbsp;
143
+
144
+ ### 2. Environment Variables
145
+ Before using the LLM API, you need to provide the API key (or the required environment variables for each model) either directly or in a `.env` file.
146
+ ```bash
147
+ # For GPT API without Azure
148
+ OPENAI_API_KEY=${YOUR_OPENAI_KEY}
149
+
150
+ # For Gemini API
151
+ GOOGLE_API_KEY=${YOUR_GEMINI_API_KEY"}
152
+ ```
153
+
154
+ &nbsp;
155
+
156
+ ### 3. Simulation
157
+ ```python
158
+ from h_adminsim import AdminStaffAgent, SupervisorAgent
159
+ from h_adminsim.pipeline import DataGenerator, Simulator
160
+ from h_adminsim.task.agent_task import OutpatientFirstIntake, OutpatientFirstScheduling
161
+
162
+ data_generator = DataGenerator()
163
+ data_generator.build(convert_to_fhir=True)
164
+ agent_data_dir = data_generator.save_dir / 'agent_data'
165
+ output_dir = data_generator.save_dir / 'simulation_results'
166
+
167
+ # Intake task
168
+ intake_task = OutpatientFirstIntake(
169
+ patient_model='gpt-5-nano',
170
+ admin_staff_model='gemini-2.5-flash',
171
+ )
172
+
173
+ # Scheduling task
174
+ scheduling_task = OutpatientFirstScheduling(
175
+ patient_model='gpt-5-nano',
176
+ admin_staff_model='gpt-5-mini',
177
+ )
178
+
179
+ # Simulation
180
+ simulator = Simulator(
181
+ intake_task=intake_task,
182
+ scheduling_task=scheduling_task,
183
+ )
184
+ simulator.run(
185
+ simulation_data_path=agent_data_dir,
186
+ output_dir=output_dir,
187
+ resume=False,
188
+ verbose=True
189
+ )
190
+ ```
191
+
192
+ &nbsp;
193
+
194
+ &nbsp;
195
+
196
+ ---
197
+ ## Components Details ⚙️
198
+ ### 1. Data synthesis
199
+ ```python
200
+ from h_adminsim.pipeline import DataGenerator
201
+
202
+ # 1. Generator Initialization
203
+ # 1.1. Default usaage
204
+ data_generator = DataGenerator() # Default: primary care
205
+ # data_generator = DateGenerator(level='secondary') # For secondary care
206
+ # data_generator = DateGenerator(level='tertiary') # For tertiary care
207
+
208
+ # 1.2. You can synthesize data with your own configuration
209
+ data_generator = DataGenerator(config='data_config.yaml')
210
+
211
+
212
+ # 2. Synthesizing Data
213
+ # 2.1. Default usage
214
+ data_generator.build()
215
+
216
+ # 2.2. When you want the synthesized data returned along with its FHIR-converted version (optional)
217
+ data_generator.build(convert_to_fhir=True)
218
+
219
+ # 2.3. When you want to upload the synthesized data to your own FHIR server (optional)
220
+ # Provide your FHIR server URL
221
+ data_generator.upload_to_fhir(
222
+ fhir_data_dir=data_generator.save_dir / "fhir_data",
223
+ fhir_url=${FHIR_URL},
224
+ )
225
+ ```
226
+ <details>
227
+ <summary>Configuration example for data synthesis</summary>
228
+
229
+ ```yaml
230
+ # Base
231
+ seed: 9999
232
+
233
+ # FHIR server url
234
+ fhir_url: http://localhost:8080/fhir # Optional: set your FHIR server URL here
235
+
236
+ # Data configs
237
+ project: ./synthetic_data/
238
+ data_name: hospital_small # Output path: ./synthetic_data/hospital_small/data
239
+ hospital_data:
240
+ hospital_n: 10 # Number of hospitals to synthesize
241
+ start_date:
242
+ min: 2025-03-17 # ISO format: YYYY-MM-DD
243
+ max: 2025-09-21
244
+ days: 7 # Simulation period (in days)
245
+ interval_hour: 0.25 # Time unit expressed in hours
246
+ start_hour: # Possible hospital opening hours
247
+ min: 9
248
+ max: 10
249
+ end_hour: # Possible hospital closing hours
250
+ min: 18
251
+ max: 19
252
+ department_per_hospital:
253
+ min: 7
254
+ max: 9
255
+ doctor_per_department:
256
+ min: 1
257
+ max: 1
258
+ working_days: # Number of days each doctor works during the simulation period
259
+ min: 3
260
+ max: 4
261
+ doctor_capacity_per_hour:
262
+ min: 1
263
+ max: 4
264
+ doctor_has_schedule_prob: 0 # Probability that a doctor has at least one fixed schedule
265
+ schedule_coverage_ratio: # Proportion of fixed schedules relative to total working hours
266
+ min: 0.4
267
+ max: 0.6
268
+ appointment_coverage_ratio: # Proportion of appointments scheduled outside fixed schedules
269
+ min: 0.2
270
+ max: 0.5
271
+ preference:
272
+ type: ['asap', 'doctor', 'date'] # Types of patient scheduling preferences
273
+ probs: [0.4, 0.4, 0.2] # Probability distribution for each preference type
274
+ symptom:
275
+ type: ['simple', 'with_history'] # 'simple' = no referral; 'with_history' = referral case
276
+ probs: [0.7, 0.3] # Probability distribution for symptom types
277
+ ```
278
+ </details>
279
+
280
+ &nbsp;
281
+
282
+ ### 2. Task Initialization
283
+ #### 2.1. Patient Intake
284
+ ```python
285
+ from h_adminsim import SupervisorAgent
286
+ from h_adminsim.task.agent_task import OutpatientFirstIntake
287
+
288
+ # 1. Patient Intake
289
+ # 1.1. Default usage (Staff-only)
290
+ intake_task = OutpatientFirstIntake(
291
+ patient_model='gpt-5-nano',
292
+ admin_staff_model='gpt-5-mini',
293
+ intake_max_inference=5, # Default: up to 5 rounds (10 turns) of dialogue
294
+ )
295
+ ##############################################################
296
+
297
+ # 1.2. Role separation
298
+ # Staff: dialogue handling, Supervisor: data collection and structuring
299
+ supervisor_agent = SupervisorAgent(
300
+ target_task='first_outpatient_scheduling',
301
+ model='gemini-2.5-flash',
302
+ api_key=${YOUR_API_KEY}, # You may set the API key here instead of using a .env file
303
+ )
304
+ intake_task = OutpatientFirstIntake(
305
+ patient_model='gemini-2.5-flash',
306
+ admin_staff_model='gpt-5',
307
+ supervisor_agent=supervisor_agent,
308
+ intake_max_inference=8,
309
+ )
310
+ ##############################################################
311
+
312
+ # 1.3. Advanced usage: vLLM
313
+ supervisor_agent = SupervisorAgent(
314
+ target_task='first_outpatient_scheduling',
315
+ model='meta-llama/Llama-3.3-70B-Instruct',
316
+ use_vllm=True, # Use a vLLM-hosted model as the supervisor
317
+ vllm_endpoint='http://0.0.0.0:8000', # vLLM server endpoint
318
+ )
319
+ intake_task = OutpatientFirstIntake(
320
+ patient_model='meta-llama/Llama-3.3-70B-Instruct',
321
+ admin_staff_model='meta-llama/Llama-3.3-70B-Instruct',
322
+ supervisor_agent=supervisor_agent,
323
+ intake_max_inference=5,
324
+ patient_vllm_endpoint='http://0.0.0.0:8000',
325
+ admin_staff_vllm_endpoint='http://0.0.0.0:8000',
326
+ )
327
+ ##############################################################
328
+ ```
329
+
330
+ &nbsp;
331
+
332
+ #### 2.2. Appointment Scheduling
333
+ ```python
334
+ from h_adminsim import AdminStaffAgent, SupervisorAgent
335
+ from h_adminsim.task.agent_task import OutpatientFirstScheduling
336
+
337
+ # 2. Appointment Scheduling
338
+ # 2.1. Default usage (Tool-calling with reasoning fallbacks)
339
+ scheduling_task = OutpatientFirstScheduling(
340
+ patient_model='gpt-5-nano',
341
+ admin_staff_model='gemini-2.5-flash',
342
+ schedule_cancellation_prob=0.05, # Cancellation event
343
+ request_early_schedule_prob=0.1, # Rescheduling event
344
+ preference_rejection_prob = 0.3, # Prob. of rejecting the first-priority scheduling preference
345
+ preference_rejection_prob_decay = 0.5, # Decay factor for the preference rejection prob.
346
+ scheduling_max_inference=5,
347
+ scheduling_strategy='tool_calling',
348
+ fhir_integration=False,
349
+ )
350
+ ##############################################################
351
+
352
+ # 2.2. LLM reasoning-based scheduling without tool-calling
353
+ scheduling_task = OutpatientFirstScheduling(
354
+ patient_model='gpt-5-nano',
355
+ admin_staff_model='gpt-5-mini',
356
+ schedule_cancellation_prob=0.05, # Cancellation event
357
+ request_early_schedule_prob=0.1, # Rescheduling event
358
+ preference_rejection_prob = 0.3, # Prob. of rejecting the first-priority scheduling preference
359
+ preference_rejection_prob_decay = 0.5, # Decay factor for the preference rejection prob.
360
+ scheduling_max_inference=5,
361
+ scheduling_strategy='reasoning',
362
+ fhir_integration=False,
363
+ )
364
+ ##############################################################
365
+
366
+ # 2.3. HIS upload via FHIR
367
+ scheduling_task = OutpatientFirstScheduling(
368
+ patient_model='gpt-5-nano',
369
+ admin_staff_model='gemini-2.5-flash',
370
+ schedule_cancellation_prob=0.05, # Cancellation event
371
+ request_early_schedule_prob=0.1, # Rescheduling event
372
+ preference_rejection_prob = 0.3, # Prob. of rejecting the first-priority scheduling preference
373
+ preference_rejection_prob_decay = 0.5, # Decay factor for the preference rejection prob.
374
+ scheduling_max_inference=5,
375
+ scheduling_strategy='tool_calling',
376
+ fhir_integration=True,
377
+ )
378
+ ##############################################################
379
+
380
+ # 2.4. Advanced usage: vLLM
381
+ scheduling_task = OutpatientFirstScheduling(
382
+ patient_model='meta-llama/Llama-3.3-70B-Instruct',
383
+ admin_staff_model='gpt-5-mini',
384
+ schedule_cancellation_prob=0.05, # Cancellation event
385
+ request_early_schedule_prob=0.1, # Rescheduling event
386
+ preference_rejection_prob = 0.3, # Prob. of rejecting the first-priority scheduling preference
387
+ preference_rejection_prob_decay = 0.5, # Decay factor for the preference rejection prob.
388
+ scheduling_max_inference=5,
389
+ scheduling_strategy='tool-calling', # Currently, we do not support tool-calling from vLLM
390
+ fhir_integration=False,
391
+ patient_vllm_endpoint='http://0.0.0.0:8000',
392
+
393
+ )
394
+ ##############################################################
395
+ ```
396
+
397
+ &nbsp;
398
+
399
+ ### 3. Simulation
400
+ ```python
401
+ from h_adminsim.pipeline import Simulator
402
+
403
+ # 3. Simulator initialization
404
+ # 3.1. Default usage
405
+ simulator = Simulator(
406
+ intake_task=intake_task,
407
+ scheduling_task=scheduling_task,
408
+ simulation_start_day_before=3,
409
+ fhir_integration=False,
410
+ fhir_url=None,
411
+ fhir_max_connection_retries=5,
412
+ random_seed=9999,
413
+ )
414
+ ##############################################################
415
+
416
+ # 3.2. FHIR integration
417
+ # (If enabled, scheduling task must be initialized with `fhir_integration=True`)
418
+ simulator = Simulator(
419
+ intake_task=intake_task,
420
+ scheduling_task=scheduling_task,
421
+ simulation_start_day_before=3,
422
+ fhir_integration=True,
423
+ fhir_url='http://localhost:8080/fhir',
424
+ fhir_max_connection_retries=5,
425
+ random_seed=9999,
426
+ )
427
+ ##############################################################
428
+
429
+
430
+ # 3.3. Running a single task
431
+ # 3.3.1. Intake task only
432
+ simulator = Simulator(
433
+ intake_task=intake_task,
434
+ scheduling_task=None,
435
+ simulation_start_day_before=3,
436
+ fhir_integration=False,
437
+ fhir_url=None,
438
+ fhir_max_connection_retries=5,
439
+ random_seed=9999,
440
+ )
441
+
442
+ # 3.3.2. Scheduling task only
443
+ simulator = Simulator(
444
+ intake_task=None,
445
+ scheduling_task=scheduling_task,
446
+ simulation_start_day_before=3,
447
+ fhir_integration=False,
448
+ fhir_url=None,
449
+ fhir_max_connection_retries=5,
450
+ random_seed=9999,
451
+ )
452
+ ##############################################################
453
+ ```
454
+ ```python
455
+ # Run the initialized simulator
456
+ simulator.run(
457
+ simulation_data_path='hospital_data/primary/agent_data',
458
+ output_dir='hospital_data/primary/simulation_results',
459
+ resume=False, # If the simulation stopped unexpectedly, set resume=True with the same paths
460
+ verbose=True,
461
+ )
462
+ ```
463
+
464
+
465
+ &nbsp;
466
+
467
+ &nbsp;
468
+
469
+ ---
470
+ ## Citation
471
+ For `H-AdminSim` and `PatientSim` outpatient simulation, please cite the following.
472
+ ```
473
+ @misc{lee2026hadminsimmultiagentsimulatorrealistic,
474
+ title={H-AdminSim: A Multi-Agent Simulator for Realistic Hospital Administrative Workflows with FHIR Integration},
475
+ author={Jun-Min Lee and Meong Hi Son and Edward Choi},
476
+ year={2026},
477
+ eprint={2602.05407},
478
+ archivePrefix={arXiv},
479
+ primaryClass={cs.AI},
480
+ url={https://arxiv.org/abs/2602.05407},
481
+ }
482
+ ```
483
+
484
+
485
+ <!--
486
+
487
+ ## More Details on Module Tests 🔍
488
+ 1. [Getting Started](https://github.com/ljm565/H-AdminSim/blob/master/docs/1_getting_started.md)
489
+ 2. [How to perform CRUD on FHIR](https://github.com/ljm565/H-AdminSim/blob/master/docs/2_fhir_crud.md)
490
+ 3. [Hospital Data Synthesis](https://github.com/ljm565/H-AdminSim/blob/master/docs/3_data_synthesis.md)
491
+ 4. [Agent Simulation](https://github.com/ljm565/H-AdminSim/blob/master/docs/4_agent_test.md) -->
492
+
493
+ &nbsp;
494
+
@@ -0,0 +1,62 @@
1
+ h_adminsim/__init__.py,sha256=Lk7ELdjAMLoCDYcQ6nd6OZzDHZ0uZ0X7e78F8zyRnzY,201
2
+ h_adminsim/admin_staff.py,sha256=kMRmq8GmpRsbcB08my3q-iwANmN3W6Jw3msQ_FqSFvc,12422
3
+ h_adminsim/assets/configs/data4primary.yaml,sha256=X5u6_51XfioGWVA9NU9Fz-RmxOmtW0HUGFyEse87_2Y,1562
4
+ h_adminsim/assets/configs/data4secondary.yaml,sha256=IsybVUiYXBJndZ7XSmMhDe6fFftBMGzQAWJJUX4c3Co,1564
5
+ h_adminsim/assets/configs/data4tertiary.yaml,sha256=ZIQWp3zOdXP-4JqTzdFpIWMHRVEB5OBbpXb9935QrZc,1564
6
+ h_adminsim/assets/country/address.json,sha256=OXpnOl1gms_y8jYbS1D7OtPHfkK-HIV2Fldf5ZnLZxU,4173651
7
+ h_adminsim/assets/country/country_code.json,sha256=0Ziz43a64L_UIKlGbJUVQVs0SoWLLTJIwhfjPx_5ymc,3597
8
+ h_adminsim/assets/departments/department.json,sha256=TsuNWoeiBBfhMAumUzvZyMIpp8hxH31KUzbSCyjM6ts,2844
9
+ h_adminsim/assets/departments/symptom.json,sha256=qsEpykkMR5fnOQZqjIjB-fpnW4u4VyrX6nifz3jr_sg,184305
10
+ h_adminsim/assets/fhir.schema.json,sha256=6GWj9A2ZScctqQbuPYmuTHBmvif9iiWMroBwXgjk0bc,4322750
11
+ h_adminsim/assets/names/firstname.txt,sha256=Tor1TcmWitv-8zqzkRlwERx6UETXIXNDJFug0f6UjOw,8193
12
+ h_adminsim/assets/names/lastname.txt,sha256=o54zH-2BRZQ7nLNLBCEPoftUgGil-yh8HHwM0XCJabY,695422
13
+ h_adminsim/assets/prompts/cancel_patient_system.txt,sha256=w0yxjeO_LYrVT429HVMp8tSCNdJkN7bivD_rK-HEev0,2027
14
+ h_adminsim/assets/prompts/intake_staff_task_user.txt,sha256=4aSmKMTJfUjqGS5fW-danoOGzruID6uFSJqXBL-GuHY,847
15
+ h_adminsim/assets/prompts/intake_supervisor_system.txt,sha256=84hLCpyazwus0DBZKd9NH6N8vo22S4U4QMBkwlOmtBU,699
16
+ h_adminsim/assets/prompts/intake_supervisor_user.txt,sha256=EXuPfKMgjOU8bS8QCis33X83XRnGxmkEAeYJKke5Y-8,1579
17
+ h_adminsim/assets/prompts/reschedule_patient_system.txt,sha256=V-F0kg__az8tRaa_UgHuKeNoxWlbMQfTJQJRkuy9i8U,2116
18
+ h_adminsim/assets/prompts/schedule_patient_rejected_system.txt,sha256=0voHiZCH6ftoRhhgI-kvzU2L353eMXgFs4nqFgWALoM,3093
19
+ h_adminsim/assets/prompts/schedule_patient_system.txt,sha256=Bl0kkoYn7UTLVonKrcyCWpbXMqV79mwmWr0vb-ehf_s,2460
20
+ h_adminsim/assets/prompts/schedule_staff_reasoning.txt,sha256=Cljtr2Qk7IbOviVKQ-gSB303j9ZHxV38I5MON0PiuIE,4284
21
+ h_adminsim/assets/prompts/schedule_staff_sc_tool_calling.txt,sha256=3tygmdDccOTh0eFisFH-y7lQtYNiniri9toBirpBgpY,649
22
+ h_adminsim/assets/prompts/schedule_staff_system.txt,sha256=RZnfPXLvEGzVZemVmQUytJDIDhA_NR9lkNNBQ2aKBuU,428
23
+ h_adminsim/assets/prompts/schedule_staff_tool_calling.txt,sha256=7sfvan6SiPkJeN1LwYFvgcHf68J2U3-HWbx3c6pSWfw,3574
24
+ h_adminsim/client/__init__.py,sha256=shwP2LIoYI8BjZt1eAb7aDPyX0-TdPl_sgFsZe-ZXl8,112
25
+ h_adminsim/client/google_client.py,sha256=WV84Ui_8xvTmum30e7RSXaO3vaNihKQM5g3mI2fLjIc,8002
26
+ h_adminsim/client/openai_client.py,sha256=iclsFeoBTc9ZJfFIvie8rFoWtkL5nqnDE_Bg3m2N-uQ,7492
27
+ h_adminsim/client/vllm_client.py,sha256=TE_daYzJ1-C6O7F3iCfwspk49PfGr-jwZL9rxj4XHLI,6062
28
+ h_adminsim/environment/__init__.py,sha256=zhC_TQXtiD6b4uwc_JOcBZCAyAvYE30gu_PTK5GEUYE,60
29
+ h_adminsim/environment/hospital.py,sha256=SqM0ty1PzDn3RhsJ0qHLewwMWwA83EOm3_eceAdbO2I,21462
30
+ h_adminsim/environment/op_scheduling_simulation.py,sha256=TmwROnRq0irdKRdfXDgZY-CNadjWKwSJDQ7Xwo7ntEY,54542
31
+ h_adminsim/pipeline/__init__.py,sha256=sHlukGTw4k0LyDblgVSaBnBxfKpLUQnnF_GNWdBUxUI,108
32
+ h_adminsim/pipeline/data_generator.py,sha256=8E7H7JrsDdxi5FRpVKPjZZS-y-WR-yulyD89Ax7z0uM,7713
33
+ h_adminsim/pipeline/evaluator.py,sha256=PCPj74WxDF-9pPLTKH1DhD1htViWXRIIcREt7mJHork,765
34
+ h_adminsim/pipeline/simulation.py,sha256=1adpDMWoC0_qG_y6JQNHxk3M6nUZUnTV9KK0h6J1WyA,10841
35
+ h_adminsim/registry/__init__.py,sha256=qlCdVq5xOvCiRM4Xhq9t9Vo5zsUaMPVUCR_MqH9QQ2s,133
36
+ h_adminsim/registry/errors.py,sha256=zO_HOVpxzbptKDXCqQEkbkUvyWgf-aANJ21ut5FauRE,3516
37
+ h_adminsim/registry/models.py,sha256=aa7UL0I90aGJQEeZ6wxBZjvgUMghqtYuaN4ZV5VsFQY,3491
38
+ h_adminsim/registry/phrases.py,sha256=oDmOG6lqtKLpW8oYurd22jput92Mh43h8JQvdr44f5s,670
39
+ h_adminsim/registry/pydantic_models.py,sha256=aOiIbRKS6PyKnqWFYdvBovcVPatib_TWiWfK0mJTVAg,570
40
+ h_adminsim/registry/variables.py,sha256=t_540V4UPn_FzJoTxMmoQmSlbZNkKZ7YGhcLJkVZs2Q,183
41
+ h_adminsim/supervisor.py,sha256=jzwVk3K2yl9DsOL7xczya9ym3U1IfSYi4u-4iZFLOHU,7735
42
+ h_adminsim/task/agent_task.py,sha256=LPYQABLRycvCnxzxYpKNmF-09D60WQrp0zjTCrJJ6ns,44044
43
+ h_adminsim/task/fhir_manager.py,sha256=O0lsagIkR9RNVUZXZmjWhaoewdQNKW8oIuNJ0Uk5B2g,7942
44
+ h_adminsim/task/schedule_assign.py,sha256=T5l8OaJ_3NJ0y1Dd6GuCHMoyri-J9QHX-7fojBL3bc4,6517
45
+ h_adminsim/tools/__init__.py,sha256=rh3czAHMsX88qPBu6wG3xzsC-BkpAIZ7DGANpcEz0uk,200
46
+ h_adminsim/tools/agent_data_builder.py,sha256=bDpLRFkKV00TEFWeG3hnaCkQlCERRWpKhz4BYKBW9nY,5414
47
+ h_adminsim/tools/data_converter.py,sha256=BhfhREnMJH5Bs5VdbZrE2mdZteOWeo_O6TTNWB4NEDM,24634
48
+ h_adminsim/tools/data_synthesizer.py,sha256=lME0ZgkQIgm8mPiY3RM1RWSLKvD4q6BjWBbSjepYfNo,17069
49
+ h_adminsim/tools/evaluator.py,sha256=Qj1YMrJBXBqHqJOiwmMQfHoslEId1A42_ypeG38WfnU,12299
50
+ h_adminsim/tools/sanity_checker.py,sha256=9TD9UmrVzWATmzAjym809R0kxAJvNMp_fQrtfRPymOk,11798
51
+ h_adminsim/tools/scheduling_rule.py,sha256=I959cN-e-RqTPTEwsxKXfDJcwXsPE3slVCMrqromm3o,19678
52
+ h_adminsim/utils/__init__.py,sha256=ZshtS9WxGjbGy--AVdu2is6brWdv70-PyLU_OPJEb4A,4411
53
+ h_adminsim/utils/common_utils.py,sha256=1PBNf-xtXDf7JxS4YRTuaLs5n72duW_--i1Th04Zlvw,25677
54
+ h_adminsim/utils/fhir_utils.py,sha256=-4Zrv9TTOd3vzwmhEPx3KMXp2Nak90L5-k94nGOB714,7169
55
+ h_adminsim/utils/filesys_utils.py,sha256=ZH_TlqG6Vmq_T4gmN0DavI7dG8Jl6Ggs8Tmzm3D49VU,3112
56
+ h_adminsim/utils/image_preprocess_utils.py,sha256=RXeIjmNBBBbF0hd7RqfJ9McXGe0kVQpS6UKo2wCGy30,6529
57
+ h_adminsim/utils/random_utils.py,sha256=9JabBssCTzVtUKnF7-KF68jQeNXFkHQu-GgRDuwByPI,15758
58
+ h_adminsim/version.txt,sha256=klIfw8vZZL3J9YSpkbif3apXVO0cyW1tQkRTOGacEwU,5
59
+ h_adminsim-1.0.0.dist-info/LICENSE,sha256=kUSg6KcpvOqVFi_whKUTwsNYNuCMbaDA6mmA7RB8PmY,1547
60
+ h_adminsim-1.0.0.dist-info/METADATA,sha256=1stOakgm6O8EeX0p3oIFaXQ62XascCsUAMN__ODYq6o,19326
61
+ h_adminsim-1.0.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
62
+ h_adminsim-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any