Keep the injection site off doses that were not injected - #135
Merged
suskozaver merged 1 commit intoSep 17, 2026
Merged
Conversation
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.
|
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. |
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.
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
routeHasSiteincalc/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:
siteUsageignores a record whose route has no siteThe 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 --noEmitclean,npx next lintclean, 1709 tests pass (5 new), and again underTZ=America/New_York. Reasoning in05-decisions.md.