Python CLI for interacting with the January Mirror API.
Project description
Mirror CLI
Python CLI to interact with the January Mirror API. An API key is required.
Install
python3 -m venv .venv
source .venv/bin/activate
pip install .
Python 3.10+ is required. The only runtime dependency is requests.
Configure
MIRROR_API_KEY— your API key. You get this from the January team.MIRROR_BASE_URL— (optional) the base URL for the Mirror API.
Usage
Run via mirror-cli ... or python -m mirror_cli ... from this folder.
Active patient state
Most commands need a --patient-id. To save typing, the CLI caches the last created patient as the "active patient" in your local config (~/.config/mirror-cli/context.json). If you omit --patient-id, commands will use this active patient. You can set or change it explicitly with mirror-cli use-patient --patient-id ..., view it with mirror-cli active-patient, or clear it with mirror-cli clear-active-patient. Passing --patient-id always overrides the active value.
mirror-cli create-patient --first-name Jane --last-name Doe --gender female --birthdate 1990-01-01
mirror-cli list-patients --limit 20
mirror-cli upload-document --file ./sample_data/sample_labcorp.pdf
mirror-cli list-documents
mirror-cli get-report --include-content --poll-interval 5 --max-wait 3600
mirror-cli use-patient --patient-id pat_123 # set active patient
mirror-cli active-patient # show active patient
mirror-cli clear-active-patient # clear active patient
Global flags: --base-url, --api-key, --timeout, --json, --verbose.
Notes
- Document upload uses the two-step intent + presigned POST flow from the provided Postman collection.
- Report retrieval starts the job and polls until completion (or until
--max-waitelapses).
Typical flow
- Create a patient:
mirror-cli create-patient --first-name Jane --last-name Doe --gender female --birthdate 1990-01-01
- Upload a document (intent + presigned upload happen automatically):
mirror-cli upload-document --patient-id pat_123 --file ./lab.pdf
- Verify the upload:
mirror-cli list-documents --patient-id pat_123
- Request a report (starts the job and polls until done):
mirror-cli get-report --patient-id pat_123 --include-content --poll-interval 5 --max-wait 180
When completed, the CLI prints Report URL: <presigned link>; use --json to see the full payload. Flags --job-id, --force-context, and --force-report are available when you need more control.
Active patient helper:
- After
create-patient, the returned ID is saved as the active patient. - Commands that take
--patient-idwill default to the active patient if you omit the flag; you can always override by passing--patient-idexplicitly. - Manage it explicitly with
mirror-cli use-patient --patient-id ...,mirror-cli active-patient, andmirror-cli clear-active-patient.
Publish (manual)
- Bump the version in
pyproject.toml. - Build from the
mirror-cli/folder:python -m pip install --upgrade build twine python -m build
- Upload with Twine (PyPI):
export PYPI_TOKEN="pypi-********" python -m twine upload dist/* -u __token__ -p "$PYPI_TOKEN"
For TestPyPI, add--repository testpypi. Note: Token is saved in 1Password with the main account credentials. - Verify:
pip install --upgrade mirror-cli mirror-cli --version
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mirror_cli-0.1.2.tar.gz.
File metadata
- Download URL: mirror_cli-0.1.2.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
288f00a0efb7347634b4c66963a8b3c483cc7d1d526da9618e2a4ffded039923
|
|
| MD5 |
0f9dfc20b8d6bb76ea64c8dcaca784c7
|
|
| BLAKE2b-256 |
5d8bb89ad5a3d6b9ebd5411ca52f7bbd06ecfc3a3f1b3a745bac2e3cb02c59a0
|
File details
Details for the file mirror_cli-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mirror_cli-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e8852711a6d30e8d3751827d2c41c8447cd047123a53611003975d208cbdee6
|
|
| MD5 |
45074e6d040c6749effcf3ff74ec9bea
|
|
| BLAKE2b-256 |
3dde406895081023bf7a5b644cec6a720e5230739500080c082fd9c53c1da398
|