Coder Social home page Coder Social logo

coastatistics / aprp Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 5.0 24.21 MB

A dashboard visualize daily agriculture product price and volumn in Taiwan.

License: MIT License

Python 61.07% HTML 23.90% CSS 0.87% JavaScript 13.73% Dockerfile 0.07% Shell 0.11% Makefile 0.25%
agriculture celery django rest-framework taiwan visialization

aprp's People

Contributors

dependabot[bot] avatar matsuilin101 avatar stat-coa avatar swchen1282 avatar taiwang1209 avatar timy116 avatar travishen avatar wkhunag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aprp's Issues

業務單位資料須更新

品項 規格 日期 指標 業務單位
紅羽土雞 北區 2014/5/22 價格 40-41
紅羽土雞 北區 2014/5/23 價格 40-41
紅羽土雞 北區 2014/5/24 價格 40-41
紅羽土雞 北區 2014/5/25 價格 40-41
紅羽土雞 北區 2014/5/29 價格 41-42

DailyReport.update_cattles division by zero

web         |   File "/app/apps/dailytrans/reports/dailyreport.py", line 250, in report
web         |     self.update_cattles(item, item.row)
web         |   File "/app/apps/dailytrans/reports/dailyreport.py", line 218, in update_cattles
web         |     last_week_avg_price = sum(last_week_price) / len(last_week_price)
web         | ZeroDivisionError: division by zero

django-ckeditor assets not found(404) on server

behavior

  1. It should look for /static/ckeditor/ckeditor/config.js etc. but looked for wrong location:
GET http://host/config.js?t=H8DA net::ERR_ABORTED 404 (Not Found)
GET http://host/lang/zh.js?t=H8DA net::ERR_ABORTED 404 (Not Found)
GET http://host/skins/moono-lisa/editor.css?t=H8DA net::ERR_ABORTED 404 (Not Found)
  1. ckeditor assets worked in admin page

settings
STATIC_ROOT = os.path.join(BASE_DIR, "live-static-files", "static-root")
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

CKEDITOR_BASEPATH = "/static/ckeditor/ckeditor"

ref
django-ckeditor/django-ckeditor#192

RetrieveUpdateDeleteApiView put and delete request return 405

urlpatterns = [
    url(r'^event/$', EventListCreateAPIView.as_view(), name='api_event_cr'),
    url(r'^event/(?P<pk>\d+)/$', EventRetrieveUpdateDestroyAPIView.as_view(), name='api_event_rud'),
]

Request URL: http://host/events/api/event/1/
Request Method: PUT
Status Code: 405 Method Not Allowed
Remote Address: 125.227.27.200:80
Referrer Policy: no-referrer-when-downgrade
Allow: GET, HEAD, OPTIONS, TRACE
Content-Length: 1222
Content-Type: text/html
Date: Sun, 30 Sep 2018 12:29:11 GMT
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET

WhiteNoise not serving media files

settings:

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static')
]
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "live-static-files", "static-root")
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "live-static-files", "media-root")

ref:
evansd/whitenoise#32

@MatsuiLin101

顯示休市日期

需求
當產品休市時,目前是以無價量的方式顯示,未來希望特別顯示出當天為休市無交易

毛豬各市場規格豬規格不一

規格豬規格

  • 宜蘭縣、新竹縣、苗栗縣、花蓮縣: 115kg以上(因黑豬比例高偏重,155公斤以上納入規格豬)
  • 其他市場: 115~155kg

Example

2018/10/31為例

市場 交易量 含155公斤以上
新北市 2388 N
宜蘭縣 382 Y
桃園市 2032 N
新竹縣 701 Y
苗栗縣 599 Y
台中市 1843 N
大安區 1131 N
彰化縣 1552 N
南投縣 885 N
雲林縣 2072 N
嘉義市 690 N
嘉義縣 737 N
臺南安南 953 N
臺南市 493 N
高雄市 718 N
高雄岡山 984 N
高雄鳳山 1364 N
高雄旗山 323 N
屏東縣 1356 N
台東縣 195 N
花蓮縣 319 Y

Fix commit
5a8f9a7

白肉雞、紅羽土雞、雞蛋資料誤差

品項 規格 價格日期 價格 平台 差異
白肉雞 2014/2/3 46.33 45.83 0.5
白肉雞 2014/4/27 49.67 49.67
白肉雞 2014/10/8 50 50.5 -0.5
白肉雞 2014/10/24 49.67 49.17 0.5
白肉雞 2014/10/25 49.67 49.17 0.5
白肉雞 2015/4/30 49.67 49.67
白肉雞 2015/7/10 48.33 48 0.33
白肉雞 2015/9/4 48 48.33 -0.33
白肉雞 2016/3/16 48 48
白肉雞 2016/5/31 48 48
白肉雞 2016/8/7 46.33 46.33
白肉雞 2017/6/14 45 45
白肉雞 2018/4/14 51.33 51.33
白肉雞 2018/4/15 51.33 51.33
白肉雞 2018/8/31 45.5 45 0.5
紅羽土雞 北區 2014/4/27 70 70
紅羽土雞 北區 2014/5/3 68.33 70 -1.67
紅羽土雞 北區 2014/5/22 67.5 67.5
紅羽土雞 北區 2014/5/23 67.5 67.5
紅羽土雞 北區 2014/5/24 67.5 67.5
紅羽土雞 北區 2014/5/25 67.5 67.5
紅羽土雞 北區 2014/5/29 69.17 69.17
紅羽土雞 北區 2014/7/23 58.33 60 -1.67
紅羽土雞 北區 2014/12/23 88.33 90 -1.67
紅羽土雞 北區 2015/1/26 85 85
紅羽土雞 北區 2015/1/27 85 85
紅羽土雞 北區 2015/1/30 81.67 80 1.67
紅羽土雞 北區 2015/2/18 70 70
紅羽土雞 北區 2015/2/19 70 70
紅羽土雞 北區 2015/2/20 70 70
紅羽土雞 北區 2015/2/21 70 70
紅羽土雞 北區 2015/2/22 70 70
紅羽土雞 北區 2015/2/23 70 70
紅羽土雞 北區 2015/3/30 75 76.67 -1.67
紅羽土雞 北區 2015/4/23 75 73.33 1.67
紅羽土雞 北區 2015/4/30 71.67 71.67
紅羽土雞 北區 2015/7/22 83.33 85 -1.67
紅羽土雞 北區 2015/11/16 73.33 75 -1.67
紅羽土雞 北區 2015/11/23 80 81.67 -1.67
紅羽土雞 北區 2015/12/4 85 83.33 1.67
紅羽土雞 北區 2016/3/16 78.33 78.33
紅羽土雞 北區 2016/5/31 78.33 78.33
紅羽土雞 北區 2016/8/7 76.67 76.67
紅羽土雞 北區 2017/6/14 60 60
紅羽土雞 北區 2018/4/14 61.67 61.67
紅羽土雞 北區 2018/4/15 61.67 61.67
紅羽土雞 北區 2018/4/16 63.33 63.33
雞蛋 大運輸-3 2017/6/14 37.5 37.50
雞蛋 大運輸-3 2018/4/14 44.17 44.17
雞蛋 大運輸-3 2018/4/15 44.17 44.17

Usage of scriptLoader cause ReferenceError

behavior
Ajax template script loaded, JavaScript engine look at objects that not yet loaded by scriptLoader()

scripts = [
	// CKEditor Plugins
	"{% static 'ckeditor/ckeditor-init.js' %}",
	"{% static 'ckeditor/ckeditor/ckeditor.js' %}",
	// Masonry Plugins
	"{% static 'vendor/js/masonry.pkgd.js' %}",
	// SocialWall Plugins
	"{% static 'js/socialwall.js' %}",
]

var pagefunction = function() {
	// clears the variable if left blank
	socialWallHelper.init();
};

scriptLoader(scripts, pagefunction);

fix

var pagefunction = function() {
	if(window.socialWallHelper){
		socialWallHelper.init();
	}
};

@MatsuiLin101

平台畜禽價格與畜產會提供價格不同

平台漏抓資料

品項 規格 價格日期 價格 平台 差異
白肉雞   2016/8/7 46.33   46.33
白肉雞   2018/4/14 51.33   51.33
白肉雞   2018/4/15 51.33   51.33
紅羽土雞 北區 2018/4/14 61.67   61.67
紅羽土雞 北區 2018/4/15 61.67   61.67
紅羽土雞 北區 2018/4/16 63.33   63.33
雞蛋 大運輸-3 2018/4/14 44.17   44.17
雞蛋 大運輸-3 2018/4/15 44.17   44.17

平台資料錯誤

品項 規格 價格日期 價格 平台 差異
白肉雞   2014/10/8 50 50.5 -0.5

OpenData漏抓資料,等待OpenData重抓資料

品項 規格 價格日期 價格 平台 差異
白肉雞   2014/4/27 49.67   49.67
白肉雞   2015/4/30 49.67   49.67
白肉雞   2016/3/16 48   48
白肉雞   2016/5/31 48   48
白肉雞   2017/6/14 45   45
紅羽土雞 北區 2014/4/27 70   70
紅羽土雞 北區 2015/4/30 71.67   71.67
紅羽土雞 北區 2016/3/16 78.33   78.33
紅羽土雞 北區 2016/5/31 78.33   78.33
紅羽土雞 北區 2016/8/7 76.67   76.67
紅羽土雞 北區 2017/6/14 60   60
雞蛋 大運輸-3 2017/6/14 37.5   37.50

OpenData資料錯誤,等待OpenData重抓資料

品項 規格 價格日期 價格 平台 差異
紅羽土雞 北區 2015/4/23 75 73.33 1.67

等待畜產會確認價格

品項 規格 價格日期 價格 平台 差異
白肉雞   2014/2/3 46.33 45.83 0.5
白肉雞   2014/10/24 49.67 49.17 0.5
白肉雞   2014/10/25 49.67 49.17 0.5
白肉雞   2015/7/10 48.33 48 0.33
白肉雞   2015/9/4 48 48.33 -0.33
白肉雞   2018/8/31 45.5 45 0.5
紅羽土雞 北區 2014/5/3 68.33 70 -1.67
紅羽土雞 北區 2014/7/23 58.33 60 -1.67
紅羽土雞 北區 2014/12/23 88.33 90 -1.67
紅羽土雞 北區 2015/1/30 81.67 80 1.67
紅羽土雞 北區 2015/3/30 75 76.67 -1.67
紅羽土雞 北區 2015/7/22 83.33 85 -1.67
紅羽土雞 北區 2015/11/16 73.33 75 -1.67
紅羽土雞 北區 2015/11/23 80 81.67 -1.67
紅羽土雞 北區 2015/12/4 85 83.33 1.67

休市

品項 規格 價格日期 價格 平台 差異
紅羽土雞 北區 2015/1/26 85   85
紅羽土雞 北區 2015/1/27 85   85
紅羽土雞 北區 2015/2/18 70   70
紅羽土雞 北區 2015/2/19 70   70
紅羽土雞 北區 2015/2/20 70   70
紅羽土雞 北區 2015/2/21 70   70
紅羽土雞 北區 2015/2/22 70   70
紅羽土雞 北區 2015/2/23 70   70

價格以區間顯示,Ex:40-41

品項 規格 價格日期 價格 平台 差異
紅羽土雞 北區 2014/5/22 67.5   67.5
紅羽土雞 北區 2014/5/23 67.5   67.5
紅羽土雞 北區 2014/5/24 67.5   67.5
紅羽土雞 北區 2014/5/25 67.5   67.5
紅羽土雞 北區 2014/5/29 69.17   69.17

毛豬開放資料無法使用

原始資料出現以下情形:

平均價格 交易量 重量
0 0 88
2 0 0

這些資料在計算時必須汰除,但會造成細項加權得出的合計值有誤差

實際案例API連結

product: 其他豬
source: 雲林縣
avg_price: 0.0
volume: 88
avg_weight: 0.0
date: 2018-09-23

開放資料資須更新

品項 規格 日期 指標 業務單位 開放資料
白肉雞 2016/8/7 價格 46.33
白肉雞 2014/10/8 價格 50 50.5
白肉雞 2014/4/27 價格 49.67
白肉雞 2015/4/30 價格 49.67
白肉雞 2016/3/16 價格 48
白肉雞 2016/5/31 價格 48
白肉雞 2017/6/14 價格 45
紅羽土雞 北區 2014/4/27 價格 70
紅羽土雞 北區 2015/4/30 價格 71.67
紅羽土雞 北區 2016/3/16 價格 78.33
紅羽土雞 北區 2016/5/31 價格 78.33
紅羽土雞 北區 2016/8/7 價格 76.67
紅羽土雞 北區 2017/6/14 價格 60
雞蛋 大運輸-3 2017/6/14 價格 37.5
紅羽土雞 北區 2015/4/23 價格 75 73.33
紅羽土雞 北區 2015/12/4 價格 85 83.33
白肉雞 1.75-1.95Kg 2019/1/19 價格 41.3
紅羽土雞 北區 2019/1/19 價格 65.6
雞蛋 產地 2019/1/19 價格 60.8
土番鴨 75天 2019/1/19 價格 69.7

圖表設定

  • 歷年資訊年度排序逆排(由新到舊)
  • 歷年每日價量走勢歷年平均預設值為近五年

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.