Skip to content

bootleq/feeders-charts

Repository files navigation

Feeders Charts

Interactive charts in feeders.fyi (repo).

Visit online: https://feeders.fyi/charts/

This app is built as static export, thus can be deployed elsewhere.

Getting Started

Copy .env.sample to .env.development.

Prepare data sources in public folder, run pnpm data:serve.

Run the development server:

pnpm dev

Open http://localhost:3000 to see the result.

Data Preparation

Latest data is committed into data directory.

Use below scripts to reassemble, update:

  • pnpm data:download: Download raw data from simple data sources
  • pnpm data:human_pop: Fetch and transform human_population data
  • pnpm data:shelter_pet: Fetch and transform shelter detail data
  • pnpm data:heat_map: Fetch and transform heat map data
  • pnpm data:law: Fetch and transform animal protect act enforcement data
  • pnpm data:manually: Transform manually collected (already built-in in repo) data
  • pnpm data:tainan: Fetch and transform Tainan TNVR report data
  • pnpm data:reduce: Normalize and combine all processed data (except Tainan's)
  • pnpm data:serve: Copy transformed data to public/ folder to really use them in app

Above scripts have hash/time checking so will stop if detect no change. Use DATA_CONTINUE_WHEN_SAME_HASH=1 or append :force to each script (e.g., pnpm data:download:force) to force continue.

Data Sources

以下為人工收集資料,並建檔於 data 目錄中:

  • 民國 106 ~ 108 年的「最大容留數」和「在養數」資料

    這三年的收容資料並未包含在 data.gov.tw 或 pet.gov.tw,應該是因為當年沒有將犬/貓分開計算, 但可以在 animal.moa.gov.tw 找到零星資料,所以手動整理到個人文章附錄的 google doc 文件
    https://animal.moa.gov.tw/Frontend/Know/PageTabList?TabID=31B05CB46007226417F0F5FB8A80096E#tab3

    但仍無法區分犬/貓,而會是合併的數字

    data/shelter_occupy_106_108.csv

  • 民國 96 年以前的資料

    「收容所資料」未找到正式來源,故採用台灣之心 HOTAC 網站整理數字,其資料來源為「行政院農委會動植物防疫檢疫局-統計年報」

    另有與動社的「從生命到垃圾」網站整理數字比較,其來源為農委會防檢局提供立委資料,兩者差距不大

    其他含 88 年遊蕩犬資料等,CSV 統整資料取自個人文章附錄的 google doc 文件

    data/countrywide.csv

以下有機會處理,但最終未使用:

  • 全國公立動物收容所收容處理情形統計表 (106 ~ 113 年)
    https://data.gov.tw/dataset/41236

    和動保資訊網提供的數字對不起來,年度也不齊全

Tainan

台南市有調查各行政區的 TNVR 成果,因不易與全國縣市整合呈現,所以做成獨立的圖表頁面

https://feeders.fyi/charts/tainan

Test

Tests were running on dev server.

  • pnpm test: Run all tests
  • pnpm test:shots: Update screenshots

Build

Do static export to out directory.

To preview, serve it with web server like nginx, follow basePath in .env, e.g.,: NEXT_PUBLIC_BASE_PATH=/feeders-charts

Example nginx config:

location /feeders-charts {
  alias /path/to/feeders-charts/out;
  index index.html;
  try_files $uri $uri.html $uri/ =404;
}

Deployment

This project will be deployed as a sub path under feeders, use pnpm push:out to push built assets to a intermediate repo (not public available now), then feeders should manage following tasks.

About

Interactive charts in feeders.fyi

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published