Python application for results tracking
- Identify user (admin)
- Users create or subsrcibe to worklists
- worklists can contain 0 or more orders
- Orders can belong to 0 or more worklists
- Link patient MRN to all investigations ordered - then choose test and add to worklist
- Remove orders from worklist
- Display list of orders and status - filter by worklist and other criteria
ToDo: Improve this section with better instructions on using uv for managing all project dependencies.
- Clone this repository
- Create a new python environment e.g.
uv venv --python 3.12
- Activate the environment with
.venv/Scripts/activate
- Install project dependencies with
uv sync
(and use `uv add to add any dependencies) - Install restrack as an editable project with
uv pip install -e .[dev]
- Install pre-commit using
pre-commit install
- Copy the
sample.env
file to a new file called.env
and setup the environment variables here.
IMPORTANT: DO NOT SAVE ANY SENSITIVE INFORMATION TO VERSION CONTROL
The application is split into two distinct components.
The backend that interacts with OMOP and the application database is implemented using FastAPI and SQLModel and the code for this resides in restrack/api/
.
The user interface that displays the data and handles user interaction is implemented in Panel.
While this introduces some additional overhead during the development process, the clear separation of concerns lends itself to better maintainability and the ability to replace Panel with an alternate UI framework if required.
Restrack uses SQLite for ease of development but this can be easily replaced with any other SQLAlchemy-supported database. Sample data for populating the database is provided in tests/synthetic_data
. A new SQLite database called restrack.db
is created at first
During development, start the FastAPI server first. This will create the database. (ToDo: Automate populating the database with sample data).
These are configured as VS Code Tasks in .vscode/tasks.json
. If using a different IDE, run the commands in separate terminal sessions.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Panel Development Server",
"type": "shell",
"command": "panel serve ./restrack/ui/ui.py --global-loading-spinner --basic-auth ./data/users.json --cookie-secret restrack_secret --dev ",
"problemMatcher": [
"$python"
]
},
{
"label": "FastAPI Development Server",
"type": "shell",
"command": "fastapi dev ./restrack/api/api.py",
"problemMatcher": [
"$python"
]
},
]
}