Giter Site home page Giter Site logo

rla-raire-connector-service's Introduction

raire-java

Java implementation of RAIRE

PreReq: Java 11, Maven.

Running the connector

Run instructions:

  • Option 1:
    • Go to au.org.democracydevelopers.raise.RaireJavaApplication class and run the main method from IDE
  • Option 2:
    • Go to home directory of the service and run following command ./mvnw spring-boot:run

This will run the application on port 8080.

Running RAIRE

You need to have a running copy of the Raire webserver. If you are also running the colorado-rla client at the same time, ensure that it is running on a different port - by default, they use the same port.

For example, you might choose to run raire on port 3001 by starting it with

raire-webserver --socket 3001

If you are also running the colorado-rla client at the same time, ensure that they are running on different ports - by default, they use the same port.

For example, you might choose to run raire on port 3001 by starting it with

./target/release/raire-webserver --socket 3001

If you do so, you need to change application.yml correspondingly. Set the raire line to:

raire:
 url: http://localhost:3001/raire

or whatever other non-default port number you chose.

Running the database

The rla-raire-connector service retrieves data from the database set up by colorado-rla. This is also defined in application.yml. Ensure that the url, username and password match the database colorado-rla is writing to.

Generating assertions from corla

You can request assertions for any IRV contest already present in the colorado-rla database.

  1. Log in as a stateadmin.
  2. From the browser where you are logged in as stateadmin, visit http://localhost:8888/generate-assertions.

Generating assertions from the command line

Alternatively, you can request assertions directly via the command line.

  • Follow the syntax in following curl
curl --location 'localhost:8080/cvr/audit' \
--header 'Content-Type: application/json' \
--data '[
{
"contestName": "Denver Mayoral",
"timeProvisionForResult": 10
}
]'

your output should look similar to

[
    {
        "contestName": "Denver Mayoral",
        "result": {
            "metadata": {
                "candidates": [
                    "CANDIDATE 1",
                    "CANDIDATE 2",
                    "CANDIDATE 3"
                ]
            },
            "solution": {
                "Ok": {
                    "winner": 1,
                    "margin": 4,
                    "difficulty": 78.0,
                    "assertions": [
                        {
                            "margin": 48,
                            "difficulty": 6.5,
                            "assertion": {
                                "type": "NEB",
                                "winner": 1,
                                "loser": 0
                            }
                        },
                        {
                            "margin": 4,
                            "difficulty": 78.0,
                            "assertion": {
                                "type": "NEB",
                                "winner": 1,
                                "loser": 2
                            }
                        },
                    ],
                    "num_candidates": 13,
                    "time_to_determine_winners": {
                        "work": 13,
                        "seconds": "0.000039899"
                    },
                    "time_to_find_assertions": {
                        "work": 25,
                        "seconds": "0.000454404"
                    },
                    "time_to_trim_assertions": {
                        "work": 24,
                        "seconds": "0.00002241999999999997"
                    }
                }
            }
        }
    }
]

rla-raire-connector-service's People

Contributors

amitmahindrakar avatar vteague avatar michelleblom 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.