Skip to content

badgooooor/parliament-watch

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘€ Parliament Watch

Citizens are watching

Parliament Watch

Table of Contents

⭐ Goal

We want to record and visualise the Thai parliament information including politicians, assemblies, bills, voting processes, and promises.

This project can be seen as a renovated combination of They Work for Us, Law Watch, and Promise Tracker which aim to support several election eras.

🌎 Environments

Name URL
Production https://parliamentwatch.wevis.info
Staging (main branch) https://parliament-watch.pages.dev

Currently pausing due to the backend migration

🍱 Tech Stack

Front-end

Local development

  • Yarn v1 as a package manager
  • Husky and lint-staged will
    • Lint (ESLint) and format (Prettier) code before committing
    • Validate that commit message is aligned with conventional commit using commitlint
    • Run svelte-check before pushing
  • For VSCode user, format on save is enabled and prettier-vscode extension will be recommended when open the project.
  • Hygen for a code generation

Deployment pipeline

  • Staging: Each push will trigger the Github Actions Workflow to build the site, upload the build artifact, and deploy on Cloudflare Pages. Can also be triggered manually. We are pausing staging CI/CD pipeline in GitHub Action due to the failed build during new data backend migration.
  • Production: The Github Actions Workflow can only be manually triggered to download the latest build artifact and upload to our server through SSH.

πŸͺ„ Useful Commands

Start SvelteKit

Start the project in development mode

yarn dev

Start Histoire

to see/develop custom components from Histoire's stories

yarn story:dev

Generate a new component

For a shared component

yarn gen:component

src/components/ComponentName/ directory will be created with the following files:

  • ComponentName.svelte for the component source code.
  • ComponentName.story.svelte for the Histoire's story file. Follow a guide on writing stories.

Log

Server-side logging for data warning and SvelteKit error can be enabled via environment variable process.env.LOG_TARGET by setting it to stdout or file. More details in logger.ts.

πŸ—ƒοΈ Directory Structure

  • /_templates Hygen's code generation templates
  • /.husky Husky's git hooks
  • /src main source codes
    • /components Svelte's components
    • /mocks Mock data, while we still don't have backend
    • /models Main data structure defined with TypeScript interface
    • /routes Sveltekit's routes
    • /styles Stylesheets, including custom Carbon Design System, tailwind and fonts
  • /static static assets such as logos

🍭 Design System

The project design system is based on Carbon Design System v10 with some modification. Custom theme is defined with SCSS in src/styles/carbon/. To reduce overhead on development, we compile Carbon related stylesheet into src/styles/carbon/precompiled.css with yarn sass:build command.

Typography

Colors

Components

  • Use Carbon Components Svelte
  • We have custom shared component available in src/components/.
    • To see shared components' story, open Histoire in local with yarn story:dev
  • If the component is not yet developed:
    • If the component is used by only a specific route, create it in src/components/route-name-and-sub-route-if-exist/
    • If the component is shared, run yarn gen:component to generate a new component. Don't forget to update a story file for the component documentation.

Icons

πŸ’Ύ Data Pipeline

We are migrating away from Google Sheets to our new political GraphQL service called "Politigraph". The data that are completely migrated are:

  • Politicians
  • Political Parties
  • Assemblies
  • Vote Events
  • Bills
  • Promises

Migrating away from: Google Sheets

Data is pre-process server-side during the Static Site Generation (SSG) build step as following

flowchart TD
    B[Google Sheets] --> |Fetched, validated, parsed| C(Sheethuahua)
    C --> |used in| D(Svelte's routes)
    D --> |Svelte SSR/SSG| E(dev/prod website)
    C --> |used in| G(Scheduled GitHub Action)
    F(External data source) --> |fetched by| G
    G --> |build| H(JSON on GitHub Page)
    H --> |fetched by| E(GitHub Page)
Loading

Migrating to: Politigraph

Politigraph is a Thai politics graph database using GraphQL and Neo4j. Fully migrated to this will allow us to run Parliament Watch in SSR mode, requesting data from Politigraph in real-time.

flowchart TD
    B[Politigraph's GraphQL] --> |fetched by| C(GenQL's generated client)
    C --> |used in| D(Svelte's routes)
    D --> |Svelte SSR| E(dev/prod website)
    C --> |used in| G(Scheduled GitHub Action)
    F(External data source) --> |fetched by| G
    G --> |build| H(JSON on GitHub Page)
    H --> |fetched by| E(SvelteKit SSR Website)
Loading
  • We use GenQL to generate type-safe GraphQL client, communicating with Politigraph GraphQL endpoint

🀝 Contributing Guideline

Please read CONTRIBUTING.md

πŸ“œ License

Our team is committed to developing all projects as Open Source and releasing data as Open Data under the Attribution-NonCommercial-ShareAlike 4.0 International license. This means the work can be used, adapted, and built upon, but it must not be used for commercial purposes or profit-making. Credit must be given to the original creators, and any derivative work must be shared under the same license as the original. WeVis Ltd. and Punch Up Ltd. are the joint licensors of this license.

About

Citizens are watching πŸ‘€

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Svelte 85.2%
  • TypeScript 13.4%
  • SCSS 0.7%
  • JavaScript 0.5%
  • HTML 0.1%
  • CSS 0.1%