Skip to content

electinth/past-election-map

Repository files navigation

Table of Contents generated with DocToc

Past Election Map for Thailand

What is this about?

ELECT's mission is to make politics more accessible for Thai people. With Past Election Map, we want to show information in the geo-political area. The goals are to display:

  • How vote zone visually changes, e.g. any gerrymandering ongoing?
  • How power wrangling between parties evolves, both provincially and regionally.
  • How well candidates run campaigns over several elections.

Development

Prerequisites

You need to install these tools first in order to develop this project:

  • Node.js (10.x)

Install dependencies

npm i

Run development mode

npm start

Build the project into a static web page

npm run build

Release project

npm version [major|minor|patch] && git push --tags

When pushing tags, we have a GitHub Action that will automatically build the project and upload the build artifiact to the release page.

Resources for Developers

Environments

Environment Description
Dev Each PR will be built and hosted on Netlify.
Staging Latest features awaiting for release.
Production Public website. No launch date yet.

System Design

Election zone

Election zone data is stored in src/data/thailand-election.topojson with multiple object layers for each election year e.g. B.E. 2562, 2557, 2554 and 2550. This is a concise data:

{
  type: "Topology",
  arcs: [
    /* ... */
  ],
  objects: {
    "eleciton-2562": {
      /* ... */
    },
    "eleciton-2557": {
      /* ... */
    },
    "eleciton-2554": {
      /* ... */
    },
    "eleciton-2550": {
      type: "GeometryCollection",
      geometries: [
        {
          arcs: [[4567, -3932, -3905, -3920, -4038]],
          type: 'Polygon',
          properties: {
            id: '90-6',
            province_id: '90',
            province_name: 'สงขลา',
            province_name_en: 'Songkhla',
            zone_id: 6,
            zone_name: 'สงขลา เขต 6'
            code_name: 'สข',
            code_name_en: 'SKA',
            region_id: '4',
            region_name: 'ใต้',
            detail:
              'อ.คลองหอยโข่ง, อ.สะเดา ...',
          }
        },
        /* more election zones */
      ]
    }
  }
}

Winners of election zones are stored yearly in src/data/candidate_result_*.csv:

id,province,zone,candidate_no,title,first_name,last_name,party,score
1,กระบี่,1,10,นาย,สาคร,เกี่ยวข้อง,ประชาธิปัตย์,58895
2,กระบี่,1,1,นาย,ชัยณรงค์,ช่างเรือ,เพื่อไทย,16420
3,กระบี่,1,12,นาย,ชูวงศ์,มณีกุล,รักษ์สันติ,752

Help Wanted

Contribute

Every helping hand is appreciated. You can start by checking pending issues, post a comment saying you want to help the issue, code with fun, then send a PR. We believe all merges contribute to a democratic movement for Thialand.

Join Slack

To get more involved with ELECT team, create an issue titled "Join team on Slack" with your email. Then wait for an invitation.