Skip to content

Commit 61f1520

Browse files
committed
upgraded scales and reports rtd
1 parent a6def8c commit 61f1520

7 files changed

Lines changed: 128 additions & 63 deletions

File tree

docs/conf.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,22 @@
1515

1616
_DIST_NAME = "dbs-annotator"
1717

18-
from dbs_annotator.config import APP_LEAD_AUTHOR, ORGANIZATION_PUBLISHER
18+
from dbs_annotator.config import APP_LEAD_AUTHOR, UPDATE_FEEDBACK_EMAIL
1919

2020
project = "DBS Annotator"
2121
author = APP_LEAD_AUTHOR
2222
release = metadata.version(_DIST_NAME)
2323
version = ".".join(release.split(".")[:2])
24-
copyright = f"2025-{datetime.now().year}, {ORGANIZATION_PUBLISHER}"
24+
_DOCS_COPYRIGHT_HOLDERS = (
25+
"Massachusetts General Hospital, "
26+
"Wyss Center for Bio and Neuroengineering, "
27+
"and Charité Universitätsmedizin Berlin"
28+
)
29+
copyright = f"2025-{datetime.now().year}, {_DOCS_COPYRIGHT_HOLDERS}"
30+
31+
html_context = {
32+
"contact_email": UPDATE_FEEDBACK_EMAIL,
33+
}
2534

2635
extensions = [
2736
"sphinx.ext.autodoc",

docs/contributing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ Clinical Domain Experts
467467
If you are a clinician or DBS specialist:
468468

469469
- Share real-world session workflows and edge cases.
470-
- Review and suggest improvements to clinical scale presets.
470+
- Review and suggest improvements to clinical and session scale presets
471+
(``CLINICAL_SCALES_PRESETS`` / ``SESSION_SCALES_PRESETS`` in ``config.py``).
471472
- Provide feedback on electrode model definitions and contact diagrams.
472473
- Help validate clinical accuracy of exported reports.
473474

docs/faq.rst

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,26 @@ The application highlights the "best" stimulation configuration in green in the
9292
Session Data table. The scale optimisation dialog lets you define what "best"
9393
means for each scale:
9494

95-
* **Min** — the entry with the lowest value is best (e.g. UPDRS — lower motor
96-
score = better).
97-
* **Max** — the entry with the highest value is best (e.g. Mood VAS — higher
98-
mood = better).
95+
* **Min** — the entry with the lowest value is best (e.g. UPDRS-III, Tremor).
96+
* **Max** — the entry with the highest value is best (e.g. Mood, Energy).
9997
* **Custom** — the entry closest to a target value you specify.
10098

10199
Uncheck a scale to exclude it from the calculation.
102100

103101
**The report sections dialog appeared but I only want a summary table.
104102
Which sections should I check?**
105103

106-
Check only **Sessions Overview** (for a quick one-table overview) or
107-
**Programming Summary** (for parameter ranges). Uncheck the others.
104+
Check only **Sessions Overview** (summary table plus clinical-scales chart) or
105+
**Programming Summary** (parameter ranges). Uncheck the others. For a chart
106+
without the full entry table, select **Session Data Graph** only.
107+
108+
**Where do the timeline charts in reports come from?**
109+
110+
Session and longitudinal exporters build PNG charts with matplotlib
111+
(``report_chart_utils``). **Session Data Graph** plots session-scale values
112+
(0–10) against configuration block index. **Sessions Overview** in the
113+
longitudinal report adds a separate chart of baseline clinical scales across
114+
loaded session files.
108115

109116
**Word export works but PDF export fails.**
110117

@@ -159,5 +166,7 @@ Contact & Support
159166

160167
For bug reports, feature requests, or questions:
161168

169+
| **Massachusetts General Hospital** (Brain Modulation Lab)
162170
| **Wyss Center for Bio and Neuroengineering**
171+
| **Charité Universitätsmedizin Berlin**
163172
| **Lucia Poma** — lucia.poma@wysscenter.ch

docs/index.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ clinician or researcher through the full session workflow — from initial
1616
electrode configuration and baseline scales, through real-time stimulation
1717
adjustments, to the automatic generation of structured Word and PDF reports.
1818

19-
Developed at the **Brain Modulation Lab, Massachusetts General Hospital** in Boston, USA
20-
and at the **Wyss Center for Bio and Neuroengineering** in Geneva, Switzerland.
19+
Developed at the **Brain Modulation Lab, Massachusetts General Hospital** (Boston, USA),
20+
the **Wyss Center for Bio and Neuroengineering** (Geneva, Switzerland), and
21+
**Charité Universitätsmedizin Berlin** (Germany).
2122

2223
.. note::
2324
| Version |release|.
24-
| Publisher: Wyss Center for Bio and Neuroengineering.
25+
| Copyright © Massachusetts General Hospital, Wyss Center for Bio and Neuroengineering, and Charité Universitätsmedizin Berlin.
2526
| Contact: lucia.poma@wysscenter.ch
2627
2728
----
@@ -68,10 +69,12 @@ Quick Overview
6869

6970
* - **Single-session workflow**
7071
- Record stimulation parameters, clinical scales, and notes step-by-step.
71-
Export a structured report (Word / PDF) at the end.
72+
Export a structured report (Word / PDF) with tables, electrode diagrams,
73+
and session-scale timeline charts.
7274
* - **Longitudinal report**
7375
- Combine multiple session files into a single comparative document with
74-
overview tables, electrode configuration diagrams, and timeline charts.
76+
overview tables, clinical and session-scale charts, electrode diagrams,
77+
and programming summaries.
7578
* - **Free annotations**
7679
- Quick timestamped text notes without the full stimulation workflow.
7780
* - **BIDS-compliant output**

docs/longitudinal_report.rst

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ Three dialogs appear before the file-save dialog:
7878
Step 1 — Scale Optimisation
7979
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8080

81-
Choose the optimisation target for each clinical scale found across all loaded
82-
files.
81+
Choose the optimisation target for each **session scale** and, when present,
82+
each **clinical (baseline) scale** found across all loaded files.
8383

8484
.. image:: _static/scale_optimization_dialog.png
8585
:alt: Scale optimisation dialog
8686
:width: 500px
8787

8888
For each scale, select:
8989

90-
* **Min** — lower values are better (e.g. UPDRS, Y-BOCS).
91-
* **Max** — higher values are better (e.g. Mood VAS).
90+
* **Min** — lower values are better (e.g. UPDRS-III, Tremor, Y-BOCS).
91+
* **Max** — higher values are better (e.g. Mood, Energy).
9292
* **Custom** — enter a specific target value; the entry closest to that value
9393
is highlighted.
9494

@@ -97,7 +97,8 @@ Uncheck a scale to exclude it entirely from best-entry highlighting.
9797
Step 2 — Report Sections
9898
^^^^^^^^^^^^^^^^^^^^^^^^^
9999

100-
Choose which sections to include. By default only the first two are checked:
100+
Choose which sections to include. By default **Sessions Overview** and
101+
**Session Data Graph** are checked:
101102

102103
.. list-table::
103104
:widths: 35 15 50
@@ -108,13 +109,18 @@ Choose which sections to include. By default only the first two are checked:
108109
- Description
109110
* - Sessions Overview
110111
- ✓
111-
- Summary table listing all loaded sessions with date, number of entries,
112-
and final scale values.
113-
* - Session Data
112+
- Summary table of all loaded sessions (date, entry count, baseline
113+
clinical scales) plus a **clinical scales timeline chart** across
114+
sessions.
115+
* - Session Data → Graph
114116
- ✓
115-
- Detailed table of all recorded entries across all sessions, with
116-
stimulation parameters, scale values, and notes. The best entry per
117-
session is highlighted.
117+
- **Session-scale timeline chart** across all configurations in all files
118+
(one subplot per scale; best entries highlighted).
119+
* - Session Data → Table
120+
- ☐
121+
- Combined table of all recorded entries across sessions (date column,
122+
stimulation parameters, scale values, notes). Best entry per session
123+
highlighted.
118124
* - Electrode Configuration
119125
- ☐
120126
- Per-file Initial / Final electrode diagrams (Left and Right hemispheres).
@@ -140,7 +146,8 @@ Report Contents
140146
Sessions Overview
141147
^^^^^^^^^^^^^^^^^^
142148

143-
A table with one row per loaded file:
149+
A **clinical scales timeline chart** (baseline ``is_initial = 1`` values per
150+
session file) followed by a summary table with one row per loaded file:
144151

145152
.. list-table::
146153
:widths: 30 70
@@ -155,17 +162,21 @@ A table with one row per loaded file:
155162
* - Entries
156163
- Number of stimulation configurations recorded
157164
* - Clinical scales
158-
- Final scale values from the last recorded entry
165+
- Names of baseline clinical scales recorded in Step 1
166+
* - Values
167+
- Corresponding baseline scores
159168

160169
Session Data
161170
^^^^^^^^^^^^^
162171

163-
A combined table of all session entries across all files. The first column
164-
shows the **date** of each entry (from the ``date`` field in the TSV).
165-
Columns include laterality (L/R), stimulation frequency, contacts (+/−),
166-
amplitude, pulse width, scale values, and notes.
172+
Depending on your section selection, the report includes a **session-scale
173+
timeline chart** (values across programming blocks in all files), a **combined
174+
data table**, or both.
167175

168-
The best entry per session is highlighted in **green**.
176+
The table's first column shows the **date** of each entry (from the ``date``
177+
field in the TSV). Other columns include laterality (L/R), stimulation
178+
frequency, contacts (+/−), amplitude, pulse width, session scale values, and
179+
notes. The best entry per session is highlighted in **green**.
169180

170181
.. image:: _static/longitudinal_session_data.png
171182
:alt: Session data table in longitudinal report

docs/output_format.rst

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ Example rows
4545
.. code-block:: text
4646
4747
date time timezone block_id session_ID is_initial scale_name scale_value electrode_model program_ID left_stim_freq left_anode left_cathode left_amplitude left_pulse_width right_stim_freq right_anode right_cathode right_amplitude right_pulse_width notes
48-
2025-03-15 10:02:31 UTC-04:00 0 0 1 UPDRS-III 42 SenSight B33015 A 130 Case 1C 0.0 60 130 Case 9C 0.0 60 Baseline pre-stim
49-
2025-03-15 10:15:44 UTC-04:00 1 1 0 UPDRS-III 38 SenSight B33015 A 130 Case 1C 2.5 60 130 Case 9C 2.0 60 Config 1
50-
2025-03-15 10:28:12 UTC-04:00 2 2 0 UPDRS-III 34 SenSight B33015 B 130 Case 2A,2B 3.0 90 130 Case 10A,10B 2.5 90 Config 2 - wider contacts
48+
2025-03-15 10:02:31 UTC-04:00 0 0 1 MDS-UPDRS\nUPDRS-III 28\n32 SenSight B33005 A 130 Case E1a 0.0 90 130 Case E2 0.0 90 Baseline pre-stim
49+
2025-03-15 10:15:44 UTC-04:00 1 1 0 Tremor\nRigidity\nBradykinesia 6.0\n5.0\n4.0 SenSight B33005 A 130 Case E1a,E1b 2.0 90 130 Case E2 2.0 90 Config 1
50+
2025-03-15 10:28:12 UTC-04:00 2 2 0 Tremor\nRigidity\nBradykinesia 4.0\n3.0\n3.0 SenSight B33005 B 130 Case E2A,E2B 2.5 90 130 Case E3 2.5 90 Config 2
5151
5252
----
5353

@@ -65,11 +65,15 @@ Sections (in order):
6565

6666
1. **Title** — "Clinical DBS Session Report", generated date, patient ID,
6767
session number.
68-
2. **Initial Clinical Notes** *(optional)* — baseline scale scores and any
69-
initial notes recorded in Step 1.
70-
3. **Session Data** *(optional)* — lateral table (L/R rows per configuration)
71-
with all recorded stimulation parameters, scale values, and notes. The
72-
best entry is highlighted in green.
68+
2. **Initial Clinical Notes** *(optional)* — baseline clinical scale scores
69+
and any initial notes recorded in Step 1.
70+
3. **Session Data** *(optional)* — one or both of:
71+
72+
* **Session Data Graph** — matplotlib timeline chart of session-scale
73+
values vs configuration block (best entry per scale highlighted).
74+
* **Session Data Table** — lateral table (L/R rows per configuration) with
75+
stimulation parameters, scale values, and notes.
76+
7377
4. **Electrode Configurations** *(optional)* — a borderless 4-column table:
7478

7579
+-------------------+-------------------+-------------------+-------------------+
@@ -88,11 +92,12 @@ Sections (in order, selected at export time):
8892

8993
1. **Title** — "Longitudinal DBS Report", generated date, patient ID,
9094
list of included files.
91-
2. **Sessions Overview** *(optional)* — one-row-per-session summary table
92-
with date, number of entries, and final scale values.
93-
3. **Session Data** *(optional)* — combined table across all sessions.
94-
First column is the entry **date**; the best entry per session is
95-
highlighted.
95+
2. **Sessions Overview** *(optional)* — clinical-scales timeline chart across
96+
sessions plus a one-row-per-session summary table (date, entry count,
97+
baseline scale names and values).
98+
3. **Session Data** *(optional)* — session-scale timeline chart and/or
99+
combined table across all sessions. The table's first column is the entry
100+
**date**; the best entry per session is highlighted.
96101
4. **Electrode Configuration** *(optional)* — per-file Initial/Final diagrams
97102
separated by page breaks.
98103
5. **Programming Summary** *(optional)* — per-session parameter ranges.

docs/workflow_session.rst

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,20 @@ Both the **Left** and **Right** hemispheres have independent parameter panels.
121121
Baseline Clinical Scales
122122
^^^^^^^^^^^^^^^^^^^^^^^^^
123123

124-
Below the stimulation parameters you will find a panel for baseline clinical
125-
scale scores (e.g. UPDRS, MADRS, Y-BOCS). These are populated from the
126-
scale preset you selected in the previous step.
124+
Below the stimulation parameters you will find a panel for **baseline clinical
125+
scales** (validated rating instruments recorded once at the start of the
126+
session). Click a **preset button** (OCD, MDD, PD, ET, Dystonia, TS) to load
127+
the standard scale set for that indication, or use the settings control to
128+
customise presets.
129+
130+
Built-in clinical presets (Step 1):
131+
132+
* **OCD** — Y-BOCS, Y-BOCS-o, Y-BOCS-c, MADRS, OCI-R
133+
* **MDD** — MADRS, HAM-D, BDI-II
134+
* **PD** — MDS-UPDRS, UPDRS-III, PDQ-39, UDysRS
135+
* **ET** — FTM-TRS, TETRAS
136+
* **Dystonia** — BFMDRS, TWSTRS
137+
* **TS** — YGTSS, PUTS, TS-CGI, Y-BOCS
127138

128139
Each scale has a **slider** with arrow buttons and a numeric display. Press
129140
the **** button on a slider to mark that scale as "not assessed" (stored as
@@ -148,19 +159,25 @@ stimulation configuration tested).
148159
Built-in presets
149160
^^^^^^^^^^^^^^^^
150161

151-
Use the preset buttons to load a standard scale set for your clinical
152-
indication:
162+
Use the preset buttons to load a standard **session scale** set (rated at each
163+
stimulation configuration during programming). All built-in session scales use
164+
a **0–10** numeric range with slider controls.
153165

154-
* **OCD** — Y-BOCS, Anxiety VAS, Mood VAS
155-
* **MDD** — MADRS, Anxiety VAS, Mood VAS, Energy VAS
156-
* **PD** — UPDRS-III, Dyskinesia VAS, Mood VAS
157-
* **ET** — Tremor VAS, Mood VAS
166+
* **OCD** — Obsessions, Compulsions, Anxiety, Mood, Energy
167+
* **MDD** — Rumination, Anxiety, Mood, Energy
168+
* **PD** — Tremor, Rigidity, Bradykinesia, Dyskinesia, Gait / balance,
169+
Paresthesia, Speech difficulty
170+
* **ET** — Action tremor, Resting tremor, Paresthesia, Speech difficulty
171+
* **Dystonia** — Muscle contractions, Abnormal posture, Pain
172+
* **TS** — Tic severity, Premonitory urge, Control over tics, Anxiety,
173+
Impulsivity
158174

159175
Custom scales
160176
^^^^^^^^^^^^^
161177

162178
Click **+ Add scale** to define a custom scale with a name and a numeric
163-
range. Custom scales are saved for the current session.
179+
range (min / max). Custom scales are saved for the current session via the
180+
session-scales settings dialog.
164181

165182
----
166183

@@ -225,12 +242,19 @@ Before the file-save dialog appears, two dialogs will be shown:
225242
:width: 500px
226243

227244
2. **Report Sections** — choose which sections to include in the report.
228-
All four sections are checked by default:
245+
By default all main sections are checked. Under **Session Data** you can
246+
include the timeline chart, the lateral data table, or both:
247+
248+
* **Initial Clinical Notes** — baseline scores and Step 1 notes
249+
* **Session Data** — parent section; expand to choose:
250+
251+
* **Session Data Graph** — timeline chart of session-scale values across
252+
recorded configurations (best entry highlighted per scale)
253+
* **Session Data Table** — lateral table (L/R rows) with stimulation
254+
parameters, scale values, and notes
229255

230-
* Initial Clinical Notes
231-
* Session Data
232-
* Electrode Configurations
233-
* Programming Summary
256+
* **Electrode Configurations** — initial vs final contact diagrams
257+
* **Programming Summary** — session duration and parameter ranges
234258

235259
.. image:: _static/report_sections_dialog.png
236260
:alt: Report sections dialog
@@ -243,9 +267,12 @@ Report Contents
243267

244268
The generated report includes (depending on the selected sections):
245269

246-
* **Initial Clinical Notes** — baseline scale scores and initial notes.
247-
* **Session Data** — table of all recorded entries with stimulation
248-
parameters, scale values, and notes. The best entry is highlighted.
270+
* **Initial Clinical Notes** — baseline clinical scale scores and initial
271+
notes from Step 1.
272+
* **Session Data** — optional **timeline chart** (one line per session scale,
273+
x-axis = configuration block) and/or **data table** of all recorded entries
274+
with stimulation parameters, scale values, and notes. The best entry per
275+
scale is highlighted in green according to your optimisation choices.
249276
* **Electrode Configurations** — visual diagrams showing the initial and
250277
final electrode contact selection (Left and Right hemispheres).
251278
* **Programming Summary** — session duration, number of configurations

0 commit comments

Comments
 (0)