Skip to content

Automatically parse, reformat and output multiple patient details from the default Meditrust web page

Notifications You must be signed in to change notification settings

changyang1230/patientparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‹ Clipboard Patient Parser

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.


πŸ”§ Features

  • πŸ“‹ 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

πŸ–₯️ Example Input (Copied to Clipboard)

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

βœ… Output (Printed and Copied to Clipboard)

0400 000 000
Jane Doe 61F
Excision Left Arm Soft Tissue Tumour

πŸš€ How to Run

  1. 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
  1. Install dependencies:
pip install openai gender-guesser pyperclip
  1. Run the script:
python patientparser.py
  1. Paste patient blocks one by one into your clipboard.
  2. When you're done, press Enter to print and copy the final output.

πŸ“¦ Dependencies

  • openai
  • gender-guesser
  • pyperclip

✍️ Notes

  • 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.

πŸ›‘οΈ License

MIT License. Use responsibly and ensure compliance with privacy laws when handling real patient data.

About

Automatically parse, reformat and output multiple patient details from the default Meditrust web page

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages