Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Plataforma de disponibilização de programas eleitorais para eleições

License

NotificationsYou must be signed in to change notification settings

Politica-Para-Todos/ppt-website

Repository files navigation

Platform that allows you to comment and annotate political manifestos.

Installation

With docker

comentAR comes with a docker compose configuration files that boots the necessary PostgreSQL dependency for you, as well as building a container with all the dependencies such as the required gems and the yarn packages.

After booting the environment withdocker-compose up -d a container nameddev is waiting to run everything necessary.

# Shell into the dev containerdocker-composeexec dev bash# Run database migrationsbundleexec rake db:createbundleexec rake db:migrate# Populate databasebundleexec rake data:populate# Boot up a rails server on port 3000bundleexec rails server

If you have a webpacker error try to run this commandbundle exec rails webpacker:install -s.

Others commands you can run inside the docker container:

# Shell into the dev containerdocker-composeexec dev bash# Install missing dependenciesbundle install# Boot up a rails consolebundleexec rails console# Create yarn.lockbundleexec rails webpacker:install -s

The repository directory is mounted as a volume inside the container so changes you do are reflected inside.

Without docker

The following instructions are for the mac OS, so translate to your own environment if need be.

# Clone the repositorygit clone git@github.com:Politica-Para-Todos/comentARcd comentAR# Ruby 2.7# Just use rbenv (https://github.com/rbenv/rbenv) or similar to install itrbenvlocal 2.7.1# PostgreSQLbrew install postgresqlbrew services start postgresql# Yarnbrew install yarn# Install all ruby dependenciesgem install bundlerbundle install# Install all yarn dependenciesyarn install# Run database migrationsbundleexec rake db:createbundleexec rake db:migrate# Boot up a rails consolebundleexec rails console# Boot up a rails server on port 3000bundleexec rails server# And so on...

Admin console

There is an admin console available athttp://localhost:3000/admin to aid in the management of data and/or the application.

Current data model

The application implements the following data model.

Party

The entity that represents a political party. Has many Manifestos.

Manifesto

This is the entity that represents a political manifesto. Just holds a title attribute. It is composed by Manifesto Sections.

Manifesto Sections

As manifestos are quite large, they are usually divided into sections. Each section may have sub sections ad nauseam. A section has a content attribute that generally represents its title, and a markdown document with all its textual content.

The markdown document in each section is automatically converted into Manifesto Items when the section is created or updated.

Manifesto Items

A paragraph, header or list item in a manifesto. Each one is individually commentable and annotateable. Each has a numeric unique private key, as well as a hash that identifies them uniquely in the system.

When its Manifesto Section is updated using a slightly different document, only the items that are different are replaced, the others are just updated in order not to mitigate the loss of comments or annotations.

Comments

A regular comment by a regular user. Not to be confused with the current Comments tab on the admin console, which is a feature of the library that implements it.

User

A user that signs up in the platform. May have email credentials or authenticate via oauth from twitter, facebook or google.

AdminUser

A user that manages the platform.This is not a User, nor has anything to do with the User entity.

Populating the database

There is a handy rake task that populates the database from a JSON file with a given format. You can run it by evoking:

bundleexec rake data:populate

By default it will use the file available atdb/seeds.json as input, but you can point it to any URL. For example, if you want it to populate the database from a JSON you uploaded to GitHub Gists, just give it its URL. Make sure to point to theraw link.

bundleexec rake'data:populate[https://gist.githubusercontent.com/punnie/a119b9138ceed7a1d63a22a5fb3c0bab/raw/e9f8735950423a690f190789023e558c71c045a5/candidates.json]'

Observe the single quotes around the rake task specification and the URL. You must use it or else your shell will complain.

Populating the database in production

If you want to run it in the context of an environment, such as staging or production, you must haveheroku tools installed and configured, and run it as such:

heroku run bundleexec rake data:populate --app politica-para-todos

If the database already has data do:

  1. Go to Heroku andResources -> Heroku Postgresql -> Settings -> Reset Database

  2. Run:

heroku run bundleexec rake db:migrate --app politica-para-todosheroku run bundleexec rake data:populate --app politica-para-todos

Idempotency

The rake task will match existing Parties by theiracronym, which means that if there is an acronym change, a new Party will be created.

Likewise, it will match existing Candidates by their Party ID, district and position. The name might be a good candidate, but with so many corrections at boot I wasn't sure it would be a good idea.

About

Plataforma de disponibilização de programas eleitorais para eleições

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors12


[8]ページ先頭

©2009-2025 Movatter.jp