An AI-powered grading system for medical student OSCE post-encounter notes, using GPT models to automate grading and provide structured feedback.
✅ Supports Excel, CSV, and text-based student notes
✅ Works with structured rubrics (Excel, CSV)
✅ Uses ChatGPT to generate detailed, section-by-section grading
✅ Customizable grading prompts via config.py
✅ Automatic logging for debugging and analysis
✅ Easy setup with Python & OpenAI API
✅ Includes convert_rubric.py to assist in converting rubric files (PDF/DOCX to structured formats)
You'll need Python 3.8+ and an OpenAI API key.
git clone https://github.com/christopherjnash/OSCE-Grader.git
cd OSCE-Grader
pip install -r requirements.txt The grading prompt, model selection, API key location, and default file paths are managed in scripts\config.py.
Modify config.py as needed to customize the grading behavior for your institution.
Available models and pricing are available in the OpenAI API Documentation
Example of config.py settings:
MODEL = "gpt-4o-mini"
DEFAULT_RUBRIC_PATH = "examples/sample_rubric.xlsx"
DEFAULT_NOTES_PATH = "examples/sample_notes.xlsx"
DEFAULT_OUTPUT_PATH = "results.xlsx"- Sign up at OpenAI
- Go to API Keys → Generate a new key
- Save your key in a file named
api_key.txtin the root folder.
python scripts/grader.py --rubric examples/sample_rubric.xlsx --notes examples/sample_notes.xlsx --output results.xlsx | Flag | Description |
|---|---|
--rubric |
Path to the grading rubric (Excel/CSV) |
--notes |
Path to student notes (Excel/CSV) |
--output |
Name of the output file (Excel) |
--temperature |
OPTIONAL: The temperature setting for the model (default: 0.5) |
--output |
OPTIONAL: The top_p setting for the model (default: 1.0) |
If your rubric is in PDF or DOCX, you can convert it to a structured format (Excel or CSV) using convert_rubric.py.
Example Usage:
python scripts/convert_rubric.py examples/FlankPainRubric.pdf examples/sample_rubric.xlsx convert_rubric.py is a starting point for rubric conversion and may require manual adjustments based on formatting inconsistencies.
- The script grades section-by-section for higher accuracy.
- You can modify the grading prompt in
config.pywithout editing the script directly.
Example:
GRADING_PROMPT = "I am a medical educator, and I need your help grading an assignment... (your modified prompt)"🔹 API Key Not Found
👉 Ensure api_key.txt exists in the root folder.
🔹 Unexpected Scores or Formatting Issues
👉 Modify the grading prompt in config.py to better fit your rubric.
🔹 Invalid File Format
👉 Convert Word/PDF rubrics to Excel/CSV using convert_rubric.py.
📌 GitHub Repository: OSCE-Grader
📌 OpenAI API Docs: OpenAI
📌 Troubleshooting Guide: See docs/troubleshooting.md
MIT License – Free to use and modify.
See LICENSE for details.
Contributions are welcome! If you improve the script or add new features, submit a pull request or open an issue.
🚀 Happy Grading!