Coder Social home page Coder Social logo

hlodver / kjosturett-web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kristjanmik/kjosturett-web

0.0 1.0 0.0 401.99 MB

One stop for Parliament elections in Iceland 2017, https://kjosturett.is

License: Other

JavaScript 84.17% Shell 0.40% CSS 15.43%

kjosturett-web's Introduction

We are having a hackathon on the 22nd of October: https://www.facebook.com/events/1493507597370764/

##Getting started

npm install
npm run build-data

Node v8 or higher is needed to run the data build step You can then start the server at port 3000

npm start

Why do we build the data?

We have some relations in the dataset that have to be hooked. This complicates the process but gives us the huge benefit of having all the data here in the repo, easily readable and flat. All data lives in the data folder. To build the data run ./build.sh inside that folder(nodejs v8 required). All the output goes to /data/build folder. Some data needs to be built seperately. We state this where needed.

Having trouble building the data? Check out the data/build-dump folder for archives. You can unzip the most recent folder into data/build and the project should run just fine

How does the reply string work?

When a person answers all the questions we generate a numerical sequence. Each number represent one question. You can think of this zero to one scale as 0 being extremely against(mjög á móti) and 1 being (mjög sammála). 0.5 is a neautral response.This is the format of each number in the sequence.

  • 1 stands for first option, with value of 0
  • 2 stands for first option, with value of 0.25
  • 3 stands for first option, with value of 0.5
  • 4 stands for first option, with value of 0.75
  • 5 stands for first option, with value of 1
  • 6 stands for no response

Data sources

We have various data sources. Described below are data sources that are available after the build step, but the raw data is also available in /build

Thingmenn.is

Thingmenn.is is a great project where you can see all the discussion by people in Alþingi, ranked by how they vote.

Where do I vote?

You can query the kjorskra endpoint at: https://kjorskra.kjosturett.is/leita/{{VALID-KENNITALA}}. This endpoint can take up to 2-4 seconds to load since we are using a very slow screenscraper. Second request to this endpoint with the same kennitala is cached heavily for 1 month. If .success is false, the kennitala is most likely invalid

{
	"success": true,
	"kennitala": "1234567890",
	"nafn": "Jón Jónsson",
	"logheimili": "Melbær 14",
	"kjordaemi": "Reykjavíkurkjördæmi suður",
	"sveitafelag": "Reykjavík",
	"kjorstadur": "Árbæjarskóli",
	"kjordeild": "1"
}

/data/build/{{party}}.json

Lists all categories for a party. Likely to change to include party specific data as well

[{
	"category": "atvinnumal",
	"name": "Atvinnumál",
	"statement": "<p>Alþýðufylkingin hafnar framsali á samningsrétti einstakra verkalýðsfélaga...</p>\n"
},{}]

/data/build/{{category}}.json

[{
	"letter": "A",
	"url": "bjort-framtid",
	"name": "Björt Framtíð",
	"nameDeflected": "Bjartrar Framtíðar",
	"website": "http://www.bjortframtid.is",
	"leader": "Óttarr Proppé",
	"leaderTitle": "Formaður",
	"statement": "<p>Björt framtíð hefur þegar beitt sér fyrir setningu fjárfestingaáætlunar...</p>"
},{}]

/data/build/candidates.json

First 6 people from every party in every region

[{
	"saeti": 1,
	"nafn": "Erna Lína Örnudóttir Baldvinsdóttir",
	"kjordaemi": "sudvestur",
	"slug": "erna-lina-ornudottir-baldvinsdottir",
	"bokstafur": "R",
	"svar": "112541123451234512345123451234"
},{}]

See How does the reply string work? for .svar clarification

/data/build/categories.json

All categories, aka málefnaflokkar(should be topics but we are just to deep :P)

[{
  "name":"Atvinnumál",
  "url":"atvinnumal"
},{}]

/data/build/parties.json

[{
	"letter": "A",
	"url": "bjort-framtid",
	"name": "Björt Framtíð",
	"nameDeflected": "Bjartrar Framtíðar",
	"website": "http://www.bjortframtid.is",
	"leader": "Óttarr Proppé",
	"leaderTitle": "Formaður"
},{}]

/data/build/replies-candidates.json

[{
  "n":"Alþýðufylkingin",
  "r":"112541123451234512345123451234"
},{}]

.n represents name where .r represents the reply.

/data/build/replies-parties.json

[{
  "n":"Alþýðufylkingin",
  "r":"112541123451234512345123451234"
},{}]

.n represents name where .r represents the reply.

kjosturett-web's People

Contributors

kristjanmik avatar rthor avatar axelg12 avatar hugihlynsson avatar eirikurn avatar minigod avatar

Watchers

Hlöðver Þór Árnason avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.