Repository navigation
Medication schedule on each card and a daily Teams reminder - #20
Merged
Merged
Conversation
Upgrade the specify CLI project files from 0.9.4 to 1.1.0: refreshed Claude integration skills (adds speckit-converge), shared PowerShell scripts and templates, and the git (1.0.1) and agent-context (1.0.2) extensions. Ignore the extension catalog cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inder Specify and plan feature 004: a schedule section at the bottom of each medication card (last taken, injection site, next intake) and a daily email reminder with follow-ups after a missed intake. Includes research, data model, contracts (schedule rules, card UI, reminder flow, privacy and deployment) and a validation quickstart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Biweekly medication counted as scheduled on all seven days of every other week because the rule never checked the scheduled day. It now has one Dose per "on" block: the scheduled day, or the anchor's weekday when none is set. Also read the date-only ppa_startdate as its calendar day instead of UTC midnight, which was the previous day west of UTC. The rule moves to isScheduledOn in src/lib/schedule.ts, which scheduledDosesOnDay now calls. Remove the unused weeksBetween helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Biweekly fix Record the owner's decisions in the plan artifacts: time zone read from an environment variable in the trigger condition, Mail connector for sending, and the deployment service principal as flow owner. Note the completed Biweekly fix and that the start date is a date-only value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 tasks grouped by user story: schedule section on each card (US1), daily email (US2), follow-ups after a missed intake (US3), then review and production rollout. The Biweekly fix is recorded as done. Align the plan and schedule-rules contract with the tasks: the decision table fixture is JSON so Vitest and the seed script share it, and a schema script is added to the script list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
C1: add a live check of the two new queries against dev (new task T020, later tasks renumbered to T055) and state in the plan that Vitest covers query shape only. C2: a failed schedule load raises one de-duplicated Sonner error toast in addition to the in-card Retry. I1: call a medication with a missed intake "Past Due" on its card; "Overdue" keeps its existing meaning on Home. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setup and foundations for spec 004 (T001, T002, T004-T006): - gitleaks rule `email-address` flags any committed address outside the example.com / example.org / noreply allowlist; OData annotations and the git SSH user are excluded. Tree and history both scan clean. - tests/fixtures/schedule-cases.json holds one case per decision-table row S01-S33, with every date and weekday stored as an offset from today. - CONTEXT.md gains Past Due, Next Intake, Missed Intake, Follow-up and Reminder Run. - solution/deployment-settings.json is git-ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
User Story 1 of spec 004 (T007-T019). - computeSchedule in src/lib/schedule.ts is the reference implementation of the schedule rules: rolling for an Injection with a Taken or Skipped log, fixed otherwise, with Past Due and follow-up days derived from the missed due date. It is tested against all 33 rows of the decision table. - useMedicationSchedule reads the latest Taken and latest Skipped log per Medication with two top-1 queries cached under ['intakelogs', 'latest'], so the existing intake-log mutations invalidate them. An unsuccessful result is an error, never "no logs". - MedicationSchedule renders the section as the last block of the card: skeleton rows while loading, and an in-card message with Retry plus one de-duplicated error toast when the load fails. - Mock mode honours the status filter, orderBy and top, and seeds one card of each schedule kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
User Story 2 of spec 004, the parts that need no cloud flow yet (T021-T027, T030, T036-T040, T043). Scripts the owner runs by hand (scripts/reminder): - create-reminder-schema.ps1 creates the ppa_ReminderRun table with its alternate key, the two environment variable definitions and the two connection references in MedTrackSolution. Run against dev. - set-reminder-recipient.ps1 prompts for the address with hidden input and stores it outside the solution, so an export cannot contain it. - seed-reminder-scenarios.ps1 seeds the decision table from the Vitest fixture; assert-reminder-run.ps1 checks the day's Reminder Run. Pipeline: - assert-no-envvar-values.ps1 fails on an environment variable value file or a non-allowlisted address; it runs on solution/src in CI and on the exported zip before the artifact upload in promote-prod. - Deploys render a deployment settings file for the connection references and time zone, then confirm the flow is on and owned by the service principal. Research R5 is verified in dev: a trigger condition can read the time-zone environment variable, and reads its current value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Spec 004 tasks T031-T033, T048, T050. The "MedTrack – Daily Reminder" flow now exists in dev inside MedTrackSolution, turned off, with unique name ppa_MedTrackDailyReminder. It is not in solution/src yet: that follows the first real run (T034, T035). Its schedule logic, guard and failure handling were run in dev in a copy with stand-in connector steps and match the decision table; the connector steps themselves have not run. research.md records the detail. Findings recorded for the owner: - A manual test obeys the trigger condition, so it only starts a run in local hours 0-3. A verified way to test at other times is documented. - A flow cannot be turned on while ppa_ReminderRecipientEmail has neither a default nor a value. The README setup order now reflects that; a recommended design change is described but not applied. Fixes from review and from running the scripts against dev: - assert-reminder-run.ps1 reported a mismatch when an expected list was empty. - seed-reminder-scenarios.ps1 refuses any environment other than dev unless -AllowNonDev is passed. - The hook's result type no longer shares the component's name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The owner created the two connections and set the address, and the flow ran for real in dev against the seeded decision table (T034, still open). - WhoAmI is a Dataverse function and cannot be called through the connector, so the flow now filters Medications with EqualUserId on ownerid. The contract and research R11 are updated to match. - Guard, owner filter and schedule rules gave the nine expected due rows from real data. - The send failed with HTTP 401: the Mail connector is restricted for new tenants. The failure was recorded as designed. Research R7 is open again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Mail connector is refused for new tenants (HTTP 401 on the first real run), so the connection reference ppa_MedTrackMail now targets Office 365 Outlook and the email is sent from the owner's mailbox. - create-reminder-schema.ps1 creates the reference for shared_office365 and moves an existing one that still targets the old connector - deployment settings template uses the new connector id - research R7, contracts, data model, plan and README updated The flow definition in dev still has to be updated: it cannot be saved until an Office 365 Outlook connection is bound to the reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- research R10: follow-up rules and email sections verified in a connection-free copy of the flow (tasks T044, T045 logic) - tasks: T029 done by the owner; T028 names the Office 365 Outlook connection Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found by the visual QA pass (tasks T049): a name with no break opportunity overflowed the card and pushed Edit and Delete out of reach. The name can now break anywhere and the buttons do not shrink. The QA record is added to the schedule section's UI contract. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unmanaged export from dev, unpacked into solution/src (tasks T035): the Reminder Run table, the "MedTrack – Daily Reminder" flow, the two environment variable definitions (no values) and the two connection references. Solution version 1.0.0.2. The flow sends with Office 365 Outlook. A real run in dev recorded outcome Sent with the nine expected due rows; research R10 has the details. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The flow now lists a missed intake on the 1st, 3rd, 5th and 7th day after it was due, in a "Follow-ups" section, longest past due first. A Medication that is due today is listed as due only. Subject and Reminder Run record carry both counts. Exported from dev into solution/src as version 1.0.0.3 (tasks T044 to T046, export part of T047). Verified against the decision table in dev; research R10 has the runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Email could not be delivered: the owner's mail provider refused every message from the new tenant (554 5.7.1, rejected due to local policy). The reminder is now posted by the Flow bot in a Teams chat with the user behind the Dataverse connection, which reaches the phone as a notification. - flow: look up the connection's own user at run time and post to them; first line holds counts only; "Open MedTrack" link at the end - no address is stored any more: ppa_ReminderRecipientEmail, the ValidateRecipient step and set-reminder-recipient.ps1 are removed - new environment variable ppa_MedTrackAppUrl (default not-configured), rendered in the pipeline from PP_ENVIRONMENT_ID and PP_APP_ID - connection reference ppa_MedTrackTeams replaces ppa_MedTrackMail; pipeline variable PP_CONN_TEAMS_ID replaces PP_CONN_MAIL_ID - solution source exported from dev at version 1.0.0.4 - README, contracts, data model, research, quickstart, spec and tasks updated; T034 closed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment in configure-reminder-flow.ps1 pointed at scripts/deploy/auth.ps1, which the Power Apps CLI change removes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The deployment-settings import and service-principal-owned Teams flow remain untested in the deployment path and require human validation.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds medication schedule details to MedTrack cards and a daily Teams reminder, with deployment configuration and privacy checks.
Changes:
- Displays last-taken and next-intake details, supported by tests and mock scenarios.
- Packages reminder infrastructure and integrates configuration into deployment pipelines.
- Updates reminder documentation and Spec Kit tooling.
| File | Description |
|---|---|
| tests/pages/medications.test.tsx | Tests card schedules and activation updates. |
| tests/lib/adherence.test.ts | Covers fortnightly scheduling boundaries. |
| src/mocks/mock-intakelogs-service.ts | Supports latest-log queries. |
| src/mocks/mock-data.ts | Adds schedule demonstration scenarios. |
| src/lib/date-utils.ts | Removes obsolete week calculation. |
| src/lib/adherence.ts | Uses shared scheduling logic. |
| src/hooks/use-medication-schedule.ts | Loads logs and computes schedules. |
| src/components/medications/medication-schedule.tsx | Renders schedule details and states. |
| src/components/medications/medication-card.tsx | Embeds schedules and improves wrapping. |
| specs/004-schedule-page-reminders/contracts/reminder-flow.contract.md | Defines reminder execution and messages. |
| specs/004-schedule-page-reminders/contracts/privacy-and-deployment.contract.md | Documents privacy and deployment requirements. |
| specs/004-schedule-page-reminders/checklists/requirements.md | Records requirements validation. |
| solution/src/Workflows/MedTrackDailyReminder-B148B1E4-91C0-F111-AAAF-70A8A59D4F56.json.data.xml | Registers reminder workflow metadata. |
| solution/src/Other/Solution.xml | Adds components and updates version. |
| solution/src/Other/Relationships/Team.xml | Adds Reminder Run team ownership. |
| solution/src/Other/Relationships/SystemUser.xml | Adds user and audit relationships. |
| solution/src/Other/Relationships/Owner.xml | Adds Reminder Run ownership relationship. |
| solution/src/Other/Relationships/BusinessUnit.xml | Adds business-unit relationship. |
| solution/src/Other/Relationships.xml | Registers Reminder Run relationships. |
| solution/src/Other/Customizations.xml | Adds Dataverse and Teams connection references. |
| solution/src/environmentvariabledefinitions/ppa_ReminderTimeZone/environmentvariabledefinition.xml | Defines reminder time-zone configuration. |
| solution/src/environmentvariabledefinitions/ppa_MedTrackAppUrl/environmentvariabledefinition.xml | Defines reminder app-link configuration. |
| solution/src/Entities/ppa_ReminderRun/SavedQueries/{ef558cf5-8cc0-f111-aaaf-70a8a59d4f56}.xml | Adds personal Reminder Run query. |
| solution/src/Entities/ppa_ReminderRun/SavedQueries/{c8dd43ff-8d7a-449d-9203-49c16d045346}.xml | Adds quick-find view. |
| solution/src/Entities/ppa_ReminderRun/SavedQueries/{8ac4e2bc-e95f-44a5-ba09-4974003819ec}.xml | Adds lookup view. |
| solution/src/Entities/ppa_ReminderRun/SavedQueries/{7c6208d9-f30f-4d24-9fe8-b2b5401f6aeb}.xml | Adds associated-record view. |
| solution/src/Entities/ppa_ReminderRun/SavedQueries/{2acd9a6c-f148-4e19-8e59-dc1243b5c5e5}.xml | Adds inactive-record view. |
| solution/src/Entities/ppa_ReminderRun/SavedQueries/{17ceac42-d18c-44a6-a231-6541485c7283}.xml | Adds active-record view. |
| solution/src/Entities/ppa_ReminderRun/SavedQueries/{06526c21-c127-4980-92f7-fa6667bc64ba}.xml | Adds advanced-find view. |
| solution/src/Entities/ppa_ReminderRun/RibbonDiff.xml | Adds default ribbon metadata. |
| solution/src/Entities/ppa_ReminderRun/FormXml/quick/{ad5cc0d2-e0dc-40cf-abea-0851d76eb702}.xml | Adds quick form. |
| solution/src/Entities/ppa_ReminderRun/FormXml/main/{f9fd3497-bf7a-4b74-809d-e3c3e051f617}.xml | Adds main form. |
| solution/src/Entities/ppa_ReminderRun/FormXml/card/{a9a4f43b-61b3-4f26-b7d8-65a2c267831a}.xml | Adds card form. |
| solution/deployment-settings.template.json | Templates environment-specific bindings. |
| scripts/deploy/configure-reminder-flow.ps1 | Checks ownership and activates reminder flow. |
| scripts/ci/render-deployment-settings.ps1 | Renders deployment configuration. |
| scripts/ci/assert-no-envvar-values.ps1 | Checks solution source and exported artifacts. |
| README.md | Explains reminders and setup. |
| CONTEXT.md | Defines scheduling domain terms. |
| .specify/templates/plan-template.md | Clarifies planning workflow documentation. |
| .specify/templates/checklist-template.md | Clarifies checklist ownership and semantics. |
| .specify/scripts/powershell/setup-tasks.ps1 | Updates task setup and template resolution. |
| .specify/scripts/powershell/setup-plan.ps1 | Updates plan setup and output fields. |
| .specify/scripts/powershell/resolve-template.ps1 | Adds template-content resolver. |
| .specify/integrations/speckit.manifest.json | Updates Spec Kit installation manifest. |
| .specify/integrations/claude.manifest.json | Updates Claude integration manifest. |
| .specify/integration.json | Records integration version upgrade. |
| .specify/init-options.json | Records Spec Kit version upgrade. |
| .specify/feature.json | Points to reminder feature. |
| .specify/extensions/git/scripts/python/initialize_repo.py | Adds Python repository initialization. |
| .specify/extensions/git/scripts/python/git_common.py | Adds Python branch-validation helpers. |
| .specify/extensions/git/scripts/python/auto_commit.py | Adds Python automatic commits. |
| .specify/extensions/git/scripts/powershell/git-common.ps1 | Supports namespaced feature branches. |
| .specify/extensions/git/scripts/powershell/auto-commit.ps1 | Supports generated commit-message files. |
| .specify/extensions/git/scripts/bash/initialize-repo.sh | Updates initialization status text. |
| .specify/extensions/git/scripts/bash/git-common.sh | Supports namespaced branch validation. |
| .specify/extensions/git/scripts/bash/auto-commit.sh | Supports generated messages and trimming. |
| .specify/extensions/git/README.md | Documents branch templates and commit styles. |
| .specify/extensions/git/extension.yml | Updates Git extension metadata. |
| .specify/extensions/git/config-template.yml | Adds branch and commit configuration. |
| .specify/extensions/git/commands/speckit.git.validate.md | Documents namespaced validation. |
| .specify/extensions/git/commands/speckit.git.feature.md | Updates branch-creation instructions. |
| .specify/extensions/git/commands/speckit.git.commit.md | Documents safe message-file transport. |
| .specify/extensions/agent-context/README.md | Documents optional context management. |
| .specify/extensions/agent-context/extension.yml | Updates context extension version. |
| .specify/extensions/agent-context/commands/speckit.agent-context.update.md | Documents multiple context files. |
| .specify/extensions/agent-context/agent-context-defaults.json | Maps integrations to context files. |
| .specify/extensions/.registry | Updates registered extension metadata. |
| .specify/extensions.yml | Adds explicit hook priorities. |
| .specify/.gitignore | Ignores machine-local state. |
| .gitleaks.toml | Adds email-address scanning rule. |
| .gitignore | Excludes rendered deployment settings. |
| .github/workflows/promote-prod.yml | Adds bindings, artifact checks and activation. |
| .github/workflows/deploy.reusable.yml | Configures reminder deployment. |
| .github/workflows/ci.yml | Checks solution content during CI. |
| .claude/skills/speckit-taskstoissues/SKILL.md | Adds issue deduplication instructions. |
| .claude/skills/speckit-tasks/SKILL.md | Updates templates, hooks and constraint handling. |
| .claude/skills/speckit-plan/SKILL.md | Aligns planning output and hooks. |
| .claude/skills/speckit-implement/SKILL.md | Makes checklist gates read-only. |
| .claude/skills/speckit-git-validate/SKILL.md | Documents namespaced feature validation. |
| .claude/skills/speckit-git-remote/SKILL.md | Updates author metadata only. |
| .claude/skills/speckit-git-initialize/SKILL.md | Updates author metadata only. |
| .claude/skills/speckit-git-feature/SKILL.md | Documents branch templates and scripts. |
| .claude/skills/speckit-git-commit/SKILL.md | Documents generated commit messages. |
| .claude/skills/speckit-clarify/SKILL.md | Improves questions and hook handling. |
| .claude/skills/speckit-checklist/SKILL.md | Defines reviewer-owned checkbox lifecycle. |
| .claude/skills/speckit-analyze/SKILL.md | Requires specification and explicit hooks. |
| .claude/skills/speckit-agent-context-update/SKILL.md | Documents multi-file context updates. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # `ppa_Medication@odata.bind`, `x@odata.type`, `x@OData.Community.Display.V1.FormattedValue` | ||
| '''(?i)@odata\.''', | ||
| # `x@Microsoft.Dynamics.CRM.lookuplogicalname` | ||
| '''@Microsoft\.''', |
Comment on lines
+72
to
+75
| 1. **Fetch existing issues for deduplication**: Before creating anything, build the set of task IDs you are about to process from `tasks.md` (each is a `T` followed by **at least** three digits, e.g. `T001` — `/speckit-converge` assigns new IDs with `T{M+1:03d}`, which is a floor rather than a cap, so once a file has more than 999 tasks the IDs are four digits or longer). Then use the GitHub MCP server's `list_issues` tool to look for issues that already cover those IDs. Do not pass a `state` value, since omitting it makes the tool return both open and closed issues. Request `perPage: 100` to keep the number of calls down, and since the tool uses cursor-based pagination, request pages with the `after` parameter (using the `endCursor` from the previous response). For each issue title, match it against the task ID pattern `\bT\d{3,}\b` (the `{3,}` accepts four-digit and longer IDs — with `\d{3}` a title containing `T1000` would not match at all, because the trailing `\b` cannot fall between two digits, so that task would be silently neither deduplicated nor created; word boundaries still stop a token like `ST001` from matching, and force the whole digit run to be consumed so `T100` can never match inside `T1000`; this also recognises titles written as `T001 ...`, `T001: ...` or `[T001] ...`) and, when it matches one of your task IDs, mark that ID as already having an issue. Stop paginating as soon as every task ID has been matched, or when there are no more pages, so you do not keep fetching the whole repository's issue history once all task IDs are accounted for. This bounds the number of calls on repos with large issue histories and still prevents duplicates when the command is re-run after `tasks.md` is regenerated or the skill is re-invoked. | ||
| 1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote. Task lines in `tasks.md` start with a markdown checkbox, so first strip the leading `- [ ]` (and any `[P]` / `[US#]` markers) to recover the task ID and its description. Create the issue with a single canonical title of the form `T001: <description>`, with the ID written once followed by the task description (for example, the line `- [ ] T001 Create project structure` becomes the title `T001: Create project structure`). | ||
| - **Skip** any task whose ID is already present in the set of existing issues from the previous step, and report it (for example, `T001 already has an issue, skipping`). | ||
| - Only create issues for tasks that do not yet have a matching issue. |
…ship Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What this adds
Medications page. Each Medication card now ends with a schedule section: when it was last taken (with the injection site for injections) and when the next intake is due, with "Due today" and "Past Due" markers.
Daily reminder. A scheduled cloud flow, "MedTrack – Daily Reminder", checks once a day just after local midnight and posts one Microsoft Teams message to the person whose Medications are tracked:
Nothing due means no message. A new table, Reminder Run, records each day's outcome and keeps the check to one message a day.
Both parts apply the same rules, written down in
specs/004-schedule-page-reminders/contracts/schedule-rules.contract.mdand tested against one 33-row decision table.Change of plan during the work
The spec asked for an email. Two email connectors were built and dropped: the Mail connector is refused for new tenants, and mail sent through Office 365 Outlook was rejected by the recipient's mail provider. The reminder is a Teams message instead. One consequence is that no address is stored anywhere: the flow looks up the user behind its Dataverse connection at run time.
specs/004-schedule-page-reminders/research.md(R7) has the record.What is in the diff
src/lib/schedule.ts,src/hooks/use-medication-schedule.ts,src/components/medications/medication-schedule.tsx, and the card that hosts itsolution/src: the Reminder Run table, the flow, two environment variable definitions (no values) and two connection references; solution version 1.0.0.4scripts/reminder/: schema, seed and assert scripts for devscripts/ci/: deployment settings renderer and a check that no environment variable value or email address is in the solutionHow it was tested
Not yet tested, and exercised for the first time when this merges:
Before merging
deploy-devruns on merge. It needs, on the GitHubdevenvironment, the variablesPP_CONN_DATAVERSE_ID,PP_CONN_TEAMS_IDandREMINDER_TIME_ZONE, and both connections shared with the deployment service principal as "Can use". Without them the deploy stops before the solution import and changes nothing. Setup steps are in the README under "Daily reminder".Both Dataverse environments were backed up on 2026-10-05 with the label "Before spec 004 release".
🤖 Generated with Claude Code