-
Notifications
You must be signed in to change notification settings - Fork 1
feat: name leftover residual on period-report pair rows (v2.12.16) #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
seonghobae
merged 5 commits into
worktree-fix-frontend-build-break
from
feat/leftover-residual-disclosure-v21212
Aug 23, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c4f1b8b
feat: name leftover residual on period-report pair rows (v2.12.12)
seonghobae accc33f
fix(frontend): repair the inherited login/admin-panel build break
seonghobae 71fe6e7
Merge PR #426 current head into #502 stack
seonghobae 70ee21f
Merge PR #426 current head into #502 stack
seonghobae ffbf5a2
docs: align residual architecture contract
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # 2.12.16 leftover residual disclosure | ||
|
|
||
| After `make seed`, closest and farthest leftover pairs sit above the | ||
| period-report member list with signed residual `R`, observed `Y`, | ||
| expected `E`, full leftover-map rank, and two-axis distance `d`. | ||
| Read the named evidence, then click the pair to open that post. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # ADR 0162 — Disclose leftover residual on period-report pair rows | ||
|
|
||
| **Decision status:** Accepted | ||
| **Date:** 2026-08-23 | ||
|
|
||
| ## Context | ||
|
|
||
| ADR 0048 already persists `leftover_distance` (Euclidean leftover-map | ||
| gap from the Gabriel biplot of `R`) and `leftover_residual` | ||
| (`R = Y − E[Y|θ, item]`) on `report_leftover_pair`. ADR 0049 already | ||
| renders closest and farthest pairs above the member list and opens the | ||
| named post. The pair button showed only `d`, so a buyer could not tell | ||
| a large leftover response from a merely distant map pair. | ||
|
|
||
| Jeon et al. (2021, eq. 3) leftover interaction is | ||
| `−γ‖ξ_p − ζ_i‖`. Distance is that map gap. Residual is the observed | ||
| leftover *after IRT main effects* that entered the biplot. They are | ||
| different quantities. Hiding residual would keep the persisted column | ||
| as an unpublished measurement. | ||
|
|
||
| This increment does not persist leftover-map coordinates (ADR 0121 / | ||
| PR #481) and does not land Post quality on the leftover criterion | ||
| (ADR 0125 / PR #485). | ||
|
|
||
| ## Decision | ||
|
|
||
| Each leftover pair button shows: | ||
|
|
||
| 1. closest or farthest label, post title, and criterion short label; | ||
| 2. leftover residual `R` with an explicit sign, two decimal places; | ||
| 3. observed `Y`, expected `E`, full leftover-map rank, and two-axis | ||
| distance `d` when those later ADR 0163/0164 fields are available; | ||
| 4. one next action that retains every available measurement before | ||
| opening the post to read the named criterion. | ||
|
|
||
| Missing leftover rows still render nothing. A non-finite residual | ||
| renders an em dash rather than a fabricated leftover score. Click | ||
| still uses the same post-open handler as ADR 0049. | ||
|
|
||
| ## Consequences | ||
|
|
||
| `GET /api/reports/{grouping}/{period}` already returns | ||
| `leftover_residual`. The frontend now names that value. After | ||
| `make seed`, closest and farthest leftover pairs sit above the member | ||
| list with `R`, `Y`, `E`, rank, and `d`; click opens that post. | ||
|
|
||
| ## Related | ||
|
|
||
| Amends [ADR 0049](0049-leftover-pair-report-ui.md). Depends on | ||
| [ADR 0048](0048-persist-lsirm-leftover-pairs.md) and | ||
| [ADR 0003](0003-fast-mlsirm-report-integration.md). Independent of | ||
| leftover interaction-map persistence and leftover-criterion evaluation | ||
| landing. | ||
|
|
||
| ## References | ||
|
|
||
| Gabriel, K. R. (1971). The biplot graphic display of matrices with | ||
| application to principal component analysis. *Biometrika, 58*(3), | ||
| 453–467. https://doi.org/10.1093/biomet/58.3.453 | ||
|
|
||
| Jeon, M., Jin, I. H., Schweinberger, M., & Baugh, S. (2021). Mapping | ||
| unobserved item–respondent interactions: A latent space item response | ||
| model with interaction map. *Psychometrika, 86*(2), 378–403. | ||
| https://doi.org/10.1007/s11336-021-09762-5 |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import type { Meta, StoryObj } from "@storybook/react-vite"; | ||
| import { LeftoverPairList } from "./LeftoverPairList"; | ||
|
|
||
| const meta = { | ||
| title: "Reports/LeftoverPairList", | ||
| component: LeftoverPairList, | ||
| args: { | ||
| criterionLabel: (code: string) => | ||
| code === "sales_lead_quality" ? "sales-lead" : "negative", | ||
| onSelectPost: () => undefined, | ||
| pairs: [ | ||
| { | ||
| pair_kind: "closest", | ||
| post_id: "post-demo-public", | ||
| post_title: "Public post", | ||
| criterion_code: "sales_lead_quality", | ||
| leftover_distance: 0.12, | ||
| leftover_residual: 0.4, | ||
| observed_response: 2.4, | ||
| expected_response: 2.0, | ||
| leftover_map_rank: 1, | ||
| }, | ||
| { | ||
| pair_kind: "farthest", | ||
| post_id: "post-demo-spec", | ||
| post_title: "Specification revision requested", | ||
| criterion_code: "negative_sentiment", | ||
| leftover_distance: 1.84, | ||
| leftover_residual: -1.1, | ||
| observed_response: 0.9, | ||
| expected_response: 2.0, | ||
| leftover_map_rank: 1, | ||
| }, | ||
| ], | ||
| }, | ||
| } satisfies Meta<typeof LeftoverPairList>; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| export const ClosestAndFarthest: Story = {}; | ||
|
|
||
| export const Empty: Story = { | ||
| args: { | ||
| pairs: [], | ||
| }, | ||
| }; |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.