Fix: remove draws fetch (API endpoint not available for browser)
Deploy to git-pages / deploy (push) Successful in 12s
Deploy to git-pages / deploy (push) Successful in 12s
The /estimates/{leaid}/draws endpoint doesn't exist - only bulk Parquet
shard access is available. Falls back to interval-based rendering.
This commit is contained in:
@@ -43,26 +43,9 @@ export default function ChartPanel({ district, state }) {
|
||||
try { quadData[model] = await api.fetchDistrictEstimates(district.leaid, { model, year: '21-22' }) } catch(e) {}
|
||||
}))
|
||||
|
||||
// Fetch raw posterior draws for Chart 4 (ModelDrawsComparison)
|
||||
const modelDraws = {}
|
||||
await Promise.all(quadrants.map(async (model) => {
|
||||
try {
|
||||
const result = await api.fetchDistrictDraws(district.leaid, { model, year: '21-22' })
|
||||
// API returns draws array grouped by race/sex - process into usable format
|
||||
if (result?.data) {
|
||||
// Group draws by model for easier access
|
||||
const drawsByGroup = {}
|
||||
result.data.forEach(d => {
|
||||
const key = `${d.race}_${d.sex}`
|
||||
if (!drawsByGroup[key]) drawsByGroup[key] = []
|
||||
drawsByGroup[key].push(d.pred)
|
||||
})
|
||||
modelDraws[model] = drawsByGroup
|
||||
}
|
||||
} catch(e) {
|
||||
console.error('Failed to fetch draws for', model, e)
|
||||
}
|
||||
}))
|
||||
// Raw posterior draws are not available via browser API (only bulk Parquet shards)
|
||||
// Falls back to interval-based rendering in charts
|
||||
const modelDraws = null
|
||||
|
||||
setData({ waveData, quadData, modelDraws })
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user