Interactive Streamlit app that ingests a procedure (PDF or raw text) and extracts a structured JSON representation of key metadata (MTR fields) using Azure OpenAI. This repository was previously a React/Vite front‑end; it has been streamlined into a single Python application (app.py).
.env (not committed)AZURE_OPENAI_ENDPOINT (e.g. https://your-resource.openai.azure.com)AZURE_OPENAI_API_KEYAZURE_OPENAI_DEPLOYMENT (deployment name of your model)AZURE_OPENAI_API_VERSION (e.g. 2024-06-01)# Clone (if you haven't already)
git clone https://github.com/Unigalactix/MTRVALIDATION.git
cd MTRVALIDATION
# Create & activate virtual environment
python -m venv .venv
.\.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Create .env file (example values)
@'
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
AZURE_OPENAI_API_KEY=your_key_here
AZURE_OPENAI_DEPLOYMENT=your_deployment_name
AZURE_OPENAI_API_VERSION=2024-06-01
'@ | Out-File -Encoding UTF8 .env
# Run the app
streamlit run app.py
streamlit run app.py.{
"MTR": {
"procedureId": "...",
"title": "...",
"category": "...",
"revision": "...",
"effectiveDate": "YYYY-MM-DD",
"author": "...",
"steps": [
{ "number": 1, "text": "...", "tools": ["..."], "warnings": ["..."] }
]
},
"extraction": {
"model": "<deployment name>",
"timestamp": "ISO8601"
}
}
The actual schema is enforced via a system prompt template inside app.py.
.env is ignored via .gitignore.| Issue | Likely Cause | Fix |
|——-|————–|—–|
| Missing JSON output | Model returned non‑JSON text | App wraps error; retry or refine content. |
| 401 / 403 errors | Invalid key or insufficient permissions | Regenerate key; confirm role assignments in Azure portal. |
| Empty PDF text | Scanned or image‑only PDF | OCR not implemented; supply extracted text manually. |
| Key not loaded | .env not found / wrong variable names | Confirm names match list above and restart. |
pytesseract + pdf2image for image‑based PDFs.pydantic model to validate before display.structlog or logging for audit trails.React/Vite/Tailwind implementation and GitHub Pages workflow were intentionally removed to simplify maintenance. All functionality now resides in app.py.
No explicit license specified. Add one if you plan external distribution.
Need enhancements (OCR, validation, more fields)? Open an issue or PR.