Need to create a self-contained HTML file with the CSV embedded. Clean with JS, compute the pivot, SVG bar chart, quality panel, and heading.
Let's compute the expected values for a sanity check.
Rows (30 rows). Duplicates: 1008 appears twice → exclude 1.
Excluded (non-numeric amounts): 1006 N/A, 1017 unknown, 1028 N/A → 3 excluded.
Rows counted = 30 − 1 − 3 = 26.
Regions:
- 1001 Texas 1240.00 Q1
- 1002 CA 980 Q1
- 1003 TX 312.50 Q1
- 1004 california 1764.00 Q1
- 1005 Ohio 455 Q1
- 1007 OH 1102.25 Q1
- 1008 California 2310.00 Q1 (first occurrence kept)
- 1009 TX -450.00 Q1
- 1010 Texas 870.10 Q1
- 1011 Ohio 1999.99 Q1
- 1012 CA 640.00 Q1
- 1013 tx 1580.00 Q1
- 1014 ohio 225.75 Q1
- 1015 California 3050.00 Q1
- 1016 TX 990.00 Q2
- 1018 CA 1420.50 Q2
- 1019 Texas 2075.00 Q2
- 1020 OH 760.25 Q2
- 1021 California 1111.11 Q2
- 1022 TX 845.00 Q2
- 1023 Ohio -220.00 Q2
- 1024 texas 1300.00 Q2
- 1025 CA 2940.40 Q2
- 1026 Ohio 515.00 Q2
- 1027 California 1875.25 Q2
- 1029 OH 1660.00 Q2
- 1030 Texas 730.90 Q2
Totals:
Texas Q1: 1240 + 312.50 + 870.10 − 450 = 1972.60
California Q1: 1764 + 2310 + 3050 = 7124.00
Ohio Q1: 455 + 1999.99 + 225.75 = 2680.74
CA (California) Q1: 980 + 640 = 1620 → California Q1 total = 7124 + 1620 = 8744.00
Texas Q2: 990 + 2075 + 845 + 1300 + 730.90 = 5940.90
California Q2: 1420.50 + 1111.11 + 1875.25 + 2940.40 = 7347.26
Ohio Q2: 760.25 − 220 + 515 + 1660 = 2715.25
Totals by region:
California: 8744 + 7347.26 = 16091.26
Texas: 1972.60 + 5940.90 = 7913.50
Ohio: 2680.74 + 2715.25 = 5395.99
Q1 column: 1972.60 + 8744 + 2680.74 = 13397.34
Q2 column: 5940.90 + 7347.26 + 2715.25 = 16003.41
Grand total: 29400.75
Top region: California $16,091.26.
Just let JS do the calculations. Write an HTML with the CSV embedded in a template literal, a parser that handles quoted fields, normalizes regions, parses dates (formats: YYYY-MM-DD, M/D/YYYY, "Mon D, YYYY"), and strips $ and commas from amounts.
CSV parser: handle quoted fields with commas. Simple state machine.
Bar chart: horizontal or vertical SVG bars. Go with vertical bars with labels.
Write the file. Keep it clean.