Skip to content

Keep the injection site off doses that were not injected - #135

Merged
suskozaver merged 1 commit into
ArunNGun:betafrom
suskozaver:a-site-belongs-to-an-injection
Sep 17, 2026
Merged

suskozaver merged 1 commit into
ArunNGun:betafrom
suskozaver:a-site-belongs-to-an-injection

Conversation

@suskozaver

Copy link
Copy Markdown
Collaborator

Reported as a box of tablets showing an injection site in the Log. It was, and so was every nasal spray, and every oral or topical dose before them.

What was happening

The form suggests a site the moment a compound is chosen, so that rotation happens by default. It then wrote that suggestion into the record whatever route the dose turned out to take. The field itself was hidden for a pack and for a spray, which made the screen look right and left the data wrong.

Those records also counted. A swallowed tablet consumed a site's rest and pushed the next real injection somewhere else.

The rule

routeHasSite in calc/sites.ts, where the rotation lives. Subcutaneous and intramuscular have a site; oral, intranasal, topical and intravenous do not. Lipohypertrophy is what that module is about, and none of the others cause it.

Four call sites, which is three more than it looks:

  • the log form hides the field and the body map, and writes no site
  • the quick log on Today writes none, and offers no sites to rotate to
  • siteUsage ignores a record whose route has no site
  • the Log and the history list stop printing one

The third is why this is not simply a validation fix. Records already carry a site they should never have had. Filtering at the point of reading leaves the record as it was written, which is the honest thing to keep, and stops it counting, which is the honest thing to do with it. No migration, nobody's history edited.

Two things that fall out

A compound that comes as tablets now offers oral among its routes, on the same reasoning that a filled spray bottle offers intranasal: evidence rather than permission, and without it the only route on offer for a pack could be one involving a needle.

A dose with no protocol now defaults to oral for a tablet rather than to subcutaneous. That default was what fed the wrong site in the first place.

Worth a second opinion

This also removes the site from oral, topical and intravenous doses, not just from tablets and sprays. I think that is right for the same reason, but it is a behaviour change beyond what was reported, so it is the part to push back on if you disagree.

Checks

npx tsc --noEmit clean, npx next lint clean, 1709 tests pass (5 new), and again under TZ=America/New_York. Reasoning in 05-decisions.md.

Reported as a box of tablets showing an injection site in the Log. It
was, and so was every nasal spray, and every oral or topical dose
before them.

The form suggests a site the moment a compound is chosen, so that
rotation happens by default, and then wrote that suggestion into the
record whatever route the dose turned out to take. The field was
hidden for a pack and for a spray, which made the screen look right
and left the data wrong. Those records also counted: a swallowed
tablet consumed a site's rest and pushed the next real injection
somewhere else.

routeHasSite names the rule, in calc/sites.ts where the rotation
lives. Subcutaneous and intramuscular have a site. Oral, intranasal,
topical and intravenous do not, because lipohypertrophy is what this
module is about and none of them cause it.

Four call sites, which is three more than it looks. The form hides the
field and the map and writes no site. The quick log on Today writes
none and offers no sites to rotate to. siteUsage ignores a record
whose route has no site, which corrects the rotation for history
already written without editing anyone's records. The Log and the
history list stop printing one.

That third is why this is not just a validation fix. Records already
carry a site they should never have had. Filtering at the point of
reading leaves the record as written, which is the honest thing to
keep, and stops it counting, which is the honest thing to do with it.

Two smaller things fall out. A compound that comes as tablets now
offers oral among its routes, on the same reasoning that a filled
spray bottle offers intranasal: evidence rather than permission. And a
dose with no protocol defaults to oral for a tablet rather than to
subcutaneous, which is what was feeding the wrong site to begin with.
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Arun's projects Team on Vercel.

A member of the Team first needs to authorize it.

@suskozaver
suskozaver merged commit a0ac88f into ArunNGun:beta Sep 17, 2026
1 of 2 checks passed
@suskozaver
suskozaver deleted the a-site-belongs-to-an-injection branch September 17, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant