Files · Automated Referral Letter Generator from Veterinary Medical Records
87 (1 binary, 536.4 kB total)attempt 1
README.md·1942 B·markdown
markdown
# Automated Referral Letter Generator from Veterinary Medical Records
> Draft specialist referral letters in under 2 minutes by extracting key findings from PIMS records.
A tutorialized reference solution from [reaatech.com](https://reaatech.com), demonstrating how to build production-grade AI systems with the `@reaatech/*` package family.
## Prerequisites
- Node.js 22+
- pnpm 10.x
- OpenAI API key
- Langfuse keys (optional, for observability)
## Quick Start
```bash
pnpm install
cp .env.example .env
# Fill in OPENAI_API_KEY and optional Langfuse keys
pnpm dev
# POST to http://localhost:3000/api/referral-letter
```
## API Reference
### POST /api/referral-letter
Accepts `multipart/form-data` with:
| Field | Type | Required | Default | Description |
| -------- | ------ | -------- | ------- | ---------------------------------- |
| `file` | File | yes | — | PDF or DOCX veterinary PIMS record |
| `format` | string | no | `docx` | Output format (`docx` or `pdf`) |
Returns:
```json
{
"letter": "<base64-encoded file bytes>",
"format": "docx",
"metadata": {
"patientName": "string",
"generatedDate": "string",
"stages": ["string"]
}
}
```
### GET /api/health
Returns `{ "status": "ok", "timestamp": "<ISO 8601>" }`.
## Environment Variables
| Variable | Required | Description |
| -------------------- | -------- | ------------------------------ |
| `OPENAI_API_KEY` | yes | OpenAI API key |
| `LANGFUSE_PUBLIC_KEY` | no | Langfuse public key |
| `LANGFUSE_SECRET_KEY` | no | Langfuse secret key |
| `LANGFUSE_HOST` | no | Langfuse host (optional) |
## Architecture
```
Document Extraction → AI Processing → Memory → Cache → Context Planning → Guardrails → Letter Generation
```
## License
MIT — see [LICENSE](./LICENSE).