-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjobshield-flowcharts.html
More file actions
845 lines (752 loc) · 39 KB
/
jobshield-flowcharts.html
File metadata and controls
845 lines (752 loc) · 39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>JobShield — Pipeline Flowcharts</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Nunito:wght@600;700;800;900&display=swap');
:root {
--bg: #FFFFFF;
--surface: #FAFAFA;
--border: #D0D7E3;
--text: #1A1F2E;
--muted: #5A677D;
--dim: #94A3B8;
--blue-bg: #DBEAFE;
--blue-bdr: #93C5FD;
--blue-txt: #1D4ED8;
--teal-bg: #CCFBF1;
--teal-bdr: #5EEAD4;
--teal-txt: #0F766E;
--green-bg: #DCFCE7;
--green-bdr: #86EFAC;
--green-txt: #166534;
--yellow-bg: #FEF9C3;
--yellow-bdr: #FDE047;
--yellow-txt: #854D0E;
--orange-bg: #FFEDD5;
--orange-bdr: #FDBA74;
--orange-txt: #9A3412;
--purple-bg: #F3E8FF;
--purple-bdr: #D8B4FE;
--purple-txt: #6B21A8;
--red-bg: #FEE2E2;
--red-bdr: #FCA5A5;
--red-txt: #991B1B;
--gray-bg: #F1F5F9;
--gray-bdr: #CBD5E1;
--gray-txt: #475569;
--mono: 'DM Mono', monospace;
--sans: 'Nunito', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
background: #EEF2F7;
color: var(--text);
font-family: var(--sans);
padding: 40px 16px 80px;
min-height: 100vh;
}
.page-header {
text-align: center;
margin-bottom: 56px;
}
.page-header h1 {
font-family: var(--mono);
font-size: 12px;
font-weight: 500;
letter-spacing: 4px;
color: var(--muted);
text-transform: uppercase;
margin-bottom: 12px;
}
.page-header h2 {
font-family: var(--sans);
font-size: 42px;
font-weight: 900;
color: var(--text);
line-height: 1.2;
margin-bottom: 10px;
}
.page-header h2 span { color: var(--blue-txt); }
.page-header p {
font-size: 14px;
color: var(--muted);
font-family: var(--mono);
}
.charts-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 28px;
max-width: 1600px;
margin: 0 auto;
align-items: start;
}
.chart {
background: var(--bg);
border: 2px solid var(--border);
border-radius: 20px;
overflow: hidden;
box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.chart-header {
padding: 18px 22px;
border-bottom: 2px solid var(--border);
display: flex;
align-items: center;
gap: 14px;
}
.chart-header.blue { background: var(--blue-bg); }
.chart-header.teal { background: var(--teal-bg); }
.chart-num {
width: 38px; height: 38px;
border-radius: 10px;
display: flex; align-items: center; justify-content: center;
font-family: var(--mono);
font-size: 15px;
font-weight: 700;
flex-shrink: 0;
}
.chart-num.blue { background: white; color: var(--blue-txt); border: 2px solid var(--blue-bdr); }
.chart-num.teal { background: white; color: var(--teal-txt); border: 2px solid var(--teal-bdr); }
.chart-title-wrap h3 { font-size: 17px; font-weight: 800; color: var(--text); }
.chart-title-wrap p { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.chart-body { padding: 16px; background: #F8FAFC; }
.node {
border-radius: 12px;
padding: 14px 16px;
border: 2px solid var(--border);
background: white;
position: relative;
}
.node-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.node-icon svg { flex-shrink:0; }
.parallel-grid.col3 .node {
padding: 11px 12px;
}
.parallel-grid.col3 .node-title {
font-size: 13px;
}
.parallel-grid.col3 .node-body {
font-size: 12px;
padding-left: 34px;
}
.parallel-grid.col3 .node-file {
font-size: 9.5px;
padding: 2px 6px;
max-width: 90px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.parallel-grid.col3 .tags {
padding-left: 34px;
}
.parallel-grid.col3 .tag {
font-size: 9.5px;
padding: 2px 7px;
}
.node-icon {
width: 32px; height: 32px;
border-radius: 8px;
display: flex; align-items: center; justify-content: center;
font-size: 16px;
flex-shrink: 0;
background: var(--gray-bg);
}
.node-title { font-weight: 800; font-size: 15px; color: var(--text); flex: 1; }
.node-file {
font-family: var(--mono);
font-size: 11px;
color: var(--muted);
background: var(--gray-bg);
padding: 3px 8px;
border-radius: 6px;
border: 1px solid var(--gray-bdr);
font-weight: 500;
}
.node-body { font-size: 13.5px; color: #475569; line-height: 1.7; padding-left: 40px; font-weight: 600; }
.node-body strong { color: var(--text); font-weight: 800; }
code {
font-family: var(--mono);
font-size: 11px;
background: #EFF6FF;
color: var(--blue-txt);
padding: 1px 6px;
border-radius: 4px;
border: 1px solid var(--blue-bdr);
font-weight: 500;
}
.tags { display: flex; flex-wrap: wrap; gap: 5px; padding-left: 40px; margin-top: 8px; }
.tag { font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 6px; font-weight: 700; border: 1.5px solid; }
.tag.blue { background: var(--blue-bg); color: var(--blue-txt); border-color: var(--blue-bdr); }
.tag.teal { background: var(--teal-bg); color: var(--teal-txt); border-color: var(--teal-bdr); }
.tag.green { background: var(--green-bg); color: var(--green-txt); border-color: var(--green-bdr); }
.tag.yellow { background: var(--yellow-bg); color: var(--yellow-txt); border-color: var(--yellow-bdr); }
.tag.orange { background: var(--orange-bg); color: var(--orange-txt); border-color: var(--orange-bdr); }
.tag.purple { background: var(--purple-bg); color: var(--purple-txt); border-color: var(--purple-bdr); }
.tag.red { background: var(--red-bg); color: var(--red-txt); border-color: var(--red-bdr); }
.tag.gray { background: var(--gray-bg); color: var(--gray-txt); border-color: var(--gray-bdr); }
.node.trigger { border-color: var(--gray-bdr); background: var(--gray-bg); }
.node.blue { border-color: var(--blue-bdr); background: #EFF6FF; }
.node.teal { border-color: var(--teal-bdr); background: #F0FDFA; }
.node.yellow { border-color: var(--yellow-bdr); background: #FEFCE8; }
.node.orange { border-color: var(--orange-bdr); background: #FFF7ED; }
.node.purple { border-color: var(--purple-bdr); background: #FAF5FF; }
.node.green { border-color: var(--green-bdr); background: #F0FDF4; }
.node.output { border-color: var(--teal-bdr); background: #F0FDFA; }
.node-icon.blue { background: var(--blue-bg); }
.node-icon.teal { background: var(--teal-bg); }
.node-icon.yellow { background: var(--yellow-bg); }
.node-icon.orange { background: var(--orange-bg); }
.node-icon.purple { background: var(--purple-bg); }
.node-icon.green { background: var(--green-bg); }
.node-icon.gray { background: var(--gray-bg); }
.arrow { display: flex; flex-direction: column; align-items: center; gap: 0; margin: 8px 0; }
.arrow-line { width: 2px; height: 20px; background: var(--blue-bdr); }
.arrow-tip { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 8px solid var(--blue-bdr); }
.arrow-label {
font-family: var(--mono);
font-size: 10px;
color: var(--blue-txt);
background: #EFF6FF;
padding: 1px 8px;
border-radius: 4px;
margin: -5px 0 -3px;
z-index: 1;
position: relative;
font-weight: 600;
border: 1px solid var(--blue-bdr);
}
.parallel {
border: 2px dashed var(--blue-bdr);
border-radius: 14px;
padding: 10px;
background: #F0F7FF;
overflow-x: auto;
}
.parallel-header {
font-family: var(--mono);
font-size: 11px;
color: var(--blue-txt);
letter-spacing: 2px;
text-align: center;
margin-bottom: 12px;
text-transform: uppercase;
font-weight: 700;
}
.parallel-grid { display: grid; gap: 8px; }
.parallel-grid.col2 { grid-template-columns: 1fr 1fr; }
.parallel-grid.col3 { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
.decision { border-color: var(--yellow-bdr); background: #FEFCE8; }
.decision .node-icon { background: var(--yellow-bg); }
.branches { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.branch { display: flex; flex-direction: column; align-items: center; gap: 0; }
.branch-connector { width: 2px; height: 14px; }
.branch-pill {
font-family: var(--mono);
font-size: 10px;
font-weight: 700;
padding: 4px 12px;
border-radius: 20px;
white-space: nowrap;
margin-bottom: 6px;
border: 1.5px solid;
}
.branch-pill.merge { background: var(--blue-bg); color: var(--blue-txt); border-color: var(--blue-bdr); }
.branch-pill.attach { background: var(--teal-bg); color: var(--teal-txt); border-color: var(--teal-bdr); }
.branch-pill.create { background: var(--yellow-bg); color: var(--yellow-txt); border-color: var(--yellow-bdr); }
.branch-card {
width: 100%;
border-radius: 10px;
padding: 12px 13px;
font-size: 13px;
color: #334155;
line-height: 1.6;
font-weight: 600;
border: 2px solid;
}
.branch-card.merge { background: #EFF6FF; border-color: var(--blue-bdr); }
.branch-card.attach { background: #F0FDFA; border-color: var(--teal-bdr); }
.branch-card.create { background: #FEFCE8; border-color: var(--yellow-bdr); }
.branch-card strong { display: block; font-size: 13px; margin-bottom: 6px; font-weight: 900; }
.branch-card.merge strong { color: var(--blue-txt); }
.branch-card.attach strong { color: var(--teal-txt); }
.branch-card.create strong { color: var(--yellow-txt); }
.weights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding-left: 40px; margin-top: 8px; }
.weight-row {
display: flex;
justify-content: space-between;
align-items: center;
background: white;
border: 1.5px solid var(--border);
border-radius: 7px;
padding: 5px 10px;
}
.weight-sig { font-size: 11.5px; color: #475569; font-family: var(--mono); font-weight: 500; }
.weight-val { font-size: 11.5px; color: var(--teal-txt); font-family: var(--mono); font-weight: 700; }
.admin-box { border: 2px solid var(--teal-bdr); background: var(--teal-bg); border-radius: 12px; padding: 16px 18px; }
.admin-box-head { font-size: 12px; color: var(--teal-txt); font-family: var(--mono); letter-spacing: 1px; margin-bottom: 12px; text-transform: uppercase; font-weight: 700; }
.admin-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 9px; font-size: 13.5px; color: #334155; line-height: 1.6; font-weight: 600; }
.admin-row:last-child { margin-bottom: 0; }
.admin-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.output-pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.output-pill { font-size: 13px; font-weight: 700; padding: 5px 14px; border-radius: 20px; font-family: var(--mono); border: 1.5px solid; }
.section-sep { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; }
.section-line { flex: 1; height: 1.5px; background: var(--border); }
.section-text { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; white-space: nowrap; font-weight: 500; }
.node.blue .node-icon svg { stroke: var(--blue-txt); }
.node.teal .node-icon svg { stroke: var(--teal-txt); }
.node.yellow .node-icon svg { stroke: var(--yellow-txt); }
.node.orange .node-icon svg { stroke: var(--orange-txt); }
.node.purple .node-icon svg { stroke: var(--purple-txt); }
.node.green .node-icon svg { stroke: var(--green-txt); }
.node.trigger .node-icon svg { stroke: var(--gray-txt); }
.node.output .node-icon svg { stroke: var(--teal-txt); }
.node.decision .node-icon svg { stroke: var(--yellow-txt); }
.admin-box-head svg { stroke: var(--teal-txt); }
.branch-card svg { vertical-align: middle; }
@media (max-width: 1000px) {
.charts-grid { grid-template-columns: 1fr; }
.parallel-grid.col3 { grid-template-columns: 1fr; }
.branches { grid-template-columns: 1fr; }
.parallel-grid.col2 { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="page-header">
<h1>Technical Architecture</h1>
<h2>JobShield <span>Pipeline Flowcharts</span></h2>
<p>POST /api/check · POST /api/reports</p>
</div>
<div class="charts-grid">
<!-- ═══════════════════════════════════════════════════
CHART 1 — ANALYZE
════════════════════════════════════════════════════ -->
<div class="chart">
<div class="chart-header blue">
<div class="chart-num blue">01</div>
<div class="chart-title-wrap">
<h3>Analyze Pipeline</h3>
<p>POST /api/check — ephemeral, nothing saved</p>
</div>
</div>
<div class="chart-body">
<!-- Trigger -->
<div class="node trigger">
<div class="node-head">
<div class="node-icon gray"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg></div>
<div class="node-title">HTTP Request arrives</div>
<div class="node-file">checkController.js</div>
</div>
<div class="node-body">
Authenticated user sends <code>{ text }</code> · JWT decoded by <code>authMiddleware</code><br/>
Text validated: 10–10,000 chars · rate limit: 20 req / 15 min
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Step 1 — Embedding -->
<div class="node blue">
<div class="node-head">
<div class="node-icon blue"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/></svg></div>
<div class="node-title">Generate Embedding</div>
<div class="node-file">embeddingService.js</div>
</div>
<div class="node-body">
SHA-256 hash text → check <code>EmbeddingCache</code> (MongoDB, 7-day TTL)<br/>
<strong>Cache miss</strong> → call HuggingFace API<br/>
Model: <code>sentence-transformers/all-MiniLM-L6-v2</code><br/>
Output: 384-dimensional float vector representing text semantics
</div>
<div class="tags">
<span class="tag blue">HF API call</span>
<span class="tag teal">MongoDB cache</span>
<span class="tag gray">→ embedding[384]</span>
</div>
</div>
<div class="arrow">
<div class="arrow-line"></div>
<span class="arrow-label">embedding ready</span>
<div class="arrow-tip"></div>
</div>
<!-- Step 2 — Parallel block -->
<div class="parallel">
<div class="parallel-header"><svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" style="display:inline;vertical-align:middle;margin-right:4px"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> PARALLEL EXECUTION — Promise.all([ ])</div>
<div class="parallel-grid col3">
<div class="node yellow" style="margin:0">
<div class="node-head">
<div class="node-icon yellow"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg></div>
<div class="node-title" style="font-size:12px">Regex Extraction</div>
<div class="node-file">regexService.js</div>
</div>
<div class="node-body">
In-process only<br/>
No API — instant
</div>
<div class="tags" style="padding-left:0; margin-top:6px;">
<span class="tag yellow">paymentLanguage</span>
<span class="tag yellow">telegramPresent</span>
<span class="tag yellow">freeEmailProvider</span>
<span class="tag yellow">suspiciousTLD</span>
<span class="tag yellow">urgencyScore 0–1</span>
<span class="tag yellow">primaryDomain</span>
</div>
</div>
<div class="node blue" style="margin:0">
<div class="node-head">
<div class="node-icon blue"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"/><line x1="7" y1="7" x2="7.01" y2="7"/></svg></div>
<div class="node-title" style="font-size:12px">NER Model</div>
<div class="node-file">nerService.js</div>
</div>
<div class="node-body">
Named Entity Recognition<br/>
<code>dslim/bert-base-NER</code><br/>
via HuggingFace API
</div>
<div class="tags" style="padding-left:0; margin-top:6px;">
<span class="tag blue">ORG entities</span>
<span class="tag blue">PER entities</span>
<span class="tag blue">bigBrandMentioned</span>
</div>
</div>
<div class="node yellow" style="margin:0">
<div class="node-head">
<div class="node-icon yellow"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg></div>
<div class="node-title" style="font-size:12px">Domain Mismatch</div>
<div class="node-file">regexService.js</div>
</div>
<div class="node-body">
Compares NER ORGs<br/>
vs sender domain<br/>
In-process
</div>
<div class="tags" style="padding-left:0; margin-top:6px;">
<span class="tag yellow">domainMismatch</span>
</div>
</div>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Step 3 — Second parallel -->
<div class="parallel">
<div class="parallel-header"><svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor" style="display:inline;vertical-align:middle;margin-right:4px"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg> PARALLEL EXECUTION — Promise.all([ ])</div>
<div class="parallel-grid col2">
<div class="node orange" style="margin:0">
<div class="node-head">
<div class="node-icon orange"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="11"/><line x1="11" y1="14" x2="11.01" y2="14"/></svg></div>
<div class="node-title" style="font-size:12px">WHOIS Lookup</div>
<div class="node-file">domainService.js</div>
</div>
<div class="node-body">
Domain registration age<br/>
Cached in <code>DomainIntelligence</code>
</div>
<div class="tags" style="padding-left:0; margin-top:6px;">
<span class="tag orange">domainAgeDays</span>
<span class="tag orange">registrar</span>
</div>
</div>
<div class="node purple" style="margin:0">
<div class="node-head">
<div class="node-icon purple"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"/></svg></div>
<div class="node-title" style="font-size:12px">Atlas Vector Search</div>
<div class="node-file">similarityService.js</div>
</div>
<div class="node-body">
Cosine similarity on <code>ScamClusters</code><br/>
Index: <code>cluster_vector_index</code><br/>
Returns top 5 nearest clusters
</div>
<div class="tags" style="padding-left:0; margin-top:6px;">
<span class="tag purple">confirmedScamMatch</span>
<span class="tag purple">highSimilarityMatch</span>
<span class="tag purple">similarityScore</span>
<span class="tag purple">previouslyReported</span>
<span class="tag purple">matchedCluster</span>
</div>
</div>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Step 4 — Weights -->
<div class="node teal">
<div class="node-head">
<div class="node-icon teal"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="3" x2="12" y2="21"/><path d="M3 9l9-6 9 6"/><path d="M5 9l-2 9h18l-2-9"/></svg></div>
<div class="node-title">Get Signal Weights</div>
<div class="node-file">weightService.js</div>
</div>
<div class="node-body">
Reads from memory — <strong>no DB, no API, <1ms</strong><br/>
<strong>Mode A</strong> — <20 labelled reports → calibrated hardcoded defaults<br/>
<strong>Mode B</strong> — 20+ reports → logistic regression weights (retrained every 6h)<br/>
Blend ratio: 20% learned / 80% default (22 samples) → 80% / 20% (150+ samples)
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Step 5 — Score -->
<div class="node teal">
<div class="node-head">
<div class="node-icon teal"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/></svg></div>
<div class="node-title">Calculate Score</div>
<div class="node-file">scoringService.js</div>
</div>
<div class="node-body">
Multiply each triggered signal × its weight, sum all contributions
</div>
<div class="weights-grid">
<div class="weight-row"><span class="weight-sig">confirmedScamMatch</span><span class="weight-val">w=35</span></div>
<div class="weight-row"><span class="weight-sig">paymentLanguage</span><span class="weight-val">w=22</span></div>
<div class="weight-row"><span class="weight-sig">highSimilarityMatch</span><span class="weight-val">w=25</span></div>
<div class="weight-row"><span class="weight-sig">youngDomain <90d</span><span class="weight-val">w=18</span></div>
<div class="weight-row"><span class="weight-sig">domainMismatch</span><span class="weight-val">w=20</span></div>
<div class="weight-row"><span class="weight-sig">bigBrandMentioned</span><span class="weight-val">w=15</span></div>
<div class="weight-row"><span class="weight-sig">previouslyReported</span><span class="weight-val">w=16</span></div>
<div class="weight-row"><span class="weight-sig">telegramPresent</span><span class="weight-val">w=14</span></div>
<div class="weight-row"><span class="weight-sig">freeEmailProvider</span><span class="weight-val">w=12</span></div>
<div class="weight-row"><span class="weight-sig">suspiciousTLD</span><span class="weight-val">w=12</span></div>
<div class="weight-row"><span class="weight-sig">urgencyDetected</span><span class="weight-val">w=10×score</span></div>
<div class="weight-row"><span class="weight-sig">3+ weak signals</span><span class="weight-val">bonus +15–25</span></div>
</div>
<div class="node-body" style="margin-top:8px;">
<code>finalScore = rawScore / maxPossible × 100</code><br/>
Floor boosts: <code>confirmedScamMatch → min 72</code> · <code>highSimilarity → min 55</code>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Step 6 — Explanation -->
<div class="node green">
<div class="node-head">
<div class="node-icon green"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg></div>
<div class="node-title">Build Explanation</div>
<div class="node-file">explanationBuilder.js</div>
</div>
<div class="node-body">
Converts triggered signal flags → human-readable sentences<br/>
e.g. <em>"Matches verified scam template (99.4% similarity)"</em>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Output -->
<div class="node output" style="text-align:center;">
<div class="node-head" style="justify-content:center;">
<div class="node-icon teal"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="22 2 15 9 22 16"/><path d="M2 22V13a9 9 0 0 1 9-9h11"/></svg></div>
<div class="node-title">Return Response — nothing written to DB</div>
</div>
<div class="output-pills">
<span class="output-pill" style="background:#DCFCE7; color:#166534; border:1.5px solid #86EFAC;">0–25 Low Risk</span>
<span class="output-pill" style="background:#DBEAFE; color:#1D4ED8; border:1.5px solid #93C5FD;">26–50 Suspicious</span>
<span class="output-pill" style="background:#FEF9C3; color:#854D0E; border:1.5px solid #FDE047;">51–70 High Risk</span>
<span class="output-pill" style="background:#FEE2E2; color:#991B1B; border:1.5px solid #FCA5A5;">71–100 Likely Scam</span>
</div>
<div class="tags" style="padding-left:0; justify-content:center; margin-top:8px;">
<span class="tag gray">riskScore</span>
<span class="tag gray">classification</span>
<span class="tag gray">explanation[]</span>
<span class="tag gray">signals{}</span>
</div>
</div>
</div>
</div>
<!-- ═══════════════════════════════════════════════════
CHART 2 — REPORT
════════════════════════════════════════════════════ -->
<div class="chart">
<div class="chart-header teal">
<div class="chart-num teal">02</div>
<div class="chart-title-wrap">
<h3>Submit Report Pipeline</h3>
<p>POST /api/reports — persisted, clustered, admin-reviewed</p>
</div>
</div>
<div class="chart-body">
<!-- Trigger -->
<div class="node trigger">
<div class="node-head">
<div class="node-icon gray"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg></div>
<div class="node-title">HTTP Request arrives</div>
<div class="node-file">reportController.js</div>
</div>
<div class="node-body">
Authenticated user sends <code>{ text, location?, paymentMethod? }</code><br/>
JWT decoded · text validated 10–10,000 chars
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Same pipeline callout -->
<div class="node blue">
<div class="node-head">
<div class="node-icon blue"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg></div>
<div class="node-title">Run Full Analysis Pipeline</div>
<div class="node-file">analysisService.js</div>
</div>
<div class="node-body">
<strong>Identical to Chart 01 — all 6 steps execute</strong><br/>
Embedding → Regex → NER → WHOIS → Vector Search → Weights → Score → Explanation
</div>
<div class="tags">
<span class="tag blue">riskScore</span>
<span class="tag blue">classification</span>
<span class="tag blue">embedding[384]</span>
<span class="tag blue">signals{}</span>
<span class="tag blue">matchedCluster</span>
<span class="tag blue">similarityScore</span>
<span class="tag blue">structuredSignals</span>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Cluster decision -->
<div class="node decision">
<div class="node-head">
<div class="node-icon yellow"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="2" width="16" height="20" rx="2"/><line x1="8" y1="6" x2="16" y2="6"/><line x1="8" y1="10" x2="16" y2="10"/><line x1="8" y1="14" x2="12" y2="14"/></svg></div>
<div class="node-title">Cluster Decision</div>
<div class="node-file">clusterService.js</div>
</div>
<div class="node-body">
Compare <code>similarityScore</code> against best-matching cluster
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Branches -->
<div class="branches">
<div class="branch">
<div class="branch-connector" style="background:#93C5FD;"></div>
<div class="branch-pill merge">≥ 0.95</div>
<div class="branch-card merge">
<strong><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="display:inline;vertical-align:middle;margin-right:5px"><path d="M18 3v4c0 4-3 7-9 9m0 0v5m0-5C5 14 3 11 3 7V3"/></svg> MERGE</strong>
Same scam template.<br/>
Update centroid:<br/>
<code style="font-size:9px; display:block; margin:4px 0; color:#1D4ED8">newCentroid[i] =<br/>(old×(n-1)+new)/n</code>
<code style="font-size:9px; color:#1D4ED8">reportCount++</code><br/>
<code style="font-size:9px; color:#1D4ED8">averageRiskScore</code> updated<br/><br/>
Signal 1 fires (+35)
</div>
</div>
<div class="branch">
<div class="branch-connector" style="background:#5EEAD4;"></div>
<div class="branch-pill attach">0.85 – 0.95</div>
<div class="branch-card attach">
<strong><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="display:inline;vertical-align:middle;margin-right:5px"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg> ATTACH</strong>
Same pattern,<br/>different wording.<br/>
Centroid NOT updated<br/>
(prevents drift)<br/><br/>
<code style="font-size:9px; color:#0F766E">reportCount++</code><br/>
<code style="font-size:9px; color:#0F766E">lastReportedAt</code> updated<br/><br/>
Signal 2 fires (+25)
</div>
</div>
<div class="branch">
<div class="branch-connector" style="background:#FDE047;"></div>
<div class="branch-pill create">< 0.85</div>
<div class="branch-card create">
<strong><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="display:inline;vertical-align:middle;margin-right:5px"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg> CREATE</strong>
New scam pattern,<br/>never seen before.<br/>
New cluster born:<br/><br/>
<code style="font-size:9px; color:#854D0E; display:block">embedding = vector</code>
<code style="font-size:9px; color:#854D0E; display:block">reportCount = 1</code>
<code style="font-size:9px; color:#854D0E; display:block">verified = false</code>
<br/>No similarity signal
</div>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Auto-flag -->
<div class="node decision">
<div class="node-head">
<div class="node-icon yellow"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg></div>
<div class="node-title">Auto-flag Decision</div>
<div class="node-file">reportController.js</div>
</div>
<div class="node-body">
<code>riskScore > 70</code> → status = <span style="color:#DC2626">auto-flagged</span> (admin queue)<br/>
<code>riskScore ≤ 70</code> → status = <span style="color:#16A34A">pending</span>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Save to MongoDB -->
<div class="node purple">
<div class="node-head">
<div class="node-icon purple"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"/><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"/></svg></div>
<div class="node-title">Persist Report to MongoDB</div>
<div class="node-file">Report.js model</div>
</div>
<div class="node-body">Saved to <code>reports</code> collection</div>
<div class="tags">
<span class="tag purple">userId</span>
<span class="tag purple">rawText</span>
<span class="tag purple">textHash</span>
<span class="tag purple">embedding[384]</span>
<span class="tag purple">structuredSignals</span>
<span class="tag purple">riskScore</span>
<span class="tag purple">classification</span>
<span class="tag purple">explanation[]</span>
<span class="tag purple">clusterId</span>
<span class="tag purple">status</span>
<span class="tag purple">domainAgeDays</span>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Update user -->
<div class="node purple">
<div class="node-head">
<div class="node-icon purple"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg></div>
<div class="node-title">Update User Stats</div>
<div class="node-file">User.js model</div>
</div>
<div class="node-body">
<code>totalReports++</code> on the submitting user's document
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Response -->
<div class="node output" style="text-align:center;">
<div class="node-head" style="justify-content:center;">
<div class="node-icon teal"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="22 2 15 9 22 16"/><path d="M2 22V13a9 9 0 0 1 9-9h11"/></svg></div>
<div class="node-title">Return Response — report + cluster saved</div>
</div>
<div class="tags" style="padding-left:0; justify-content:center; margin-top:8px;">
<span class="tag gray">reportId</span>
<span class="tag gray">riskScore</span>
<span class="tag gray">classification</span>
<span class="tag gray">explanation[]</span>
<span class="tag gray">status</span>
</div>
</div>
<div class="arrow"><div class="arrow-line"></div><div class="arrow-tip"></div></div>
<!-- Admin async -->
<div class="admin-box">
<div class="admin-box-head"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="display:inline;vertical-align:middle;margin-right:6px"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> ADMIN REVIEW — ASYNC, HAPPENS LATER — async, happens later</div>
<div class="admin-row">
<div class="admin-dot" style="background:#EF4444"></div>
<div>Admin marks <code>verified-scam</code> →
<code>user.verifiedReports++</code> · <code>reputationScore+10</code> ·
<code>cluster.verified=true</code> (activates Signal 1 for future matches)
</div>
</div>
<div class="admin-row">
<div class="admin-dot" style="background:#94A3B8"></div>
<div>Admin marks <code>rejected</code> →
<code>user.rejectedReports++</code> · <code>reputationScore−5</code>
</div>
</div>
<div class="admin-row">
<div class="admin-dot" style="background:#14B8A6"></div>
<div>
Once <strong style="color:#0F766E">20+ scam + 20+ rejected</strong> reports exist →
<code>weightService</code> retrains logistic regression →
weights auto-update every 6h or via <code>POST /api/admin/retrain</code>
</div>
</div>
<div class="admin-row">
<div class="admin-dot" style="background:#EAB308"></div>
<div>
On server startup: <code>seedCleanExamples()</code> auto-labels
low-risk pending reports as <code>rejected</code> to bootstrap non-scam training data
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>