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) {}
|
try { quadData[model] = await api.fetchDistrictEstimates(district.leaid, { model, year: '21-22' }) } catch(e) {}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Fetch raw posterior draws for Chart 4 (ModelDrawsComparison)
|
// Raw posterior draws are not available via browser API (only bulk Parquet shards)
|
||||||
const modelDraws = {}
|
// Falls back to interval-based rendering in charts
|
||||||
await Promise.all(quadrants.map(async (model) => {
|
const modelDraws = null
|
||||||
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)
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
setData({ waveData, quadData, modelDraws })
|
setData({ waveData, quadData, modelDraws })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user