Git Product home page Git Product logo

councilor-voter-guide's Introduction

councilor-voter-guide

議員投票指南
文件

原則 Principle

  • 預設皆開源
    Open source by default.

  • 不做家長式的媒體,不做議題上的價值高下判斷、排名
    No paternalism.

  • 如要引入非政府公開資訊,必需是全民可參與編輯協作的或是候選人、民代、政黨自行編輯的
    There is a necessary requirement to include nonofficial data:

    • All citizen could cooperate these data.
    • These data are publish by candidates, councilors themself.

Project Layout

In Ubuntu 14.04 LTS

Website (Python/Django)

0.1 install basic tools

sudo apt-get update
sudo apt-get upgrade
sudo reboot
sudo apt-get install git python-pip python-dev python-setuptools postgresql libpq-dev
sudo easy_install virtualenv

0.2 set a password in your database(If you already have one, just skip this step)

sudo -u <username> psql -c "ALTER USER <username> with encrypted PASSWORD 'put_your_password_here';"

e.g.

sudo -u postgres psql -c "ALTER USER postgres with encrypted PASSWORD 'my_password';"

Clone source code from GitHub to local

It is quite big now. please be patient. don't use command like git --depth

git clone https://github.com/g0v/councilor-voter-guide.git       
cd councilor-voter-guide/voter_guide/

Start virtualenv and install packages

(if you don' mind packages installed into your local environment, just pip install -r requirements.txt)

virtualenv --no-site-packages venv      
. venv/bin/activate        
pip install -r requirements.txt     

Create db & restore data

We use Postgres 9.5, please set your database config in voter_guide/local_settings.py.
Please create a database(e.g. voter_guide), below will use voter_guide for example

createdb -h localhost -U <username> voter_guide
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U <username> -d voter_guide local_db.dump

runserver

python manage.py runserver

Now you should able to see the web page at http://localhost:8000

Dumpdata(optional)

python manage.py dumpdata --exclude auth.permission --exclude contenttypes > db.json

Mac Related Instructions

Prepare Compiler

There are some python package written in C or C++ such as lxml. so a compiler is required. you can install a compiler via the following command:

xcode-select --install

Prepare PostgreSQL

You can install the packaged app here. put the app in your Application folder and click it to start.

And please add the following line to your ~/.bash_profile

export PATH=/Applications/Postgres.app/Contents/Versions/9.3/bin/:$PATH

please change the version number 9.3 if you download a different version of PostgreSQL.

after you add the PATH environment variable, source it.

source ~/.bash_profile

if you don't add the PATH variable, installation of psycopg2 will not success.

How to use this images

First Step: Download and Extract pgdata

git clone https://github.com/c3h3/g0v-cvg-pgdata.git && cd g0v-cvg-pgdata && tar xfzv 47821274c242ce68f2d8d18d4bb0d050d6481311.tar.gz
  • After that, you will get pgdata dir.
  • Assume pgdata's absolute path is "your_pgdata"

Second Step: RUN postgres with pgdata

docker run --name pgdb -v your_pgdata:/var/lib/postgresql/data postgres:9.3

If you want to use pgadmin connect with your db, you could also forwarding the port out ... with command ...

docker run --name pgdb -p 5432:5432 -v your_pgdata:/var/lib/postgresql/data postgres:9.3
  • "your_pgdata" is pgdata's absolute path in previous step.

Third Step: RUN web linked with pgdb

docker run --name g0v-cvg-web --link pgdb:postgres -p port_on_host:8000 -d c3h3/g0v-cvg-web

Crawler Docker c3h3 / g0v-cvg-crawler

How to use this images

Run Scarpy Server:

docker run --name g0v -p forward_port:6800 -v outside_items:/items -v outside_logs:/logs -d c3h3/g0v-cvg-crawler
  • "forward_port" is the port you want to forward into docker image (EXPOSE 6800)
  • "outside_items" is the directory you want to mount into docker image as /items
  • "outside_logs" is the directory you want to mount into docker image as /logs

Link Scarpy Server for Deploy and Submit Job:

docker run --link g0v:g0v -it c3h3/g0v-cvg-crawler /bin/bash

Example of Deploy ttc:

in a running docker instance which linked with g0v (Scarpy Server), you can use the following command to deploy tcc crawler to server:

cd /tmp/g0v-cvg/crawler/tcc && python deploy.py

Example of Crawl ttc.bills :

in a running docker instance which linked with g0v (Scarpy Server), you can use the following command to deploy tcc crawler to server:

cd /tmp/g0v-cvg/crawler/bin && python crawl_tcc_bills.py

CC0 1.0 Universal

CC0 1.0 Universal
This work is published from Taiwan.

councilor-voter-guide's People

Contributors

alchawk avatar asika avatar bryant1410 avatar c3h3 avatar chhsiao1981 avatar chiayint avatar chihchengliang avatar daikeren avatar denny0223 avatar ericj avatar etblue avatar felixonmars avatar ipaaa avatar kiya69 avatar kjelly avatar leo424y avatar pcchou avatar rz12345 avatar s890081tonyhsu avatar seadog007 avatar starsdog avatar swind avatar theacat avatar thewayiam avatar ttcat avatar walkingice avatar x4base avatar y12studio avatar yauhsien avatar yuchiang-hsiao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

councilor-voter-guide's Issues

表格顯示排序

一般人第一次看到這個表格沒辦法很快的反應說 是怎麼排序的
上禮拜跟不認識g0v的人介紹的時候被反映的問題
2014-11-19 11 39 37

Elasticsearch index import and Kibana

不知是否有人做過類似的功能,目前將議員 json 匯入 Elasticsearch 後由 kibana 輸出圖表,歡迎討論。

elk-voter-guide

Prerequirements :

y12docker/g0v-voter-guide Repository | Docker Hub Registry - Repositories of Docker Images

Notice : the download of y12docker/g0v-voter-guide is a very large file size (1~Gb).

Run a prebuild image with kibana http://docker_host:8080/

$ sudo docker pull y12docker/g0v-voter-guide:v141002
$ sudo docker run -p 8080:8080 -p 9200:9200 -d y12docker/g0v-voter-guide:v141002

councilor-voter-guide/utils/elk at elk · y12studio/councilor-voter-guide

Upgrade to Django 1.7

畢竟 Django 1.5 已經沒有官方支援了。隨便掃了一下好像沒什麼會衝突的地方,只要把 South 換掉(現在好像也沒有 migrations?)就可以了。

不過說真的沒測試不敢確定。好像應該先補寫測試才能開始做這個?

議員工程配合款原始 excel 議員名字錯誤

建立術語對照表

建立術語對照表,方便寫程式時可以參考

如選區在此專案的英文是 constituency
表格可能像是

選區 => constituency

議員選區-方格內容排版錯誤

症狀:超過三行就會把參選人數擠出方塊外
2014-11-19 1 55 27
然後這個顏色有點刺眼 可以改成其他顏色嗎?

ABC & #ABA (灰色系)

ABF & #ADA (藍綠)

AC4 & #4AC (藍綠)

AAC & #BAC (紫色系)

資料來源與關於頁面UI

這或許是比較末節的東西,但我覺得這裡或許可以弄好看一點

附上我目前想到的方法截圖,只是免則聲明我還是想不出更好的呈現方式...

Image1
Image2

Local 改用 SQLite

看來裝 PostgreSQL 對某些人可能會是問題,local 開發要不要直接用 SQLite 就好?docker 是很不錯,不過感覺又是引入了另外一層的複雜度。可以直接把弄好的 SQLite database 檔案放在 dropbox 上面讓大家下載。這部份 @thewayiam 有什麼 concern 嗎?

meeting_minutes binaries in the repo

The repo size alreay reached 1.2Gb. Is there any plan to purge some binaries?

$ git clone https://github.com/g0v/councilor-voter-guide

$ du -sh councilor-voter-guide
1.2G    councilor-voter-guide

$ du -mh councilor-voter-guide | sort -nr | head -n 20
616K    councilor-voter-guide/voter_guide/static/admin
603M    councilor-voter-guide/meeting_minutes
554M    councilor-voter-guide/meeting_minutes/tccc
544M    councilor-voter-guide/.git/objects/pack
544M    councilor-voter-guide/.git/objects
544M    councilor-voter-guide/.git
500K    councilor-voter-guide/crawler
376K    councilor-voter-guide/voter_guide/static/admin/js
316K    councilor-voter-guide/voter_guide/static/rest_framework
300K    councilor-voter-guide/voter_guide/static/css
244K    councilor-voter-guide/voter_guide/templates
236K    councilor-voter-guide/data/pretty_format/tncc
232K    councilor-voter-guide/data/pretty_format/tncc/tnccp
184K    councilor-voter-guide/crawler/kcc
176K    councilor-voter-guide/crawler/kcc/kcc

議員生日不唯一

台北市 http://www.tcc.gov.tw/iFrame.aspx?n=26921E80F6DC89B5
"卓榮泰";"1958-01-22"
"卓榮泰";"1959-01-22"
"張建邦";"1929-03-15"
"張建邦";"1929-01-15"
"張秋雄";"1937-08-11"
"張秋雄";"1936-08-11"
"盧林素妴";"1939-05-06"
"盧林素妴";"1937-05-06"
"蔣乃辛";"1947-06-24"
"蔣乃辛";"1948-09-24"
"陳嘉銘";"1949-05-02"
"陳嘉銘";"1962-05-02"
"黃義清";"1943-10-22"
"黃義清";"1943-10-12"
"黃金如";"1922-01-02"
"黃金如";"1932-01-02"

候選人列表UI問題

2014-11-19 2 13 22
當右邊沒有訊息時 會空一格在那裡
其實把兩個都拉長成span12 然後用上下的方式

tccc councilors.json utf-8 encoding problem

councilor-voter-guide/councilors.json at master · g0v/councilor-voter-guide

$ cd crawler/tccc
$ scrapy crawl councilors -o /tmp/test.json
$ head -n1 /tmp/test.json
...
 "contact_details": [{"type": "address", "value": "\u81fa\u4e2d\u5e02\u540e\u91cc\u5340\u540e\u91cc\u91cc

After tccc utf-8 json · 44b8438 · y12studio/councilor-voter-guide

$ scrapy crawl councilors -o /tmp/test.json
$ head -n1 /tmp/test.json
...
 "contact_details": [{"type": "address", "value": "臺中市豐原區圓環南路..

Why this UnicodeJsonItemExporter to be commented out from councilor-voter-guide/settings.py?

假如 crawler 必須開網頁點按鈕才可以繼續抓資料

地方議會議事錄檢索系統 (http://mcc.digital.tpa.gov.tw) 的 open-data 比較不 open ,要開網頁,點「進入系統」,才會使用一個 guest 帳號登入,之後才可下載 open-data 。

假如要 crawl 這些資料,我需要

sudo apt-get install xvfb
sudo pip install pyvirtualdisplay

配合 python-selenium 把視窗丟進虛擬畫面。線上系統可以支援這個嗎?

或者是否可以讓我 crawl 的時候,在線上系統開 FireFox 視窗?

圖表文字重疊

image

圓餅圖遇到極少值得時候容易發生文字重疊
能將裡頭的文字拉開或是另外重新排清單嗎?

安裝說明加上 Mac

剛剛完成在 Mac 上的安裝步驟,請問有計畫幫 Mac 加上環境安裝說明嗎?

議員為中途遞補的資訊

以台南北區為例:
http://councils.g0v.tw/candidates/2014/%E8%87%BA%E5%8D%97%E5%B8%82/11/

許至椿 是 2014-04-07 遞補成為議員的,因為前市議員黃郁文遭到判刑4年定讞

相關消息: http://www.chinatimes.com/realtimenews/20140407004418-260407

首屆台南市議會,議員出事率特別高,現任議員王錦德(民進黨)、蔡育輝(國民黨)、趙昆原(無黨籍)、許至椿(國民黨)等4人都是遞補就任,許至椿還是該選區的第2位遞補者(前兩任李宗富、黃郁文皆因賄選案去職),另前台南縣議長吳健保(無黨籍)因賭博案去職,因未被判褫奪公權,所以未有議員遞補。

嘉義縣議案格式錯誤

以下s請自行帶入 http://www.cyscc.gov.tw/chinese/Discussing_Detail.aspx?s=

參數s 問題
188 連署人跟案由一樣
198 連署人姓名分隔錯誤
209 類別跟案號一樣
210 類別跟案號一樣
213 類別為0
214 類別為0
215 類別為0
216 類別為0
217 類別為0
219 類別為0
221 類別為0
222 類別為0
236 連署人名稱有空白介入
292 類別跟案號一樣
322 提案人名稱錯誤(縣張花冠 -> 縣長張花冠)

聯絡電話:05-3620076

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.