noteguard-agent / docs /rap_compliance.md
github-actions[bot]
Deploy 9aa839066bbf99a8ada733b41479a39770b3bb83 from main
eb83689
|
Raw
History Blame Contribute Delete
3.98 kB
# RAP compliance
This repository is organised to meet **Gold RAP** under the
[NHS RAP Community of Practice maturity framework](https://nhsdigital.github.io/rap-community-of-practice/introduction_to_RAP/levels_of_RAP/).
The levels are cumulative β€” Gold includes everything in Baseline and Silver.
The structure also draws on the
[NHS England repository template](https://github.com/nhs-england-tools/repository-template)
and the [NHS England "package your code" workshop](https://github.com/nhsengland/package-your-code-workshop).
## Baseline RAP
| Criterion | Status | Evidence |
|---|---|---|
| Data produced by code in an open-source language | βœ… | Python pipeline (`src/`, `agent/`, `eval/`). |
| Code is version controlled | βœ… | Git, hosted on GitHub. |
| README details steps to reproduce | βœ… | [`README.md`](../README.md), [`docs/user_guide.md`](user_guide.md). |
| Code has been peer reviewed | βœ… | Pull request workflow with template + required human review. |
| Code is published in the open | βœ… | Public GitHub repository, MIT licensed. |
## Silver RAP
| Criterion | Status | Evidence |
|---|---|---|
| Outputs produced with minimal manual intervention | βœ… | `uvicorn app.api:app` / `python -m eval.run_eval`; one-command startup. |
| Code is well-documented (guidance, structure, docstrings) | βœ… | Module + function docstrings throughout; `docs/` directory. |
| Well-organised, standard directory format | βœ… | `src/` core, `agent/`, `app/`, `eval/`, `tests/`, `docs/`, `data/`. |
| Reusable functions and/or classes | βœ… | `NoteGuard`, `load_known_from_csv()`, `build_graph()` β€” composable and parameterisable. |
| Adheres to agreed coding standards | βœ… | PEP 8, type hints, **ruff** lint + format (see `pyproject.toml`). |
| Pipeline includes a testing framework | βœ… | `pytest` suite in `tests/` (24 tests; de-id core covered; no external deps needed). |
| Dependency information included | βœ… | `pyproject.toml` β€” single source of truth; optional extras for the demo and dev tooling. |
| Logs automatically recorded by the pipeline | βœ… | LangSmith auto-traces every graph run (`LANGSMITH_TRACING=true`). |
| Configuration aids reusability | βœ… | All settings from environment variables; `.env.example` provided. |
## Gold RAP
| Criterion | Status | Evidence |
|---|---|---|
| Code is fully packaged | βœ… | `pyproject.toml` (setuptools, `pip install -e ".[dev]"`, optional extras). |
| Tests run automatically via CI/CD | βœ… | [`.github/workflows/ci.yml`](../.github/workflows/ci.yml) β€” ruff + pytest on 3.10–3.12. |
| Process runs on event-based triggers or a schedule | βœ… | CI on push / pull request; agent runs on live query events. |
| Changes clearly signposted (changelog, releases) | βœ… | [`CHANGELOG.md`](../CHANGELOG.md), `VERSION`, semantic versioning. |
## Additional good practice
- **Pre-commit hooks** (`.pre-commit-config.yaml`) for local quality gates.
- **Editor configuration** (`.editorconfig`) for consistent formatting.
- **Pull request template** and `CONTRIBUTING.md` documenting the review process.
- **Secret hygiene**: no credentials in code; `.env` git-ignored; a
`detect-private-key` pre-commit hook.
- **Hard privacy guarantee**: `assert_clean()` enforced at every PHI boundary β€”
the de-id node before the model, and the `zero_phi_to_model` LangSmith eval.
- **Reproducible outputs via the web UI**: `GET /` + `POST /process` provide a
documented, versioned HTTP interface that produces the same clinician output for
the same input β€” satisfying the reproducibility intent of RAP Gold.
- **Documented API contract**: `docs/architecture.md` specifies every endpoint,
request/response shape, and the `assert_clean()` guarantee; consumers can
reproduce the analysis without reading source code.
- **Governance documentation**: `docs/tool_card.md` (Five Safes mapping, bias &
fairness statement, DPIA prerequisites) and `docs/report.md` (gov.uk ATRS record,
Tier 1 + Tier 2).