filter by: created (yyyy-mm-dd)
similar json output with /reports/event/api
queryset: ReportAutoSummary.objects.filter(created='2016-04-01').order_by('-created')
return latest reports by time
model: jaksafe/ReportAutoSummary (similar to reports/event)
created: DateTimeField
village: FK to geolevels/village
rw: TextField (comma separated list of rw)
source: URLField
note: TextField
damage_infrastruktur: DecimalField(18.2 decimal) up to IDR 999 trillion
loss_infrastruktur: DecimalField(18.2 decimal)
damage_lintas_sektor: DecimalField(18.2 decimal)
loss_lintas_sektor: DecimalField(18.2 decimal)
damage_produktif: DecimalField(18.2 decimal)
loss_produktif: DecimalField(18.2 decimal)
damage_social_perumahan: DecimalField(18.2 decimal)
loss_social_perumahan: DecimalField(18.2 decimal)
damage_total: DecimalField(18.2 decimal)
loss_total: DecimalField(18.2 decimal)
map: /maps/report_auto_summary/
embeddable plain leaflet map
similar to http://smartcity.jakarta.go.id/maps/
layers:
today and past 6 days
to be embedded in jaksafe.bpbd.jakarta.go.id home page
API /jaksafe/report_auto_summary/api/
filter by: created (yyyy-mm-dd) similar json output with /reports/event/api queryset: ReportAutoSummary.objects.filter(created='2016-04-01').order_by('-created') return latest reports by time
model: jaksafe/ReportAutoSummary (similar to reports/event)
created: DateTimeField village: FK to geolevels/village rw: TextField (comma separated list of rw) source: URLField note: TextField damage_infrastruktur: DecimalField(18.2 decimal) up to IDR 999 trillion loss_infrastruktur: DecimalField(18.2 decimal) damage_lintas_sektor: DecimalField(18.2 decimal) loss_lintas_sektor: DecimalField(18.2 decimal) damage_produktif: DecimalField(18.2 decimal) loss_produktif: DecimalField(18.2 decimal) damage_social_perumahan: DecimalField(18.2 decimal) loss_social_perumahan: DecimalField(18.2 decimal) damage_total: DecimalField(18.2 decimal) loss_total: DecimalField(18.2 decimal)
map: /maps/report_auto_summary/
embeddable plain leaflet map similar to http://smartcity.jakarta.go.id/maps/ layers: today and past 6 days to be embedded in jaksafe.bpbd.jakarta.go.id home page
periodic retrieval from http://jaksafe.bpbd.jakarta.go.id/report/auto_report_json/yyyymmdd/all
using cron and django management command https://coderwall.com/p/k5p6ag/run-django-commands-using-cron https://ultimatedjango.com/blog/how-to-consume-rest-apis-with-django-python-reques/ populates ReportAutoSummary check first if entry with same created date exist http://stackoverflow.com/questions/639836/what-is-the-right-way-to-validate-if-an-object-exists-in-a-django-view-without-r 4x daily 01.00 for 23.59 yesterday 07.00 for 05.59.59 today 13.00 for 11.59.59 today 19.00 for 17.59.59 today