Coder Social home page Coder Social logo

kristjanmik / kjosturett-web Goto Github PK

View Code? Open in Web Editor NEW
22.0 12.0 18.0 447.01 MB

One stop for Parliament elections in Iceland - http://kjosturett.is

Home Page: http://kjosturett.is

License: Other

JavaScript 83.56% CSS 0.39% Shell 0.17% Python 0.26% Dockerfile 0.11% SCSS 15.51%

kjosturett-web's Introduction

Kjósturétt.is / Vote Correctly - A one-stop for Parliament elections in Iceland

Citizens have the right to non-biased information to cast an informed vote. We, the people of Iceland, built this project to solve this problem for local elections.

The process

Each party is given the same list of questions where they can fill out as pleased within a word count limit. This ensures that all parties are represented equally. Responses are then compiled and listed on our platform. KJósturétt builds on a trusted and proven track record since 2013 and holds integrity and transparency above all.

Technical information

The master branch is currently being worked on in time for the 2021 parliamentary elections. Refer to other branches for snapshots of older elections.

manual build

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

docker-compose

Automatically build and run the app on port 3000

docker-compose up

Information on our Datasets

We have some relations in the dataset that have to be linked together. These relations complicate the project a bit but give us the benefit of having all the repo data in an easily readable and flat format. All data lives in the data folder. To build the dataset run ./build.sh inside the /data folder. All the output goes to /data/build folder. Some data needs to be built separately. We state this where needed.

Are you having trouble building the data? Check out the data/build_dump-22-10-17-09-58.zip for an older archive that can be unzipped into data/build, and the project should run just fine.

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 screen scraper. The second request to this endpoint with the same kennitala is cached heavily for one 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

A file that lists all catagories and their statement 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 too 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 the name where .r represents the reply.

/data/build/replies-parties.json

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

.n represents the name where .r represents the reply.

How does the reply string work?

When a person answers all the questions, we generate a numerical sequence. Each number represents 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 neutral response. This is the format of each number in the sequence.

  • 1 stands for very much against, with the value of 0
  • 2 stands for somewhat against, with a value of 0.25
  • 3 stands for neutral, with a value of 0.5
  • 4 stands for somewhat agree, with a value of 0.75
  • 5 stands for very much agree, with value of 1
  • 6 stands for no response

kjosturett-web's People

Contributors

andri avatar axelg12 avatar eirikurn avatar hlodver avatar hugihlynsson avatar kristjanmik avatar minigod avatar rthor avatar zjonsson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kjosturett-web's Issues

Autoscroll þegar málefni/flokkur er valinn

Þegar ég reyni að vafra um síðuna og skoða flokka og málefni þá lendi ég í rosalega óþægilegu scrolli (kippist efst á síðuna og smooth scrollar niður til baka á réttan stað) alltaf þegar ég opna nýtt „accordion“ eða section eða hvað sem við viljum kalla það.

Screen Capture on 2021-08-23 at 21-31-51

  • Google Chrome Version 92.0.4515.159 (Official Build) (arm64)
  • macOS 11.4 – macbook pro 13" M1

Error when building the project

when I run: npm run build-data I get this error:

(async () => {
^

SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)

Fonts are very thin on Safari on Mac OS if Roboto Thin is installed

Steps to reproduce:

  1. Use MacOS
  2. Install the Roboto Thin font: https://fonts.google.com/specimen/Roboto?selection.family=Roboto:100
  3. Open a page with <p> elements (for example https://kjosturett.is/flokkur/vinstri-graen) in the default browser, Safari

What happens:
Body text renders very thin, making it hard to read (see screenshot)

What should happen:
Body text should have the same legibility on all platforms, whether the font is already installed or not

screen shot 2017-10-18 at 19 40 48

Why is computing scores uing 0.8 and -0.8 and not 0.5 and -0.5

In this code which computes a match % based on your answers, partial support and partial objection answers are mapped to 0.8 and -0.8, instead to what I would find more intuitive 0.5 and -0.5:

https://github.com/kristjanmik/kjosturett-web/blob/master/src/process-replies.js

Why is this? The original code this is based on (https://gist.github.com/borgar/5b59dc2d70d1a93bdce5e4fb15ec7d71#file-matchranking-js) has 0.5 and -0.5. The commit which made this change is not very descriptive: 3c9731b

cc @sraka1 @rthor

Process candidate images

We've got a few hundred images of candidates that we need to crop into 500x500px face images. Does anyone want to take this task? I'm guessing there's an easy solution that won't require manually cropping each image.

The original images should not be changed, we should rather output a new version into /data/candidates-processed/*.

Task includes:

  • Crop image, center around face.
  • Resize to 500x500px.
  • Optimize file size.

Display map & opening hours for absentees voting abroad

Display location map of (kjörstaðir) embassies and consulates all over the world and the opening hours of each one of them. Useful for voters that are traveling.

Also add this feature to the "Hvar á ég að kjósa" feature, so depending on where you have permanent residence (lögheimili) you will have a map of those polling stations (kjörstaðir) close to you and the opening hours of them - in order to choose where to go if you live in the middle between two of them.

The only problem is that we need an easy access to this data. I'm waiting for a response from Home Office (Innanríkisráðuneytið).

Parties' replies displayed above each question

Ég veit að það er nú ekki langt í kosningar en ég var að taka kosningaprófið og langaði svo mikið til að sjá svör flokkanna við hverja spurningu í kosningaprófinu. Hvað finnst ykkur? Þá gætu svör flokkana verið falin þar til notandinn hefur svarað spurningunni. Þetta getur verið praktískt ef manni finnst einhver ákveðin málefni mikilvæg og maður vill bera sitt svar við svar allra flokkana.

Ein hugmynd að útfærslu:
Lista lógó flokkanna fyrir ofan svarmöguleikana, og mögulega hægt að hovera yfir lógó til að fá fullt nafn flokksins:
Artboard

Ef þið eruð til í þetta þá gæti ég útfært þetta fljótlega

Kosningaspá based on most important topics

We could have a test where you select 3 of your most important topics. We could then show the parties that support that topic based on the questions we asked them.
This idea is based on a conversation I had with a friend:

eina hugmyndin sem ég var með var að snúa þessum "match making" gaur á haus
og hætta að spyrja um skoðanir og skoða frekar aðstöðu
ég á við: að gera yngra fólki mögulegt að raða upp það sem skiptir máli fyrir þau, short term, til að fá að sjá hverjir standa vörð um þá hagsmuni
svona: "ef þú átt ekki bíl þá má þér barra standa á sama um bílamál"
og ef þú ert í skóla þá þarf að standa vör um hann
hljómar súper einfalt en þá eru hugsnónir og dýpri skoðanir teknar í burtu

Voting test work

We are officially working on a voting test. The plan has been laid out and we will have to crunch really hard to make this work in time. The plan is to launch this Monday, and by then we need all the replies from the parties as well as do all the coding work.

Me, @rthor and @thorsteinsson have started doing work on this, any more takers?

Kosningar 2021

Nú fer að styttast í kosningarnar og ekki seinna vænna en að keyra verkefnið í gang aftur. Það eru spennandi sex vikur framundan og ekki hika við að taka þátt í uppbyggingunni!

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.