tms-tracker

TMS Tracker (Excel on the web add-in)

A light augmentation over the organization’s TMS patient tracker template. Information stays where the template already keeps it, and the add-in adds a small, recognizable layer. It runs in Excel on the web; desktop add-ins are not available at the organization.

Staff install and day-to-day use: see GUIDE.md.

Status

Version 1.2 follows the reformatted MagV template (the “MagV Template” workbook): the add-in writes only into the template’s own cells.

Tested with fictional patients:

Not yet run in Excel on the web. Test on a copy of the real workbook first.

Repo contents

Path What it is
manifest.xml Office add-in manifest (version 1.2). Requires ExcelApi 1.9, which Excel on the web supports. Points to the GitHub Pages pilot host, https://brendannyates.github.io/tms-tracker, served from main.
taskpane.html, taskpane.js The add-in. A single static page with no build step.
benefits.js, tests/ Sohar benefits import: matching and plan (pure functions) and their tests.
schedule.html The patient schedule printout, shown over the add-in: print or save as PDF.
assets/ Ribbon icons (from the logo mark), the clinic logo used on printouts, and the NextGen export icon shown in the report directions.
scripts/set-host.mjs Rewrites whatever host the manifest currently points to.
package.json Helper scripts: certs, start, validate, check, set-host.

The files contain no PHI. .gitignore blocks spreadsheets and CSVs so a real workbook or NextGen export is never committed by accident.

Setup

Pilot (GitHub Pages): the committed manifest already points to the Pages host. Upload it in Excel on the web: Insert > Add-ins > Upload My Add-in. Changes go live when they merge to main.

Try it locally:

  1. npm run set-host -- https://localhost:3000 (don’t commit that change), npm run certs (once), then npm start.
  2. In Excel on the web: Insert > Add-ins > Upload My Add-in > manifest.xml.
  3. Open the add-in from the ribbon (Home > TMS). If tabs don’t match New Template, the banner offers Match New Template.

Deploy for the team:

  1. Host the folder on an internal HTTPS location approved by Product/Engineering.
  2. Run npm run set-host -- https://YOUR-HOST/tms-tracker-addin.
  3. Run npm run validate.
  4. Have the Microsoft 365 admin deploy manifest.xml through Integrated Apps, or share it for Upload My Add-in.
  5. Bump <Version> in the manifest whenever the hosted files change, so Excel picks up the update.

Where things live on a patient tab

New Template owns the layout. The add-in reads and writes these cells; benefits and cost by code live on the Benefits tab, one row per MRN.

Cells Purpose
A2, A4, A6 LASFIR, MRN, DOB.
D2 / D4 / D6 / D7 # of TXs (authorized treatments, extensions included), # of MT redos, MD required on-site, Status.
E2 / E4 / E6 Provider (set from the appointment list on import), care navigator (TAS), insurance.
F4:G4, G2, G6 Auth start and expiry, update protocol by, progress note sent on.
J2:O4, N5 Protocol rows 1 to 3 (Hz, pulses per train, trains, wait; N calculates minutes; O is the site) and the total duration.
N6 / N7 Freebie Count (freebies left, 3 on a new tab); auth assessment. Using a freebie takes one off N6, undoing it gives it back.
A10:A49 (PR) The visit log is A10:T49 in the template and can grow on import (see Import). Patient responsibility per visit, by visit type in L (follow-ups by whether Notes says “tele”). It reads the patient’s Benefits row by the MRN in A4 (blank when there is none). With a deductible remaining, visits charge the before-deductible cost in date order until the deductible is used up; the visit that crosses it pays what is left plus PR on the rest; then PR. Missed visits show no charge.
B / C / E / F, H, J Treating technician, Tx #, date, pulses Left / Right / Other. Pulses entered = treatment delivered.
L / M / O / P, Q / R / S / T Visit type, Miss x, Action, PHQ-9 and GAD-7 (x = placeholder), Alt Clinic x, Notes, appointment time.
S (Notes) “Tele” marks a telehealth follow-up. A missed visit’s freebie decision is “Freebie used” or “Freebie waived”. The MT row also holds the MT details. “Schedule provided m/d” is written when a schedule is given.
S9 Home Clinic. Anything other than SRL makes the patient external.
Row after the log (B: TX SUMMARY) Closes the log. Ticking the checkbox in A turns the row green.
W20:X24, V29:Y48 Weekly availability (earliest and latest start, Monday to Friday) and dates (Unavailable / Available, from, to, reason).

Benefits tab (one row per MRN, the newest course’s tab in Patient): BIDF estimated course cost; deductible remaining and out-of-pocket max remaining (each an amount or N/A); MTR approved (with D4, decides whether 90869 is authorized; set to Yes on refresh when D4 is 1 or more); extensions added; last schedule provided; cost by code (PR, then before the deductible) for 90867 MT, 90868 Daily, 90869 MT redo, 99214 F/U in-office and telehealth; Last updated, set to today whenever the add-in or a Sohar import changes or verifies the row. The add-in still calls these W1, W4 to W8 and X12:Y16 inside (the cells they used to have), and sends those writes to the Benefits row.

Match New Template (the banner, or Settings for every active tab) brings active trackers (see the cutoff in Settings) in line with New Template: header formats, Freebie Count in N6 and the auth assessment in N7, benefits moved from V1:Y16 to the Benefits tab (availability stays on the tab), the PR formula over the whole log, the template’s formulas on log rows that lost them, the TX SUMMARY row and its checkbox, New Template’s conditional formats (colors by visit type in L, Action in O, Miss, Alt Clinic, auth dates) and dropdowns stretched to the last log row, then visit-log formatting and measures. The log’s last row is the row above TX SUMMARY, so rows added by hand count. Rows an import adds get the same rules. A PR cell is only replaced when it is blank or still holds a cost-table lookup; a typed amount stays. Tracker tabs from before the Benefits tab are still read until they’re matched; finished ones are left as they are, and their benefits are copied to the Benefits tab so it lists every patient. Tabs in an earlier layout (for example the pilot’s Freebie and Time columns in T and U) are rebuilt: a fresh copy of New Template gets their entries, benefits, costs and availability, and every copied entry is read back from the new tab. When they all match, the earlier tab is deleted; if anything does not, it stays as “NAME (old)” and the add-in names the cells to check. Match New Template asks before rebuilding. A deleted tab can be recovered from the workbook’s version history.

Layout

Menu What it holds
Schedule A Day / Week toggle. Discontinued patients are left off here, in Attention, and in the Patients roster except its Discontinued filter. With more than one chair resource on the saved appointment list (for example Castro MagV1 and MagV2), a chair picker shows one chair or all; it applies to Day, Week and Clinic > Chair, is saved per computer, and chair conflicts are counted per chair. A visit’s chair is the resource booked that day, else the chair the patient’s daily treatments are usually on. Day opens on today; Prev and Next step through weekdays, and Back to today returns. Each day shows that weekday’s hours from the Clinic Schedule tab, or “Clinic closed” with the reason when the date is listed in column G. Attention is a section on the left when the pane is wide enough (about 640 px); on a narrow pane it collapses to the top with a count. Only groups with something in them show.
Patients The roster with filters: All (everyone but Discontinued), Active, Follow-up not scheduled, No upcoming visit, Discontinued. Add patient is here. Selecting a patient opens the patient view.
Clinic Chair and Protocols.

Settings is its own screen (gear, top right): clinic location, device, warning days, recent-visit window, Rebuild Active Patients sheet (it rebuilds on its own; this forces it), Place measure placeholders and Fix visit-log formatting (see Import).

Full screen

Full screen (⛶) floats the tracker inside the Excel page, over the workbook (an Office dialog with displayInIframe). It never opens a separate browser window, and there is no new-window option. In full screen the header and menu tabs float on a frosted-glass bar, the page blurs as it scrolls under it, and ⛶ closes it. Everywhere, pop-ups (freebie, print, the schedule) and the ⋯ menus blur the add-in behind them; clicking the blurred area closes a menu. The workbook itself can’t be blurred: Office draws its own overlay behind the in-page window.

The in-page window can’t reach the workbook in Excel on the web, so it sends every read and save through the pane: keep the pane open while you use it. The pane shows a notice, and Close full screen closes it.

Today

Week

Monday to Friday visits with a one-line variance summary per day.

Attention

Patients

Clinic

Chair (hours and holiday closures come from the Clinic Schedule sheet) and Protocols.

Active Patients sheet

The add-in rebuilds this sheet in the Patients roster layout for the current week (Sunday to Saturday, showing Monday to Friday). It runs on open and after any change, and skips the rewrite when nothing changed.

Import

Sohar benefits import

Import list > Import Sohar benefits takes the “Benefits (TMS Tracker)” file from the Sohar Eligibility add-in (or its Sohar Results sheet saved as CSV; discovery rows are ignored). Matching and the plan live in benefits.js, which has tests in tests/ (npm test).

Measures placeholders

Schedule printout

Print schedule (in a visit card’s ⋯ menu, Print course schedule on every MT card, or Print or save schedule in the patient view) opens a pop-up to choose the visits: Next 14 days (default), Next 30 days, Rest of course, or any From / To range. It shows how many visits fall in the range.

Open schedule shows the schedule over the add-in on a blurred backdrop (schedule.html in a frame), not in a workbook tab or a separate window. Nothing is added to the workbook. It shows the clinic logo centered over the table, the report’s “As of” time, and the visits (no patient-name column).

Either one writes “Schedule provided m/d” to Notes and the date to W8. The schedule contains the MRN, so keep it only where PHI is allowed.

Open items