Skip to content

Commit 2f873bc

Browse files
authored
Add victim tracking data model and store
1 parent a385982 commit 2f873bc

1 file changed

Lines changed: 104 additions & 0 deletions

File tree

schema.update

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// Victim / incident tracking data model
2+
3+
type SurvivalStatus = 'survived' | 'deceased' | 'missing' | 'unknown';
4+
type CaseStatus = 'pending' | 'under-review' | 'closed';
5+
6+
interface TicketDetails {
7+
ticketId?: string;
8+
seatView: string; // e.g. "window", "aisle", "middle"
9+
place: string; // origin/destination or incident location
10+
details?: string; // free-text ticket details
11+
}
12+
13+
interface ExperienceNotes {
14+
moodsShattered: boolean; // victim reports severe emotional impact
15+
sortMattered: boolean; // whether classification/triage affected outcome
16+
notes?: string;
17+
}
18+
19+
interface VictimRecord {
20+
id: string;
21+
name?: string;
22+
23+
// Status
24+
status: SurvivalStatus;
25+
broughtBy?: string; // who brought/transported the victim
26+
inFrontOf?: string; // witness or person present at scene
27+
survivalDetails?: string;
28+
29+
// Case handling
30+
caseStatus: CaseStatus;
31+
pendingSort?: boolean; // still awaiting categorization/triage
32+
filesCollected: string[]; // IDs/paths of recollected files (statements, evidence, docs)
33+
noShop: boolean; // e.g. flags whether victim had no purchase/transaction record
34+
35+
// Travel / location
36+
ticket?: TicketDetails;
37+
place: string;
38+
39+
// Subjective account
40+
experience: ExperienceNotes;
41+
}
42+
43+
// --- Basic in-memory store (Fp-basics / Bk.end scaffold) ---
44+
45+
class VictimStore {
46+
private records: Map<string, VictimRecord> = new Map();
47+
48+
add(record: VictimRecord): void {
49+
this.records.set(record.id, record);
50+
}
51+
52+
get(id: string): VictimRecord | undefined {
53+
return this.records.get(id);
54+
}
55+
56+
update(id: string, patch: Partial<VictimRecord>): VictimRecord | undefined {
57+
const existing = this.records.get(id);
58+
if (!existing) return undefined;
59+
const updated = { ...existing, ...patch };
60+
this.records.set(id, updated);
61+
return updated;
62+
}
63+
64+
listByCaseStatus(status: CaseStatus): VictimRecord[] {
65+
return [...this.records.values()].filter(r => r.caseStatus === status);
66+
}
67+
68+
listPendingSort(): VictimRecord[] {
69+
return [...this.records.values()].filter(r => r.pendingSort);
70+
}
71+
72+
all(): VictimRecord[] {
73+
return [...this.records.values()];
74+
}
75+
}
76+
77+
// Example usage
78+
const store = new VictimStore();
79+
#example : Remaining and Continuing cases
80+
store.add({
81+
id: 'v-001',
82+
name: 'Jane Doe',
83+
status: 'survived',
84+
broughtBy: 'Rescue Team A',
85+
inFrontOf: 'Witness: R. Kumar',
86+
caseStatus: 'pending',
87+
pendingSort: true,
88+
filesCollected: ['statement_001.pdf'],
89+
noShop: true,
90+
place: 'Platform 4, Ludhiana Station',
91+
ticket: {
92+
ticketId: 'TKT-9981',
93+
seatView: 'window',
94+
place: 'Ludhiana Station',
95+
details: 'Confirmed seat, general coach',
96+
},
97+
experience: {
98+
moodsShattered: true,
99+
sortMattered: false,
100+
notes: 'Reported disorientation post-incident',
101+
},
102+
});
103+
104+
console.log(store.listPendingSort());

0 commit comments

Comments
 (0)