Skip to content

DECODEproject/DDDC-instance

Repository files navigation

Digital Democracy and Data Commons for Barcelona

This is the open-source repository for DDDC, based on Decidim, implementing the DECODE prototypes.

Setting up the application

Development

You will need to do some steps before having the app working properly once you've deployed it:

  1. Clone this repository, go to the directory and starts with docker-compose
git clone https://github.com/alabs/DDDC
cd DDDC
docker-compose up
docker-compose run app rails db:create
docker-compose run app rails db:migrate
docker-compose run app rails db:seed

Go to http://localhost:3000/

Staging

docker-compose run app bundle exec cap staging deploy

Production

Push master branch to Heroku.

About petitions module

We implemented the DECODE prototypes based on a Decidim module. It's on the decidim-petitions/ directory.

Configuring

Dependencies:

  • dddc-credential-issuer. Configures at config/secrets.yml (decode.credential_issuer).
  • dddc-petitions. Configures at config/secrets.yml (decode.credential_issuer).
  • bcnnow. Configures at config/secrets.yml (decode.credential_issuer).
  • zenroom. Binary self contained on decidim-petitions/bin/zenroom-static. If you want to upgrade it, you can follow these instructions (changing 0.8.1 for the new version as published on Zenroom. You can download the binary from Dyne.org (https://sdk.dyne.org:4443/view/decode/):
wget https://sdk.dyne.org:4443/view/decode/job/zenroom-static-amd64/lastSuccessfulBuild/artifact/src/zenroom-static -O decidim-petitions/bin/zenroom-static

Go to the /admin, configure a new Participatory Process, add Petition component and configure a Petition.

Screenshots

JSON Schema and Attributes Authorization

It's important to configure some JSON data so it's consumed by the DECODE's APIs:

json_schema

{
  "mandatory": [
    {
      "predicate": "schema:addressLocality",
      "object": "Barcelona",
      "scope": "can-access",
      "provenance": {
        "url": "http://example.com"
      }
    }
  ],
  "optional": [
    {
      "predicate": "schema:dateOfBirth",
      "object": "voter",
      "scope": "can-access"
    },
    {
      "predicate": "schema:gender",
      "object": "voter",
      "scope": "can-access"
    }
  ]
}

json_attribute_info

[
  {
    "name": "codes",
    "type": "str",
    "value_set": [ "eih5O","nuu3S","Pha6x","lahT4","Ri3ex","Op2ii","EG5th","ca5Ca","TuSh1","ut0iY","Eing8","Iep1H","yei2A","ahf3I","Oaf8f","nai1H","aib5V","ohH5v","eim2E","Nah5l","ooh5C","Uqu3u","Or2ei","aF9fa","ooc8W" ]
  }
]

json_attribute_info_optional

[
  {
    "k": 2,
    "name": "age",
    "type": "str",
    "value_set": [ "0-19", "20-29", "30-39", ">40" ]
  },
  {
    "k": 2,
    "name": "gender",
    "type": "str",
    "value_set": [ "F", "M", "O" ]
  },
  {
    "k": 2,
    "name": "district",
    "type": "str",
    "value_set": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ]
  }
]

GraphQL

To consume some data, you can do it on the GraphQL API:

{
petition(id:"1") {
id,
title,
description,
author,
json_schema,
image,
credential_issuer_api_url,
petitions_api_url,
attribute_id
}
}

An example with curl:

curl 'https://betadddc.alabs.org/api' -H 'content-type: application/json'  --data '{"query":"{ petition(id:\"1\") { id, title, description, author, json_schema, image, credential_issuer_api_url, petitions_api_url, attribute_id } }"}'

About

Digital Democracy and Data Commons for Barcelona

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages