Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated tools for bulk paper import

  • Loading branch information...
commit 96206e9fa365bbba81976e97a2d323ec4f22d528 1 parent 518e312
@rgaudin rgaudin authored
View
80 aggregate.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+source /home/reg/src/envs/pnlp/bin/activate
+
+
+# importer la base PNLP
+# supprimer Alerts: 11, 12, 01 ()
+# Supprimer:
+# - CIV: tous
+# - CV: tous
+# Bamako: tous
+# Mali: tous
+# lancer import excel
+# lancer agregate
+
+# 16/08
+date `python -c "import datetime; print datetime.datetime.now().strftime('0816%H%M2011')"`
+./manage.py pnlp_daily_tasks
+
+# 26/08
+date `python -c "import datetime; print datetime.datetime.now().strftime('0826%H%M2011')"`
+./manage.py pnlp_daily_tasks
+./manage.py pnlp_daily_tasks
+
+# 16/09
+date `python -c "import datetime; print datetime.datetime.now().strftime('0916%H%M2011')"`
+./manage.py pnlp_daily_tasks
+
+# 26/09
+date `python -c "import datetime; print datetime.datetime.now().strftime('0926%H%M2011')"`
+./manage.py pnlp_daily_tasks
+./manage.py pnlp_daily_tasks
+
+# 16/10
+date `python -c "import datetime; print datetime.datetime.now().strftime('1016%H%M2011')"`
+./manage.py pnlp_daily_tasks
+
+# 26/10
+date `python -c "import datetime; print datetime.datetime.now().strftime('1026%H%M2011')"`
+./manage.py pnlp_daily_tasks
+./manage.py pnlp_daily_tasks
+
+# 16/11
+date `python -c "import datetime; print datetime.datetime.now().strftime('1116%H%M2011')"`
+./manage.py pnlp_daily_tasks
+
+# 26/11
+date `python -c "import datetime; print datetime.datetime.now().strftime('1126%H%M2011')"`
+./manage.py pnlp_daily_tasks
+./manage.py pnlp_daily_tasks
+
+# 16/12
+date `python -c "import datetime; print datetime.datetime.now().strftime('1216%H%M2011')"`
+./manage.py pnlp_daily_tasks
+
+# 26/12
+date `python -c "import datetime; print datetime.datetime.now().strftime('1226%H%M2011')"`
+./manage.py pnlp_daily_tasks
+./manage.py pnlp_daily_tasks
+
+# 16/01
+date `python -c "import datetime; print datetime.datetime.now().strftime('0116%H%M2012')"`
+./manage.py pnlp_daily_tasks
+
+# 26/01
+date `python -c "import datetime; print datetime.datetime.now().strftime('0126%H%M2012')"`
+./manage.py pnlp_daily_tasks
+./manage.py pnlp_daily_tasks
+
+# 16/02
+date `python -c "import datetime; print datetime.datetime.now().strftime('0216%H%M2012')"`
+./manage.py pnlp_daily_tasks
+
+# 26/02
+date `python -c "import datetime; print datetime.datetime.now().strftime('0226%H%M2012')"`
+./manage.py pnlp_daily_tasks
+./manage.py pnlp_daily_tasks
+
+echo "FIN."
+ntpdate-debian
View
5 pnlp_core/validators.py
@@ -150,7 +150,7 @@ def test_value_under(fieldref, fieldtest, cats):
# NO PAST
period = MonthPeriod.find_create_from(year=self.get('year'), \
month=self.get('month'))
- if time_cscom_over(period):
+ if time_cscom_over(period) and not self.options.bulk_import:
self.errors.add(_(u"The reporting time frame for that " \
"period (%(period)s) is over.") \
% {'period': period}, 'period')
@@ -199,7 +199,8 @@ def test_value_under(fieldref, fieldtest, cats):
# User can create such report
if self.options.author:
if not provider_can('can_submit_report', \
- self.options.author, entity):
+ self.options.author, entity) \
+ and not self.options.bulk_import:
self.errors.add(_(u"You don't have permission to send " \
"a report for that " \
"location (%(loc)s).") \
View
23 tools/import_paper_reports.py
@@ -58,4 +58,25 @@ def import_all(src_folder):
print('skipping %s' % fname)
continue
submit_excel_file(os.path.join(src_folder, fname),
- author, success_dir, error_dir)
+ author, success_dir, error_dir)
+
+def cleanup_db():
+ from pnlp_core.models import MalariaReport, Alert
+
+ # CIV, VY (all)
+ MalariaReport.objects.filter(entity__parent__slug='bamako').delete()
+
+ # Bamako (all)
+ MalariaReport.objects.filter(entity__slug='bamako').delete()
+
+ # Mali (all)
+ MalariaReport.objects.filter(entity__slug='mali').delete()
+
+ # Alert CSCOM 11, 12, 01
+ Alert.objects.filter(alert_id__in=('112011', '122011', '012012')).delete()
+
+ # Alert District 11, 12, 01
+ Alert.objects.filter(alert_id__in=('district_112011', 'district_122011', 'district_012012')).delete()
+
+ # Alert District 11, 12, 01
+ Alert.objects.filter(alert_id__in=('region_112011', 'region_122011', 'region_012012')).delete()
Please sign in to comment.
Something went wrong with that request. Please try again.