This Python script monitors your clipboard for structured patient information and automatically extracts key details such as patient name, age, gender, procedure, and contact number. It summarizes and formats this data for easy reference and copying.
β This tool is designed to work seamlessly with the Meditrust Anaesthetic Billing system, allowing fast and clean patient information entry.
- π Real-time clipboard monitoring for structured patient data
- π§ Gender guessing using both an offline database (
gender-guesser
) and OpenAI fallback - π
Age extraction from lines like
DOB (AGE: 73)
- π Auto-formatted patient summaries with two-line spacing
- β¨οΈ Press Enter to stop monitoring and instantly print & copy the final output
- π API key securely loaded via
config.ini
PATIENT NAME
Jane Doe
DOB (AGE: 61)
01/01/1963
REF
ABC123456
SURGEON
Dr Anonymous
CONSENT
UNKNOWN
PROCEDURE
Excision Left Arm Soft Tissue Tumour
INSURANCE
TYPE: UNINSURED HF: NA
CONTACT NUMBER(S)
0400 000 000
0400 000 000
Jane Doe 61F
Excision Left Arm Soft Tissue Tumour
- Place your config.ini file in the same folder as the script with the following contents:
[DEFAULT]
OPENAI_API_KEY=sk-your-openai-key-here
- Install dependencies:
pip install openai gender-guesser pyperclip
- Run the script:
python patientparser.py
- Paste patient blocks one by one into your clipboard.
- When you're done, press Enter to print and copy the final output.
- openai
- gender-guesser
- pyperclip
- The script uses name-based logic to infer gender; when uncertain, it asks OpenAI (gpt-4).
- Outputs are formatted with double line breaks between patients.
- This script is designed for Meditrust.
MIT License. Use responsibly and ensure compliance with privacy laws when handling real patient data.