open-navigator / web_app /src /utils /dataExplorerPaths.ts
jcbowyer's picture
Clean HuggingFace deployment without binary files
e59d91d
Raw
History Blame Contribute Delete
1.95 kB
/** Base path for the choropleth map under Data explorer (ACS 5-year static bundle). */
export const DATA_EXPLORER_MAP_BASE = '/data-explorer/map'
/** Scorecard tab (trends + benchmarks). */
export const DATA_EXPLORER_SCORECARD = '/data-explorer/scorecard'
/** Jurisdiction website mapping coverage (NACo / USCM / NCES / GSA + exports). */
export const DATA_EXPLORER_JURISDICTION_QUALITY = '/data-explorer/jurisdiction-quality'
/** Latest Lighthouse scores from bronze (paired with accessibility batches). */
export const DATA_EXPLORER_LIGHTHOUSE_REPORT = '/data-explorer/lighthouse-report'
/** YouTube caption / policy pipeline batch job progress (live from API). */
export const DATA_EXPLORER_BATCH_JOBS = '/data-explorer/batch-jobs'
/** Prefer new prefix; support legacy `/census-map` URLs until removed. */
export function censusMapPathPrefix(pathname: string): string {
if (pathname.includes(`${DATA_EXPLORER_MAP_BASE}/`) || pathname === DATA_EXPLORER_MAP_BASE) {
return DATA_EXPLORER_MAP_BASE
}
if (pathname.includes('/census-map/') || pathname === '/census-map') {
return '/census-map'
}
return DATA_EXPLORER_MAP_BASE
}
export function mapPathUs(prefix: string, vintage: string, metric: string, search?: string) {
const q = search && search.length > 0 ? (search.startsWith('?') ? search : `?${search}`) : ''
return `${prefix}/us/${vintage}/${metric}${q}`
}
export function mapPathState(prefix: string, stateFips: string, vintage: string, metric: string, search?: string) {
const q = search && search.length > 0 ? (search.startsWith('?') ? search : `?${search}`) : ''
return `${prefix}/state/${stateFips}/${vintage}/${metric}${q}`
}
export function mapPathPlace(prefix: string, stateFips: string, vintage: string, metric: string, search?: string) {
const q = search && search.length > 0 ? (search.startsWith('?') ? search : `?${search}`) : ''
return `${prefix}/place/${stateFips}/${vintage}/${metric}${q}`
}