Skip to content
acuminataPublic

About

Births, deaths and marriages

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

bmd - births, marriages, deaths

CLI that downloads marriage and impediment notice records from https://oag.ecitizen.go.ke/notice-board/data/{marriages,impediments} into SQLite, and uploads the original photos to an S3-compatible bucket. Existing application_number rows are ignored on re-fetch.

Install

go build -o bmd ./cmd/bmd

Use

./bmd fetch --db bmd.db --dataset all --page-size 30
./bmd stats --db bmd.db

With S3 photo uploads and Cloudflare cookies:

BMD_COOKIE='cf_clearance=...' S3_ENDPOINT=https://s3.example.com S3_BUCKET=bmd-photos \
  ./bmd fetch --db bmd.db --max-pages 2 --verbose

Legacy OAG_* env vars still work as fallback for BMD_*.

How it works

  • Pages ?page=N&page_size=30 per dataset (marriages, impediments).
  • Rows stored in SQLite table marriage_notices, UNIQUE(kind, application_number), inserted with INSERT OR IGNORE so duplicates are skipped with photos untouched.
  • marriages are stored as kind=domestic, impediments as kind=international. Upgrading keeps existing rows: the legacy notices table is migrated and dropped.
  • New rows download both original photos (/files/download?...) and upload to {prefix}/{kind}/{application_number}/{groom|bride}_original{ext}, recording the stored URL back in the row.
  • Without S3_ENDPOINT + S3_BUCKET, rows are stored without photo upload.

See .env.example and bmd fetch --help.

Mise tasks

mise run build
mise run fetch -- --dataset all --max-pages 2 --verbose
mise run fetch:marriages
mise run fetch:impediments
mise run stats -- --db bmd.db

About

Births, deaths and marriages

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages