{"id":13994089,"url":"https://github.com/openelections/openelections-core","last_synced_at":"2025-07-22T18:33:16.528Z","repository":{"id":1544656,"uuid":"11376829","full_name":"openelections/openelections-core","owner":"openelections","description":"Core repo for election results data acquisition, transformation and output.","archived":false,"fork":false,"pushed_at":"2022-01-21T18:56:12.000Z","size":10899,"stargazers_count":179,"open_issues_count":43,"forks_count":98,"subscribers_count":31,"default_branch":"master","last_synced_at":"2024-11-29T15:50:53.524Z","etag":null,"topics":["elections","openelections"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openelections.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-12T19:52:57.000Z","updated_at":"2024-11-12T18:36:23.000Z","dependencies_parsed_at":"2022-08-06T10:16:36.610Z","dependency_job_id":null,"html_url":"https://github.com/openelections/openelections-core","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/openelections/openelections-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openelections%2Fopenelections-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openelections%2Fopenelections-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openelections%2Fopenelections-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openelections%2Fopenelections-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openelections","download_url":"https://codeload.github.com/openelections/openelections-core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openelections%2Fopenelections-core/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266552546,"owners_count":23947178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elections","openelections"],"created_at":"2024-08-09T14:02:41.973Z","updated_at":"2025-07-22T18:33:11.491Z","avatar_url":"https://github.com/openelections.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## Open Elections core code\n\n[![Build Status](https://travis-ci.org/openelections/openelections-core.svg?branch=dev)](https://travis-ci.org/openelections/openelections-core)\n\nCore repo for election results data acquisition, transformation and output.\n\nOpenElections core is developed and tested using Python 3. The package\nmight not work with older Python distributions.\n\n### Getting started as a developer\n\nYou'll:\n\n* set up a virtual environment\n* fork/clone this repository, install dependencies\n* add any optional configuration details you need (e.g. Mongo or AWS)\n\n#### Setting up a virtual environment\n\nYou should use [pipenv](https://pipenv.readthedocs.io/en/latest/) to work on Open Elections inside a virtualized development environment.\n\nThe easiest way is to install these tools system-wide with `pip` (you may need to use `sudo`):\n\n```bash\n$ pip install --upgrade pipenv\n```\n\nThen, to make a virtual environment for open elections work:\n\n```bash\n$ pipenv install --dev\n```\n\nTo activate the virtual environment, run:\n\n```bash\n$ pipenv shell\n```\n\n#### Fork and set up this project\n\n[Fork this repo](https://help.github.com/articles/fork-a-repo) by hitting the \"Fork\" button above, and clone your fork to your computer:\n\n```bash\n$ git clone https://github.com/[my_github_user]/openelections-core.git\n$ cd openelections-core\n```\n\nTurn setup and activate the virtual environment from the previous step, if you haven't already:\n\n```bash\n$ pipenv install --dev\n$ pipenv shell\n```\n\nInstall MongoDB\n\nTo store your data in MongoDB, you need only [install Mongo](http://docs.mongodb.org/manual/installation/). The [default configuration](https://github.com/openelections/openelections-core/blob/master/settings.py.tmplt#L7-L20) should auto-create the databases and tables you need, as you need them.\n\nAt the very least, you'll want to make sure the values in the ``MONGO`` variable work for the way you've installed and configured MongoDB on your system.\n\nCreate a `settings.py` file.\n\n```bash\n$ cp settings.py.tmplt settings.py\n```\n\nYou can put this settings file anywhere on your filesystem.  You'll need to set the ``OPENELEX_SETTINGS`` environment variable to the [absolute path](http://en.wikipedia.org/wiki/Path_(computing)) to the ``settings.py`` file that you created.\n\nYou can set the `OPENELEX_SETTINGS` environment variable by creating a `.env` file in your repository. For example:\n\n```\nOPENELEX_SETTINGS=/Users/[myusername]/Development/openelections-core/settings.py\n```\n\nRunning `pipenv shell` will automatically source any variable in your `.env` file.\n\n#### Running management commands\n\nTest it out by running `openelex --help`, you should see something like:\n\n```bash\n$ openelex --help\nUsage: openelex [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  bake.election_file             Write election and candidate data with on...\n  bake.results_status_json       Output a JSON file describing available...\n  bake.state_file                Write election and candidate data along\n                                 with...\n  cache.clear                    Delete files in state cache diretory\n  cache.files                    List files in state cache diretory\n  datasource.elections           List elections for a state.\n  datasource.filename_url_pairs  List mapping of standard filenames to\n                                 source...\n  datasource.mappings            List metadata mappings for a state\n  datasource.target_urls         List source data urls for a state\n  fetch                          Scrape data files and store in local file...\n  load.run                       Load cached data files into the database\n  load_metadata.run              Populate metadata in database from fixture...\n  publish                        Publish baked result files\n  shell                          Open a Python shell, bootstrapping the...\n  transform.list                 Show available data transformations\n  transform.reverse              Reverse a previously run transformation\n  transform.run                  Run data transformations\n  validate.list                  Show available validations for state\n  validate.run                   Run data validations for state\n```\n\nRunning commands looks something like this:\n\n```bash\n$ openelex cache.clear --state=NY\n0 files deleted\n0 files still in cache\n```\n\nYou can also get help on particular commands, e.g. `openelex --help cache.clear`.\n\n#### Configuring services (optional)\n\nIf you are going to load results, you need to configure MongoDB connections in\n`openelex/settings.py`.\n\nIf you are a core contributor who needs to publish baked results to one of the GitHub repositories, you will need to define further settings.\n\nTo set GitHub credentials, you must first create a [personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use) and then uncomment and set these values in `openelex/settings.py`:\n\n```python\nGITHUB_USERNAME = ''\nGITHUB_ACCESS_TOKEN = ''\n```\n\n#### Load party and office metadata (optional)\n\nYou only need to do this if you plan to write data loaders or transforms.\n\n```bash\n$ cd openelex\n$ openelex load_metadata.run --collection=office\n$ openelex load_metadata.run --collection=party\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenelections%2Fopenelections-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenelections%2Fopenelections-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenelections%2Fopenelections-core/lists"}