Use three-year model (unified_m3_mod) to fetch observed data for all waves
Deploy to git-pages / deploy (push) Successful in 11s
Deploy to git-pages / deploy (push) Successful in 11s
One-year models don't return historical arrest data; three-year models include observed counts across all CRDC waves (15-16, 17-18, 21-22).
This commit is contained in:
@@ -28,11 +28,12 @@ export default function ChartPanel({ district, state }) {
|
|||||||
}
|
}
|
||||||
setNationalRates(nat)
|
setNationalRates(nat)
|
||||||
|
|
||||||
// Fetch all 3 waves × default model (unified_m2_mod) for Chart 1 + Charts 2-3
|
// Fetch all 3 waves × three-year model (unified_m3_mod) for Chart 1 + Charts 2-3
|
||||||
|
// Three-year models return observed data for all waves
|
||||||
const waves = ['21-22', '17-18', '15-16']
|
const waves = ['21-22', '17-18', '15-16']
|
||||||
const waveData = {}
|
const waveData = {}
|
||||||
await Promise.all(waves.map(async (year) => {
|
await Promise.all(waves.map(async (year) => {
|
||||||
try { waveData[year] = await api.fetchDistrictEstimates(district.leaid, { model: 'unified_m2_mod', year }) } catch(e) {}
|
try { waveData[year] = await api.fetchDistrictEstimates(district.leaid, { model: 'unified_m3_mod', year }) } catch(e) {}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Fetch all 4 quadrant models for Charts 4-6 (8 groups × 4 models, but we batch by model)
|
// Fetch all 4 quadrant models for Charts 4-6 (8 groups × 4 models, but we batch by model)
|
||||||
|
|||||||
Reference in New Issue
Block a user