An automated debriefing system for emergency call analysis using Large Language Models and Signal-Temporal Logic. This research prototype demonstrates automated quality assurance for 911 emergency call handling.
- Python 3.8+
- OpenAI API account with API key
- OpenAI Assistants configured (see setup guide below)
- Clone the repository
git clone https://github.com/AICPS-Lab/LogiDebrief.git
cd LogiDebrief- Install dependencies
# Minimal installation (recommended)
pip install -r requirements.txt
# Full installation (includes all development dependencies)
pip install -r requirements-full.txt- Configure environment
# Copy the example environment file
cp .env.example .env
# Edit .env and add your OpenAI API key
# OPENAI_API_KEY=your_actual_api_key_here-
Set up OpenAI Assistants (see detailed instructions below)
-
Run with example data
python main.py --exampleOPENAI_API_KEY=your_openai_api_key_here # Required
LOG_LEVEL=INFO # Optional (DEBUG, INFO, WARNING, ERROR)
LOG_FILE=logidebrief.log # Optional log file pathYou need to create 7 OpenAI Assistants and configure their IDs in function_mappings.json:
-
Create Assistants at OpenAI Platform
address: Validates address informationphone: Validates phone number collectionname: Validates caller name verificationgeneral: General validation checksflags: Identifies critical flags/protocolscondition: Evaluates preconditionscheck: Validates specific protocol checks
-
Configure Assistant IDs in
function_mappings.json:
{
"phone": "asst_xxxxxxxxxxxxx",
"name": "asst_xxxxxxxxxxxxx",
"address": "asst_xxxxxxxxxxxxx",
"condition": "asst_xxxxxxxxxxxxx",
"check": "asst_xxxxxxxxxxxxx",
"flags": "asst_xxxxxxxxxxxxx",
"general": "asst_xxxxxxxxxxxxx"
}When creating each assistant, use instructions like:
Address Assistant:
You are an emergency call analyzer. Given a conversation transcript, evaluate if the dispatcher properly obtained and verified the address. Return a JSON with fields: ask-first, address-confirmation, obtained-address, double-checking-end, overall-eval, and explanations.
# Run with your own data
python main.py --conversation path/to/transcript.txt --task path/to/config.json
# Run with example data
python main.py --example
# Specify output location
python main.py --example --output results/analysis.json
# Validate configuration only
python main.py --validate-onlyConversation File (plain text):
Dispatcher: 911, what's your emergency?
Caller: I need help...
Dispatcher: What's your address?
...
Task Configuration (JSON):
{
"simulation_mode": "flash",
"incident_spec": {
"incident_type": "Abdominal or Back Pain",
"address": "123 Main Street",
"PD": false,
"FD": false,
"EMD": true
}
}LogiDebrief/
βββ main.py # Main application entry point
βββ config.py # Configuration management
βββ functions/ # OpenAI integration module
β βββ __init__.py # FunctionAgents class
βββ guidecards/ # Emergency protocol guidelines
β βββ [incident_type]/ # Incident-specific protocols
β βββ conditions.json
β βββ questions.json
β βββ instructions.json
βββ protocols/ # Critical life-saving protocols
β βββ [protocol_type]/ # Protocol-specific rules
βββ examples/ # Sample data for testing
β βββ sample_conversation.txt
β βββ sample_task.json
βββ requirements.txt # Core dependencies
βββ requirements-full.txt # All dependencies
βββ .env.example # Environment configuration template
- Automated Call Analysis: Evaluates emergency call handling against established protocols
- Parallel Processing: Optimized performance with concurrent validation
- Comprehensive Checks:
- Address verification
- Phone number collection
- Caller identification
- Medical questioning protocols
- Pre-arrival instructions
- Critical life-saving protocols
- Flexible Configuration: Support for multiple incident types and protocols
- Detailed Logging: Comprehensive logging for debugging and audit trails
- Error Handling: Robust error handling with retry logic for API calls
-
API Key Error
ValueError: OPENAI_API_KEY not foundSolution: Ensure your
.envfile contains a valid OpenAI API key -
Assistant ID Error
ValueError: Please configure the following assistant IDsSolution: Update
function_mappings.jsonwith valid Assistant IDs -
File Not Found
FileNotFoundError: Conversation file not foundSolution: Check file paths and ensure files exist
-
API Timeout
TimeoutError: Assistant run timed outSolution: Check internet connection and OpenAI API status
Enable detailed logging for troubleshooting:
# Set in .env file
LOG_LEVEL=DEBUGThe system generates a comprehensive JSON report including (see example snippet below):
{
"Call-taker obtained and verified the address": {
"asked address first": true,
"address double checking": true,
"obtained address": true,
"result": "YES",
"explanation": "..."
},
"Call-taker used guidecards to obtain additional information?": {
"result": "YES/NO/N/A",
"explanation": "..."
},
}- Never commit your
.envfile or API keys - Store sensitive configuration in environment variables
- Use
.gitignoreto exclude sensitive files - Regularly rotate API keys
- Review OpenAI's security best practices
For detailed API documentation and advanced usage, refer to:
This is a research prototype. The complete codebase with formalized guidecards and protocols will be released upon paper acceptance.
If you use this code for research purposes, please cite our paper:
@inproceedings{ijcai2025p1065,
title = {LogiDebrief: A Signal-Temporal Logic Based Automated Debriefing Approach with Large Language Models Integration},
author = {Chen, Zirong and An, Ziyan and Reynolds, Jennifer and Mullen, Kristin and Maritini, Stephen and Ma, Meiyi},
booktitle = {Proceedings of the Thirty-Fourth International Joint Conference on
Artificial Intelligence, {IJCAI-25}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {James Kwok},
pages = {9582--9590},
year = {2025},
month = {8},
note = {AI and Social Good},
doi = {10.24963/ijcai.2025/1065},
url = {https://doi.org/10.24963/ijcai.2025/1065},
}
π Paper: (https://doi.org/10.24963/ijcai.2025/1065)
This project is part of academic research accepted and published at IJCAI 2025.
- Start Simple: Use the provided example files first
- Check Logs: Review
logidebrief.logfor detailed execution info - Validate First: Use
--validate-onlyto check configuration - Test Incrementally: Test with one protocol at a time
- Monitor API Usage: Track your OpenAI API usage and costs
For issues and questions:
- Create an issue in the repository
- Check existing documentation and examples
- Review the troubleshooting guide above
Note: This is a research prototype implementation. Production deployment would require additional security, scalability, and reliability enhancements.