src/programs/snap-negative/review-template.ts
Linked repository file from this build.
import { fixtureReviewKey } from "./fixture-key";
import { normalizeReviewAnswers } from "./field-catalog";
import { CURRENT_CALC_VERSION, CURRENT_CHECK_VERSION } from "./rule-versions";
import type { Scenario, SnapReview } from "./types";
import { initialPolicy } from "./policy";
import { captureReceivedSnapshot } from "@/features/reviews/received-snapshot";
function scenario(wages: number): Scenario {
return {
populated: true,
householdSize: 3,
income: [
{
id: "wages",
memberId: "member-1",
typeCode: "11",
category: "earned",
amountCents: wages * 100,
expensesCents: 0,
description: "Fictional shop wages",
},
{
id: "support",
memberId: "member-2",
typeCode: "31",
category: "unearned",
amountCents: 20000,
expensesCents: 0,
description: "Fictional support; demo source code",
},
],
medicalDeductionCents: 0,
dependentCareCents: 10000,
childSupportCents: 0,
rentCents: 80000,
taxesInsuranceCents: 0,
installationCents: 0,
otherShelterCents: 0,
sua: "heating",
elderlyDisabled: false,
categoricalEligibility: false,
homeless: false,
};
}
export function createImportTemplate(): SnapReview {
return {
calcVersion: CURRENT_CALC_VERSION,
checkVersion: CURRENT_CHECK_VERSION,
id: fixtureReviewKey("60001"),
reviewNumber: "60001",
caseNumber: "SYN-200445566",
program: "SNAP",
subtype: "negative",
sampleMonth: "2026-04",
clientName: "Taylor Brooks (fictional)",
address: "100 Example Lane, Harrisburg, PA 17101",
county: "Dauphin",
district: "01",
localAgency: "Demo CAO",
examiner: "101",
supervisor: "201",
state: "new_active",
outcome: "error",
revision: 0,
facts: {
negativeAction: "Denial",
noticeDate: "2026-03-20",
actionDate: "2026-04-01",
inputsRevision: 0,
members: [
{ id: "member-1", line: "01", name: "Taylor Brooks", relationship: "Head" },
{ id: "member-2", line: "02", name: "Robin Brooks", relationship: "Child" },
{ id: "member-3", line: "03", name: "Jamie Brooks", relationship: "Child" },
],
scenarios: { eligibility: scenario(5000), compI: scenario(1800), compII: scenario(2300) },
answers: normalizeReviewAnswers({
actionType: "1",
narrative:
"The fictional CAO used income that differed from the examiner verification. Review the sample-month and last-action evidence.",
}),
},
notes: [],
documents: [],
activity: [],
};
}
export function demoScenarioTemplate(wages: number): Scenario {
return scenario(wages);
}
/** Small deterministic reset fixture that does not import the bulk seed generator. */
export function createDemoReviewTemplate(): SnapReview {
const review: SnapReview = {
policyId: initialPolicy.id,
policy: structuredClone(initialPolicy),
calcVersion: CURRENT_CALC_VERSION,
checkVersion: CURRENT_CHECK_VERSION,
id: fixtureReviewKey("60001"),
reviewNumber: "60001",
caseNumber: "44-6930881",
program: "SNAP",
subtype: "negative",
sampleMonth: "2026-09",
clientName: "Sarah Evans",
address: "5084 Pine Lane, Huntingdon, PA 16652",
county: "31",
district: "11",
localAgency: "Huntingdon County CAO",
examiner: "101",
supervisor: "201",
state: "new_active",
outcome: "",
revision: 0,
facts: {
negativeAction: "Termination",
noticeDate: "2026-08-28",
actionDate: "2026-09-08",
caoIssuedBenefitCents: 0,
members: [
["Sarah Evans", "Head"],
["Gary Gray", "Spouse"],
["Matthew Ruiz", "Sibling"],
["Donald Martin", "Sibling"],
["Jonathan Morris", "Child"],
["Melissa Wood", "Child"],
["Cynthia Brown", "Parent"],
["Michael Jackson", "Other"],
["Rebecca Williams", "Child"],
["Raymond Carter", "Other"],
["Ashley Hall", "Child"],
["Jennifer Parker", "Sibling"],
["Matthew Cook", "Child"],
["Donald Kelly", "Other"],
].map(([name, relationship], index) => ({
id: `member-${index + 1}`,
line: String(index + 1).padStart(2, "0"),
name: name!,
relationship: relationship!,
})),
scenarios: {
eligibility: emptyScenario(),
compI: emptyScenario(),
compII: emptyScenario(),
},
inputsRevision: 0,
answers: normalizeReviewAnswers({
telephone: "(814) 555-2235",
actualAddress: "Rear unit; use alley entrance off Walnut Avenue in Huntingdon",
dateAssigned: "2026-08-27",
actionType: "2",
caseClassification: "1",
narrative: "Synthetic Termination case awaiting examiner completion.",
}),
},
notes: [],
documents: [],
activity: [],
};
const imported = captureReceivedSnapshot(review);
imported.facts.members = [];
imported.facts.answers.narrative = "";
review.receivedSnapshots = { examiner: imported };
return review;
}
function emptyScenario(): Scenario {
return {
populated: false,
householdSize: 0,
income: [],
medicalDeductionCents: 0,
dependentCareCents: 0,
childSupportCents: 0,
rentCents: 0,
taxesInsuranceCents: 0,
installationCents: 0,
otherShelterCents: 0,
sua: "none",
elderlyDisabled: false,
categoricalEligibility: false,
homeless: false,
};
}