Busabase
Busabase is an open-source (MIT) database and workspace for AI agents — data, docs, skills, and apps in one place. Run it locally, self-host it inside your network, or use Busabase Cloud, and turn age
18대~21대 한국 대통령 선거 결과 분석 대시보드 (2012–2025) · methodology, swing, counterfactuals, anomaly detection, bilingual.
Translation pending
DataTypeScript · PythonGitHub @sechan9999OnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Election Hub
Translation pending
Taken from the repository README
Loading the full README. The saved excerpt is shown below.
Electoral Insights Hub(sechan9999/K18to21Election2)를 Vercel + 엑셀에서 Cloud Run + BigQuery로 옮기는 마이그레이션 키트입니다. 앱은 런타임에 xlsx를 읽지 않습니다. app/page.tsx가 summaries/*.json을 빌드 시점에 import하므로, 전면 재작성 대신 동기화 레이어만 추가합니다. BigQuery에서 JSON을 다시 만들고, page.tsx는 그대로 둡니다. npm run backfill && npm run check:parity (2026-10-02): 지역별 득표율이 기존 파일과 맞지 않던 원인입니다.Read the full README ↗
Electoral Insights Hub(sechan9999/K18to21Election2)를 Vercel + 엑셀에서 Cloud Run + BigQuery로 옮기는 마이그레이션 키트입니다.
앱은 런타임에 xlsx를 읽지 않습니다. app/page.tsx가 summaries/*.json을 빌드 시점에 import하므로, 전면 재작성 대신 동기화 레이어만 추가합니다. BigQuery에서 JSON을 다시 만들고, page.tsx는 그대로 둡니다.
K18to21charts.xlsx ──backfill_bigquery.py──▶ CSV ──bq load──▶ BigQuery (electoral_hub)
│
npm run build (SYNC_FROM_BIGQUERY=1) ◀────┘ sync-summaries.ts
│
summaries/*.json ──import──▶ page.tsx (변경 없음) ──▶ Cloud Run
npm run backfill && npm run check:parity (2026-10-02):
| 검사 | 결과 |
|---|---|
| 선거별 후보 득표·총투표·선거인수·투표수 (18–21대) | 기존 JSON과 일치 (21대 34,980,616) |
regional_summary.json | 값 일치, 바이트까지 일치 |
election_summary.json | 값 일치. 바이트 차이는 기존 파일의 15773128.0(Python float) 표기뿐이며 JS는 15773128로 씁니다. import한 숫자는 같습니다. |
K18to21Election2 사본에 키트 적용 후 npm run build | 성공(prebuild 훅 동작). standalone server.js 실행 화면에 run ID pr-2026-04-22-01(_run.json)과 21대 총계 34,980,616 표시 |
bigquery.ts에서 고친 두 가지지역별 득표율이 기존 파일과 맞지 않던 원인입니다.
candidates.bloc은 선거마다 두 후보에게만 채웁니다.elections.share_basis(all_candidates | bloc_pair) 열로 선거별 규칙을 데이터에 넣었습니다.그 밖에 results_region.region_order로 JSON의 지역 키 순서(21대는 가나다순, 18–20대는 시트 순)를 보존하고, 후보는 투표용지 순(candidate_no)으로 내보냅니다.
강원도·전라북도, 21대는 강원특별자치도·전북특별자치도. 백필 스크립트가 원본 시트의 문자열을 그대로 쓰고, 기존 JSON에 없는 지역이 나오면 실패합니다.candidates.bloc / label_ko 채우기. label_ko는 기존 Candidates 키와 바이트 단위로 같아야 합니다(20대 국가혁명당 허경영의 공백 두 칸 포함). 스크립트가 시트 헤더를 기존 키에 맞춰 찾고, 못 찾으면 실패합니다.next.config.ts:
const nextConfig: NextConfig = { output: 'standalone' };
| 이 키트 | 대상 레포 |
|---|---|
app/lib/bigquery.ts | app/lib/bigquery.ts |
scripts/sync-summaries.ts, scripts/prebuild.mjs, scripts/backfill_bigquery.py, scripts/check-parity.ts | scripts/ |
summaries/_run.json | summaries/_run.json (첫 동기화 전 로컬 빌드용) |
Dockerfile, .dockerignore.target → .dockerignore | 루트 |
npm install @google-cloud/bigquery
"scripts": {
"prebuild": "node scripts/prebuild.mjs",
"sync:summaries": "tsx scripts/sync-summaries.ts"
}
로컬 npm run build는 커밋된 JSON을 그대로 쓰고, SYNC_FROM_BIGQUERY=1일 때만 BigQuery에서 다시 만듭니다.app/lib/methodology.ts의 LAST_PIPELINE_RUN 블록을 patches/methodology-last-pipeline-run.ts로 바꿉니다(파일 맨 위에 _run.json import 추가). 헤더가 읽는 필드는 그대로이고 runId·completedAt·dedup이 _run.json에서 옵니다.export PROJECT=your-gcp-project
bq mk --dataset --location=us-central1 $PROJECT:electoral_hub
bq query --use_legacy_sql=false < bigquery/schema.sql
python3 scripts/backfill_bigquery.py --xlsx original_data/K18to21charts.xlsx --summaries summaries --out bq_backfill
npx tsx scripts/check-parity.ts bq_backfill summaries # 값이 다르면 exit 1
for t in runs elections candidates results_region turnout_region; do
bq load --source_format=CSV --skip_leading_rows=1 $PROJECT:electoral_hub.$t bq_backfill/$t.csv
done
schema.sql 맨 아래 쿼리로 선거별 합계를 확인합니다(21대 34,980,616).export REGION=us-central1
docker build -t ehub:staging . && docker run -p 8080:8080 ehub:staging # 로컬 확인
gcloud builds submit --tag $REGION-docker.pkg.dev/$PROJECT/ehub/app:staging .
gcloud run deploy ehub-staging \
--image $REGION-docker.pkg.dev/$PROJECT/ehub/app:staging \
--region $REGION --allow-unauthenticated \
--port 8080 --cpu 1 --memory 512Mi --concurrency 80 --min-instances 0 --max-instances 10
BigQuery 동기화를 빌드에 넣으려면 를 쓰고, Cloud Build 서비스 계정에 , 를 줍니다.전체 체크리스트: docs/MIGRATION_CHECKLIST.md
results_region.sorted_votes / recheck_votes(분류표·재확인표)는 백필에서 비워 둡니다. 원본 시트에 지역별 분류·재확인 값이 없고 대시보드도 쓰지 않습니다. 개표상황표 판독 파이프라인을 올릴 때 채웁니다.runs.data_hash는 results_region.csv의 sha256 앞 8자리입니다. 기존 화면 하단의 "데이터 해시"(ShareBar가 클라이언트에서 계산)와는 다른 값입니다.fixtures/는 키트 단독 검증용으로 복사한 현재 summaries/*.json입니다.docker build --build-arg SYNC_FROM_BIGQUERY=1 --build-arg GCP_PROJECT=$PROJECTroles/bigquery.dataViewerroles/bigquery.jobUser?view=compare&election=21st에서 모든 숫자와 헤더의 run ID를 비교합니다.gcloud billing budgets create --billing-account=BILLING_ID \
--display-name="ehub-monthly" --budget-amount=200USD \
--threshold-rule=percent=50 --threshold-rule=percent=80 --threshold-rule=percent=100