Skip to main content

A Python library for managing software development documentation and testing that automates the generation of PDFs, validation packs, and traceability matrices.

Project description

TraceFlow

TraceFlow Logo

TraceFlow is a Python library designed to help manage software development documentation and testing processes, streamlining the production of requirements, design documents, and test cases (both automated and manual). With built-in support for PDF export, you can easily sign the output making TraceFlow particularly suited for projects in regulated environments or environments where compliance with 21 CFR 11 is necessary.

By leveraging TraceFlow, you can:

  • Maintain your documentation in the same git repository as your code, ensuring version control and easy collaboration.
  • Automatically produce a "validation pack" containing all requirements, design, and test plans in PDF format.
  • Generate a traceability matrix linking all requirements to all tests.
  • Capture structured risk registers with requirement/test cross-links and colour-coded pre/post-mitigation risk levels.
  • Create fillable PDF forms for manual tests.
  • Run automated tests and capture their output as Markdown, then include them in the PDF report.
  • The result will look something like this

Getting Started

To use TraceFlow, organize your Markdown files in the following folder structure:

project/
  ├── requirements/
  │   ├── requirements.md
  │   └── ...
  ├── design/
  │   ├── design.md
  │   └── ...
  ├── risks/
  │   ├── risk-register.md
  │   └── ...
  └── tests/
      ├── test_plan.md
      └── ...

Create your Markdown files based on the provided examples:

Running TraceFlow

With your Markdown files in place, you can run TraceFlow using the following command:

traceflow path/to/project-docs 1.0.0 project.pdf

The second argument is the version string that will be shown on the report (change it to whatever release identifier you need).

Two optional arguments let you replace the logos that appear in the header (top-left) and footer (top-right):

  • --top-left-logo (alias --traceflow-logo) points to the image shown in the top-left of every page (header).
  • --top-right-logo (alias --voxelflow-logo) points to the image shown in the bottom-left of every page (footer).

If you do not pass these options, TraceFlow falls back to the packaged images in traceflow/res/.

traceflow path/to/project-docs 1.0.0 project.pdf --top-left-logo assets/traceflow.png --top-right-logo assets/voxelflow.png

This command will generate a PDF for all of your documentation and test cases, as well as a validation pack and traceability matrix.

Running the Playwright example

TraceFlow includes the examples directory, which demonstrates autoplaywright tests that invoke the Playwright scripts in this repo. To reproduce that example, run:

uv run traceflow examples 1.0.0 test.pdf --playwright-dir playwright/

On macOS you may need to prefix the command with DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib so the bundled cairosvg finds libcairo. This example writes test.pdf into the current directory, stores temporary LaTeX artifacts in report/, and captures the Playwright video and logs via playwright/run-test-video.sh.

If your documentation contains autoplaywright test blocks that capture Playwright runs, append --playwright-dir PATH so TraceFlow can invoke the runner and gather the videos + logs that back these tests.

Requirements

# Requirements

## REQ-001: User authentication

Users must be able to authenticate using their email address and a password.

### Example LaTeX equation

The strength of the user's password should follow the entropy equation:

$$ H = L \times \log_2(N) $$

Where $H$ is the entropy, $L$ is the password length, and $N$ is the number of possible symbols.

## REQ-002: MRI dataset import

The platform must support importing MRI datasets in DICOM format.

### Example image (.png)

![Caption for example image](./mri_sample.png)

## REQ-003: Image analysis pipeline

- The platform should provide a Python API for building image analysis pipelines.
- The pipelines must be able to process MRI datasets in a compliant way.

### Example table

| Step          | Description                                      | API Function       |
|---------------|--------------------------------------------------|--------------------|
| Preprocessing | Remove noise, artifacts, and normalize intensity | preprocess_data()  |
| Segmentation  | Segment the relevant regions of interest         | segment_roi()      |
| Feature extraction | Extract features from segmented regions      | extract_features() |
| Classification | Classify the extracted features                 | classify_data()    |

### Example flow chart (using mermaid)

\```mermaid
graph LR
A[Preprocessing] --> B[Segmentation]
B --> C[Feature extraction]
C --> D[Classification]
\```

Test Plan

## TEST-001: User authentication

**Requirement ID:** REQ-001

### Test Steps:

1. Navigate to the login page.
2. Enter a valid email address and password.
3. Click the "Login" button.

### Expected Result:

The user is logged in and redirected to the main dashboard.

### Test Result (Manual):

\```manualtest
\```

Design Document

## User Authentication

To address **REQ-001**, we will implement an authentication system using JWT (JSON Web Tokens). The system will include the following components:

- A login page with input fields for email and password
- A backend API endpoint to validate user credentials
- Middleware to validate JWT tokens for accessing protected resources

## MRI Dataset Import

To address **REQ-002**, we will develop a module to import MRI datasets in DICOM format. The module will include:

- A function to parse DICOM files
- Error handling for unsupported or malformed files
- Integration with the existing data storage system

## Image Analysis Pipeline

To address **REQ-003**, we will create a Python API for building and executing image analysis pipelines. This API will include:

- A set of Python classes to represent pipeline components
- Functions to connect and execute pipeline components
- Compliance checks to ensure the pipeline adheres to the required standards

Risk Register Example

TraceFlow now understands risk registers and renders them on A3 landscape pages with colour-coded severity, probability, and residual risk ratings.

# Risk Register

## RISK-001: Incorrect study-patient association

Hazardous Situation: Clinician views wrong patient's images believing they are correct
Harm: Misdiagnosis, inappropriate treatment
Cause: Race condition during HL7/DICOM message processing leading to incorrect PatientID or AccessionNumber assignment
Severity: High
Probability: Medium
Controls: Unit/integration tests for identifier logic (REQ-005, TEST-002)
Residual Severity: Medium
Residual Probability: Low
Residual Risk: Operator review plus automatic quarantine when mismatches occur

Generic Document Example

Any additional Markdown files (e.g., Installation/User Specifications) are included verbatim and can link to requirements, tests, or risks using their IDs:

# Installation & User Specification

- Execute TEST-003 and record the release tag.
- Confirm the identifier reconciliation feature (REQ-005) is active before go-live.
- Review RISK-001 and RISK-002 residual risk statements with the clinical safety officer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traceflow_rtm-0.0.23.tar.gz (230.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traceflow_rtm-0.0.23-py3-none-any.whl (171.1 kB view details)

Uploaded Python 3

File details

Details for the file traceflow_rtm-0.0.23.tar.gz.

File metadata

  • Download URL: traceflow_rtm-0.0.23.tar.gz
  • Upload date:
  • Size: 230.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.4

File hashes

Hashes for traceflow_rtm-0.0.23.tar.gz
Algorithm Hash digest
SHA256 e47a36f38e8efbd217f58a1936a792376795936fbcf3bf3d4056b82a827d8c31
MD5 a8a4112df7285b34d3c86f329887e0cf
BLAKE2b-256 024e5925454e5cfd36b4655b50d9048f0eadaa842a8fe7932eb72e7cf3a354c3

See more details on using hashes here.

File details

Details for the file traceflow_rtm-0.0.23-py3-none-any.whl.

File metadata

File hashes

Hashes for traceflow_rtm-0.0.23-py3-none-any.whl
Algorithm Hash digest
SHA256 84257b6edbc6e13d8079c61fdd1c14387a9fc4926f72385436aa9f652528027d
MD5 989b25f66465807de7c1aa61cdbb45c8
BLAKE2b-256 d1cde7e8d1a354c0b947a3803c7e8392161e0ad1e3404164a9a80dacb88d6503

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page