This is the open-source repository for DDDC, based on Decidim, implementing the DECODE prototypes.
You will need to do some steps before having the app working properly once you've deployed it:
- 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/
docker-compose run app bundle exec cap staging deploy
Push master branch to Heroku.
We implemented the DECODE prototypes based on a Decidim module. It's on the decidim-petitions/
directory.
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.
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" ]
}
]
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 } }"}'