Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,7 @@ rm -f soa_builder_web_tests.db*
### Pre-commit Hooks
```bash
pre-commit install
pre-commit run --all-files # runs black + pytest + flake8
```

### CLI Commands
```bash
# Normalize wide CSV → relational tables
soa-builder normalize --input files/SoA.csv --out-dir normalized/

# Expand repeating rules → calendar instances
soa-builder expand --normalized-dir normalized/ --start-date 2025-01-01

# Validate imaging intervals
soa-builder validate --normalized-dir normalized/
pre-commit run --all-files # runs ruff + pytest
```

## Code Conventions
Expand Down
26 changes: 12 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)



# SoA Workbench

This workspace provides a Python package `soa_builder` with APIs to:

1. Normalize a wide Schedule of Activities (SoA) matrix into relational tables.
2. Expand repeating schedule rules into projected calendar instances.
This workspace provides a Python package `soa_builder` with APIs to create a Schedule of Activites for Clinical Studies.
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "Activites" should be "Activities".

Suggested change
This workspace provides a Python package `soa_builder` with APIs to create a Schedule of Activites for Clinical Studies.
This workspace provides a Python package `soa_builder` with APIs to create a Schedule of Activities for Clinical Studies.

Copilot uses AI. Check for mistakes.


## Installation
Recommended: editable install for development.
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -r requirements.txt
pre-commit install
pre-commit run --all-files
```
Comment on lines 9 to 16
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installation steps say "editable install for development", but pip install -r requirements.txt does not install the local package (so soa-builder-web / soa-builder console scripts likely won't be available). Consider switching back to an editable install (and including dev extras if needed), or adjust the subsequent instructions to match how users should run the app.

Copilot uses AI. Check for mistakes.

## Start web server
Expand All @@ -30,13 +26,15 @@ uvicorn soa_builder.web.app:app --reload --port 8000
```
HTML UI:
- Open http://localhost:8000/ in a browser.
- Add visits and activities; click cells to toggle status (blank -> X -> blank). 'O' values are not surfaced in the UI; clearing removes the cell row.
- Use "Generate Normalized Summary" link to produce artifacts.
- Use export buttons (to be added) or hit endpoints directly for XLSX output.
- Delete a visit or activity using the ✕ button next to its name (confirmation dialog). Deletion cascades to associated cells and automatically reorders remaining items.
- View biomedical concepts via the "Concepts" navigation link (`GET /ui/concepts`): renders a table of concept codes, titles and API links (cached; force refresh per study using `POST /ui/soa/{id}/concepts_refresh`).

Biomedical Concepts API Access:
- Create a new Schedule of Activities for a study or access an existing one.
- When a study is chosen, additional navigation links are available in the navigation menu that are unique to the Study context.
- More options and parameters for configuring the USDM classes are available through these navigation links.
- Add Scheduled Activity instances (columns) and activities (rows) to create an SoA matrix on the edit page for a Study; click cells to toggle status (blank -> X -> blank). 'O' values are not surfaced in the UI; clearing removes the cell row.
Comment on lines +29 to +32
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Markdown list formatting: these sub-bullets use tab indentation, which can render inconsistently across Markdown viewers. Prefer consistent space indentation for nested lists.

Copilot uses AI. Check for mistakes.
- Use export buttons (to be added) for XLSX output of the Matrix.
- View avialable biomedical concepts via the "Biomedical Concepts" navigation link to render a table of concept codes, titles and API links (cached; force refresh available).
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "avialable" should be "available".

Suggested change
- View avialable biomedical concepts via the "Biomedical Concepts" navigation link to render a table of concept codes, titles and API links (cached; force refresh available).
- View available biomedical concepts via the "Biomedical Concepts" navigation link to render a table of concept codes, titles and API links (cached; force refresh available).

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +34
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list item has inconsistent indentation (extra leading space before -), which can break Markdown list rendering. Align indentation with the surrounding bullets.

Copilot uses AI. Check for mistakes.
- View available data set specializations via the "SDTM Dataset Specializations" navigation link to render a table of specializations and API links to view associated concepts (cached; force refresh available).

CDISC Library API Access:
- The concepts list and detail pages call the CDISC Library API.
- Set one (or both) of: `CDISC_SUBSCRIPTION_KEY`, `CDISC_API_KEY`.
- The server will send all of these headers when possible:
Expand Down
88 changes: 72 additions & 16 deletions src/soa_builder/web/templates/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,95 @@
{% block content %}

<h2>Steps to Create an SoA Matrix</h2>



<ol>
<li>
<h3>Create a Schedule Timeline (container)</h3>
<h3>Create a new Schedule of Activties on the landing page.</h3>
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in heading: "Activties" should be "Activities".

Suggested change
<h3>Create a new Schedule of Activties on the landing page.</h3>
<h3>Create a new Schedule of Activities on the landing page.</h3>

Copilot uses AI. Check for mistakes.
<ul>
<li>Click <strong>Scheduled Timelines</strong> in the left sidebar</li>
<li>Create a Timeline (e.g., Main Timeline)</li>
<li>Optionally mark the Timeline as <strong>Main</strong></li>
<li>Study Name</li>
<li>Study ID</li>
<li>Study Label</li>
<li>Study Description</li>
<li>Create Study</li>
</ul>
</li>

<li>
<h3>Create Encounters/Visits (Optional, but recommended)</h3>
<h3>Create Schedule of Activities Matrix on Study Landing Page</h3>
<ul>
<li>Click <strong>Encounters</strong> in the left sidebar</li>
<li>Create visits (e.g., "Visit 1", "Visit 2", "Screening"</quote>)</li>
<li>These will appear as column headers in the Matrix</li>
<li>
A basic Schedule of Activity Matrix can be created on the landing lage once a study is created.
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "landing lage" should be "landing page".

Suggested change
A basic Schedule of Activity Matrix can be created on the landing lage once a study is created.
A basic Schedule of Activity Matrix can be created on the landing page once a study is created.

Copilot uses AI. Check for mistakes.
</li>
<li>Add Scheduled Instances to create coluuns for the SOA Matrix</li>
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "coluuns" should be "columns".

Suggested change
<li>Add Scheduled Instances to create coluuns for the SOA Matrix</li>
<li>Add Scheduled Instances to create columns for the SOA Matrix</li>

Copilot uses AI. Check for mistakes.
<li>Add Activites to create rows for the SOA Matrix</li>
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "Activites" should be "Activities".

Copilot uses AI. Check for mistakes.
<li>Selecting a cell in the Matrix will add a 'X' indicating the Activity is assigned to the Scheduled Instance</li>
<li>Biomedical Concepts can now be assigned to an Activity</li>
</ul>
<p><em>This only creates a rudimentary SOA Matrix. More detail can be added using the links in the navigation menu.</em></p>
<p><em>Links are only available once a study SOA has been chosen.</em></p>
</li>
<li>
<h3>Create Scheduled Activity Instances (Matrix Columns)</h3>
<h3>Create Study Timing</h3>
<ul>
<li>Click <strong>Scheduled Activity Instances</strong> in the left sidebar</li>
<li>For each instance created:
<li>Click <strong>Study Timing</strong> in the navigation menu</li>
<li>There are four configurations available
<ul>
<li>Set a <strong>name</strong> (e.g., "Week 1", "Day 1")</li>
<li><strong>IMPORTANT:</strong> Set <strong>Member of Timeline</strong> to the timeline created in Step 1</li>
<li>Optionally link to an encounter from Step 2</li>
<li>Optionally link to an Epoch</li>
<li>Schedule Timelines</li>
<li>Scheduled Activity Instances</li>
<li>Scheduled Decision Instances</li>
<li>Condition Assignments</li>
<li>Timings</li>
</ul>
Comment on lines +38 to 45
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text says "There are four configurations available" but the list below contains five items (Schedule Timelines, Scheduled Activity Instances, Scheduled Decision Instances, Condition Assignments, Timings). Update the count or adjust the list so they match.

Copilot uses AI. Check for mistakes.
</li>
<li>Each instance becomes a column in the Matrix</li>
</ul>
</li>
<li>
<h3>Create Epochs</h3>
<ul>
<li>Click <strong>Epochs</strong> in the navigation menu</li>

</ul>
</li>
<li>
<h3>Create Arms</h3>
<ul>
<li>Click <strong>Arms</strong> in the navigation menu</li>
</ul>
</li>
<li>
<h3>Create Elements</h3>
<ul>
<li>Click <strong>Elements</strong> in the navigation menu</li>
</ul>
</li>
<li>
<h3>Associate Study Epochs and Arms with Elements</h3>
<ul>
<li>Click <strong>Study Cells</strong></li>
</ul>
</li>
<li>
<h3>Create Encounters</h3>
<ul>
<li>Click <strong>Encounters</strong> in the left sidebar</li>
</ul>
</li>
<li>
<h3>Transition Rules for Encounters and Elements can also be defined</h3>
<ul>
<li>Click <strong>Transition Rules</strong> in the menu navigation menu</li>
</ul>
</li>
<li>
<h3>USDM JSON can also be generated</h3>
<ul>
<li>Click <strong>Generate USDM JSON</strong> in the menu navigation menu</li>
Comment on lines +83 to +89
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording duplication: "menu navigation menu" should be simplified (e.g., just "navigation menu").

Suggested change
<li>Click <strong>Transition Rules</strong> in the menu navigation menu</li>
</ul>
</li>
<li>
<h3>USDM JSON can also be generated</h3>
<ul>
<li>Click <strong>Generate USDM JSON</strong> in the menu navigation menu</li>
<li>Click <strong>Transition Rules</strong> in the navigation menu</li>
</ul>
</li>
<li>
<h3>USDM JSON can also be generated</h3>
<ul>
<li>Click <strong>Generate USDM JSON</strong> in the navigation menu</li>

Copilot uses AI. Check for mistakes.
Comment on lines +83 to +89
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording duplication: "menu navigation menu" should be simplified (e.g., just "navigation menu").

Suggested change
<li>Click <strong>Transition Rules</strong> in the menu navigation menu</li>
</ul>
</li>
<li>
<h3>USDM JSON can also be generated</h3>
<ul>
<li>Click <strong>Generate USDM JSON</strong> in the menu navigation menu</li>
<li>Click <strong>Transition Rules</strong> in the navigation menu</li>
</ul>
</li>
<li>
<h3>USDM JSON can also be generated</h3>
<ul>
<li>Click <strong>Generate USDM JSON</strong> in the navigation menu</li>

Copilot uses AI. Check for mistakes.
</ul>
<p><em>Partial JSON can be generated for the different USDM classes.</em></p>
<p><em>The full USDM JSON is not complete. Not all classes required for USDM conformance can be generated with the attributes set in the SOA Workbench</em></p>
</li>
<li>
<h3>Return to the Edit Page</h3>
<ul>
Expand Down