@@ -76,121 +76,100 @@ Before finalizing ANY article, verify all checks pass.
7676
7777```
78781. FETCH DATA
79+ For complex tables (CPI, LFS, GDP, Retail):
7980 Rscript r-tools/fetch_cansim_enhanced.R <table-number> output
8081 → output/data_<table>_enhanced.json
8182
82- 2. VERIFY JSON EXISTS (MANDATORY)
83- Check that verification JSON file exists in output/
84- If missing, create it using save_verification_json.R:
83+ For simple single-series indicators:
84+ Rscript r-tools/fetch_cansim_enhanced.R <table-number> output --simple \
85+ --filter "GEO=Canada" \
86+ --filter "Column Name=Filter Value" \
87+ --name "indicator_name"
88+ → output/indicator_name.json
8589
86- Rscript -e "source('r-tools/save_verification_json.R'); ..."
87-
88- See "Verification JSON Requirement" section below.
89-
90- 3. READ AND CONFIRM DATA (MANDATORY)
90+ 2. READ AND CONFIRM DATA (MANDATORY)
9191 Before writing ANY article content:
9292 - Read the JSON file completely
93- - State the headline value: "latest.yoy_pct_change is X.X%"
94- - State the reference period: "metadata.reference_period is YYYY-MM"
93+ - State the headline value: "yoy_pct is X.X%"
94+ - State the reference period: "ref_date is YYYY-MM"
9595 - If JSON doesn't exist or is stale, STOP - do not proceed
9696
97- 4 . CREATE ENGLISH ARTICLE
97+ 3 . CREATE ENGLISH ARTICLE WITH FRONTMATTER (MANDATORY)
9898 docs/en/<slug>/index.md
9999
100- 5. CREATE FRENCH ARTICLE
101- docs/fr/<slug-fr>/index.md
102-
103- 6. LINK ARTICLE TO JSON (MANDATORY)
104- Record which JSON file this article uses in the article's source-info div:
100+ MUST include verification_json in frontmatter:
101+ ---
102+ title: Manufacturing sales down 1.0% in October 2025
103+ verification_json: output/manufacturing_sales.json
104+ toc: false
105+ ---
105106
106- **Verification JSON:** `output/<indicator>.json`
107+ 4. CREATE FRENCH ARTICLE
108+ docs/fr/<slug-fr>/index.md (same frontmatter requirement)
107109
108- This creates the audit trail from article → data source.
109-
110- 7. UPDATE LANGUAGE MAP
110+ 5. UPDATE LANGUAGE MAP
111111 Add slug pair to src/lang-map.js
112112
113- 8 . UPDATE INDEX PAGES
113+ 6 . UPDATE INDEX PAGES
114114 Add entry to docs/en/index.md and docs/fr/index.md
115115
116- 9 . PREVIEW AND VERIFY
116+ 7 . PREVIEW AND VERIFY
117117 npm run dev → http://localhost:3000
118118```
119119
120120## Verification JSON Requirement
121121
122- ** Every article MUST have a corresponding JSON verification file.** This enables:
122+ ** Every article MUST declare its verification JSON in frontmatter.** This enables:
123+ - Build-time validation (fails if JSON missing)
123124- Audit trail for data provenance
124- - Post-publication verification
125125- Detection of fabricated data
126126
127- ### For Tables with Enhanced Fetcher Support
127+ ### Fetching Data
128+
129+ ** One tool for all tables** - use ` fetch_cansim_enhanced.R ` :
128130
129- Tables like CPI (18-10-0004), LFS (14-10-0287), Retail (20-10-0008) use the enhanced fetcher:
130131``` bash
132+ # Complex tables with subseries/provincial breakdowns
131133Rscript r-tools/fetch_cansim_enhanced.R 18-10-0004 output
132- ```
133- This automatically creates ` output/data_18_10_0004_enhanced.json ` .
134-
135- ### For Other Tables (Simpler Indicators)
136134
137- Use the verification JSON utility:
138- ``` r
139- source(" r-tools/save_verification_json.R" )
140-
141- # Fetch and save in one step
142- fetch_and_save_verification(
143- series_name = " Manufacturing Sales" ,
144- table_number = " 16-10-0047" ,
145- GEO == " Canada" ,
146- `Seasonal adjustment` == " Seasonally adjusted" ,
147- `Principal statistics` == " Sales of goods manufactured (shipments)" ,
148- `North American Industry Classification System (NAICS)` == " Manufacturing" ,
149- unit = " millions"
150- )
135+ # Simple single-series indicators
136+ Rscript r-tools/fetch_cansim_enhanced.R 16-10-0047 output --simple \
137+ --filter " GEO=Canada" \
138+ --filter " Seasonal adjustment=Seasonally adjusted" \
139+ --filter " Principal statistics=Sales of goods manufactured (shipments)" \
140+ --filter " North American Industry Classification System (NAICS)=Manufacturing" \
141+ --name " manufacturing_sales"
151142```
152143
153- Or manually:
154- ``` r
155- source(" r-tools/save_verification_json.R" )
144+ ### Frontmatter Declaration
156145
157- # Your custom fetch
158- data <- get_cansim(" 16-10-0047" ) %> %
159- filter(... ) %> %
160- select(REF_DATE , VALUE ) %> %
161- arrange(REF_DATE )
162-
163- # Save verification JSON
164- save_verification_json(
165- series_name = " Manufacturing Sales" ,
166- table_number = " 16-10-0047" ,
167- data = data ,
168- unit = " millions" ,
169- article_slug = " manufacturing-sales-october-2025"
170- )
171- ```
146+ Every article must include ` verification_json ` in its YAML frontmatter:
172147
173- ### JSON File Naming Convention
148+ ``` yaml
149+ ---
150+ title : Manufacturing sales down 1.0% in October 2025
151+ verification_json : output/manufacturing_sales.json
152+ toc : false
153+ ---
154+ ```
174155
175- | Series Name | JSON Filename |
176- | -------------| ---------------|
177- | Manufacturing Sales | ` manufacturing_sales.json ` |
178- | Consumer Price Index | ` data_18_10_0004_enhanced.json ` |
179- | EI Claims | ` ei_claims.json ` |
180- | Industrial Product Prices | ` ippi.json ` |
156+ This is ** enforced at build time** - the site will not build if:
157+ - ` verification_json ` field is missing
158+ - The referenced JSON file doesn't exist
181159
182- ### Verification Before Publishing
160+ ### Verification Audit
183161
184- Before marking an article complete :
185- 1 . Confirm JSON file exists in ` output/ `
186- 2 . Confirm article values match JSON values
187- 3 . Confirm article period ≤ JSON reference period
162+ Run the coverage checker to see which articles have valid verification :
163+ ``` bash
164+ Rscript r-tools/check_verification_coverage.R
165+ ```
188166
189167## Article Structure
190168
191169``` markdown
192170---
193171title: Consumer prices up 2.2% year over year in November 2025
172+ verification_json: output/data_18_10_0004_enhanced.json
194173toc: false
195174---
196175
@@ -327,15 +306,14 @@ import * as Plot from "npm:@observablehq/plot";
327306## Quality Checklist
328307
329308Before publishing:
330- - [ ] ** Verification JSON exists ** in ` output/ ` for this indicator
309+ - [ ] ** ` verification_json ` in frontmatter ** pointing to valid JSON file
331310- [ ] All values from fetched JSON (no made-up data)
332311- [ ] Headline leads with key statistic
333312- [ ] Charts render with #AF3C43 color
334313- [ ] Language switcher works (slug in lang-map.js)
335314- [ ] Voice is neutral (no "surged", "plummeted")
336315- [ ] French uses comma decimals (2,2 %)
337316- [ ] R code reproducibility section included with correct table number
338- - [ ] ** Verification JSON path** noted in source-info div
339317
340318## Review Mode
341319
0 commit comments