Skip to content

Commit

Permalink
Merge branch 'demo'
Browse files Browse the repository at this point in the history
  • Loading branch information
jefmoura committed Feb 28, 2018
2 parents 3969864 + d1100ca commit 1fadc34
Show file tree
Hide file tree
Showing 29 changed files with 1,544 additions and 588 deletions.
15 changes: 0 additions & 15 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,6 @@ pipeline:
branch: [master, demo, staging]
status: [success]

trigger-deployment:
image: quay.io/ukhomeofficedigital/drone-trigger:latest
verbose: true
drone_server: http://drone.tola.io
drone_token: $DRONE_TOKEN
secrets: [DRONE_TOKEN]
repo: toladata/deployment
branch: master
deploy_to: marathon
params: "APP_ID=/tolaactivity,APP_GROUP=toladata,APP_NAME=TolaActivity,APP_BRANCH=${DRONE_COMMIT_BRANCH},APP_COMMIT=${DRONE_COMMIT_SHA},APP_TAG=${DRONE_TAG},APP_IMAGE=registry.tola.io/toladata/tolaactivity:${DRONE_COMMIT_SHA}"
when:
event: [push, tag]
branch: [master, demo, staging]
status: [success]

notify:
image: plugins/slack
channel: drone-ci
Expand Down
1 change: 1 addition & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ services:
- TOLA_ACTIVITY_URL=http://tolaactivity.dev.com
- TOLA_TRACK_URL=http://tolatrack.dev.com
- DEFAULT_ORG=TolaData
- DEFAULT_OAUTH_DOMAINS=toladata.com,humanitec.com
- CHARGEBEE_SIGNUP_ORG_URL=https://toladata-test.chargebee.com/hosted_pages/plans/monthly?addons[id][0]=user&addons[quantity][0]=1
- CHARGEBEE_SITE_API_KEY=test_31lcdE7L3grqdkGcvy24ik3lmlJrnA0Ez
- CHARGEBEE_SITE=toladata-test
Expand Down
20 changes: 20 additions & 0 deletions formlibrary/migrations/0007_customform_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-02-26 14:14
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('formlibrary', '0006_auto_20171206_0942'),
]

operations = [
migrations.AddField(
model_name='customform',
name='status',
field=models.CharField(blank=True, choices=[('new', 'New'), ('published', 'Published')], default='new', max_length=15, null=True),
),
]
9 changes: 9 additions & 0 deletions formlibrary/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,14 @@ class CustomFormFieldAdmin(admin.ModelAdmin):


class CustomForm(models.Model):
STATUS_NEW = 'new'
STATUS_PUBLISHED = 'published'

STATUS_CHOICES = (
(STATUS_NEW, 'New'),
(STATUS_PUBLISHED, 'Published'),
)

name = models.CharField(max_length=255, null=True, blank=True)
form_uuid = models.CharField(max_length=255, verbose_name='CustomForm UUID', default=uuid.uuid4, unique=True)
description = models.TextField(null=True, blank=True)
Expand All @@ -203,6 +211,7 @@ class CustomForm(models.Model):
organization = models.ForeignKey(Organization, default=1)
workflowlevel1 = models.ForeignKey(WorkflowLevel1, blank=True, null=True)
silo_id = models.IntegerField(default=0)
status = models.CharField(blank=True, null=True, max_length=15, default=STATUS_NEW, choices=STATUS_CHOICES)
create_date = models.DateTimeField(null=True, blank=True)
edit_date = models.DateTimeField(null=True, blank=True)
created_by = models.ForeignKey('auth.User', related_name='customforms', null=True, blank=True, on_delete=models.SET_NULL)
Expand Down
2 changes: 1 addition & 1 deletion formlibrary/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def setUp(self):
get_sector = Sector.objects.get(id='2')
new_agreement = WorkflowLevel2.objects.create(workflowlevel1=get_program, name="testproject",
office=get_office,
sector=get_sector, on_time=True, community_handover=False)
sector=get_sector)
new_agreement.save()
new_agreement.site.add(get_community)
get_agreement = WorkflowLevel2.objects.get(name="testproject")
Expand Down
423 changes: 423 additions & 0 deletions indicators/migrations/0005_auto_20180211_0410.py

Large diffs are not rendered by default.

109 changes: 55 additions & 54 deletions indicators/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class IndicatorTypeAdmin(admin.ModelAdmin):


class StrategicObjective(models.Model):
name = models.CharField(max_length=135, blank=True)
name = models.CharField(max_length=135, blank=True, help_text="Organizational objective to associate with inidicator")
country = models.ForeignKey(Country, null=True, blank=True)
description = models.TextField(max_length=765, blank=True)
create_date = models.DateTimeField(null=True, blank=True)
Expand Down Expand Up @@ -103,7 +103,7 @@ class StrategicObjectiveAdmin(admin.ModelAdmin):


class Objective(models.Model):
name = models.CharField(max_length=135, blank=True)
name = models.CharField(max_length=135, blank=True, help_text="Objective for workflowleve1 to associate with indicator")
workflowlevel1 = models.ForeignKey(WorkflowLevel1, null=True, blank=True)
description = models.TextField(max_length=765, blank=True)
create_date = models.DateTimeField(null=True, blank=True)
Expand Down Expand Up @@ -132,7 +132,7 @@ class ObjectiveAdmin(admin.ModelAdmin):


class Level(models.Model):
name = models.CharField(max_length=135, blank=True)
name = models.CharField(max_length=135, blank=True,help_text="Results framework or general indicator collection or label for level")
workflowlevel1 = models.ForeignKey(WorkflowLevel1, null=True, blank=True)
sort = models.IntegerField(default=0)
country = models.ForeignKey(Country, null=True, blank=True)
Expand All @@ -159,7 +159,7 @@ def save(self, *args, **kwargs):


class DisaggregationType(models.Model):
disaggregation_type = models.CharField(max_length=135, blank=True)
disaggregation_type = models.CharField(max_length=135, blank=True, help_text="Data disaggregation by age,gender,location etc.")
description = models.CharField(max_length=765, blank=True)
organization = models.ForeignKey(Organization, default=0)
standard = models.BooleanField(default=False, verbose_name="Standard")
Expand Down Expand Up @@ -267,7 +267,7 @@ class ReportingPeriodAdmin(admin.ModelAdmin):


class ExternalService(models.Model):
name = models.CharField(max_length=255, blank=True)
name = models.CharField(max_length=255, blank=True, help_text="External Indicator service for template of an Indicator instance")
service_url = models.CharField(max_length=765, blank=True)
feed_url = models.CharField(max_length=765, blank=True)
default_global = models.BooleanField(default=0)
Expand Down Expand Up @@ -320,45 +320,46 @@ def get_queryset(self):

from search.utils import ElasticsearchIndexer


class Indicator(models.Model):
indicator_uuid = models.CharField(max_length=255,verbose_name='Indicator UUID', default=uuid.uuid4, unique=True, blank=True)
indicator_type = models.ManyToManyField(IndicatorType, blank=True)
level = models.ForeignKey(Level, null=True, blank=True, on_delete=models.SET_NULL)
objectives = models.ManyToManyField(Objective, blank=True,verbose_name="Objective", related_name="obj_indicator")
strategic_objectives = models.ManyToManyField(StrategicObjective, verbose_name="Country Strategic Objective", blank=True, related_name="strat_indicator")
indicator_type = models.ManyToManyField(IndicatorType, blank=True, help_text="If indicator was pulled from a service select one here")
level = models.ForeignKey(Level, null=True, blank=True, on_delete=models.SET_NULL, help_text="The results framework level goal, objective etc. for this indicator")
objectives = models.ManyToManyField(Objective, blank=True,verbose_name="Objective", related_name="obj_indicator", help_text="Internal stated objective")
strategic_objectives = models.ManyToManyField(StrategicObjective, verbose_name="Country Strategic Objective", blank=True, related_name="strat_indicator", help_text="Organizational objectives")
name = models.CharField(max_length=255, null=False)
number = models.CharField(max_length=255, null=True, blank=True)
source = models.CharField(max_length=255, null=True, blank=True)
definition = models.TextField(null=True, blank=True)
justification = models.TextField(max_length=500, null=True, blank=True, verbose_name="Rationale or Justification for Indicator")
unit_of_measure = models.CharField(max_length=135, null=True, blank=True, verbose_name="Unit of Measure")
disaggregation = models.ManyToManyField(DisaggregationType, blank=True)
baseline = models.CharField(max_length=255, null=True, blank=True)
lop_target = models.DecimalField("LOP Target", max_digits=20, decimal_places=2, default=Decimal('0.00'), blank=True)
rationale_for_target = models.TextField(max_length=255, null=True, blank=True)
means_of_verification = models.CharField(max_length=255, null=True, blank=True, verbose_name="Means of Verification / Data Source")
data_collection_method = models.CharField(max_length=255, null=True, blank=True, verbose_name="Data Collection Method")
data_collection_frequency = models.ForeignKey(Frequency, related_name="data_collection_frequency",null=True, blank=True, verbose_name="Frequency of Data Collection")
data_points = models.TextField(max_length=500, null=True, blank=True, verbose_name="Data Points")
responsible_person = models.CharField(max_length=255, null=True, blank=True, verbose_name="Responsible Person(s) and Team")
method_of_analysis = models.CharField(max_length=255, null=True, blank=True, verbose_name="Method of Analysis")
information_use = models.CharField(max_length=255, null=True, blank=True, verbose_name="Information Use")
reporting_frequency = models.ForeignKey(Frequency, null=True, blank=True, verbose_name="Frequency of Reporting")
quality_assurance = models.TextField(max_length=500, null=True, blank=True, verbose_name="Quality Assurance Measures")
data_issues = models.TextField(max_length=500, null=True, blank=True, verbose_name="Data Issues")
indicator_changes = models.TextField(max_length=500, null=True, blank=True, verbose_name="Changes to Indicator")
comments = models.TextField(max_length=255, null=True, blank=True)
workflowlevel1 = models.ManyToManyField(WorkflowLevel1)
sector = models.ForeignKey(Sector, null=True, blank=True)
sub_sector = models.ManyToManyField(Sector, blank=True, related_name="indicator_sub_sector")
key_performance_indicator = models.BooleanField("Key Performance Indicator?",default=False)
approved_by = models.ForeignKey(TolaUser, blank=True, null=True, related_name="approving_indicator")
approval_submitted_by = models.ForeignKey(TolaUser, blank=True, null=True, related_name="indicator_submitted_by")
external_service_record = models.ForeignKey(ExternalServiceRecord, verbose_name="External Service ID", blank=True, null=True)
create_date = models.DateTimeField(null=True, blank=True)
edit_date = models.DateTimeField(null=True, blank=True)
number = models.CharField(max_length=255, null=True, blank=True, help_text="Internal organizational structure for relating to indicator and level")
source = models.CharField(max_length=255, null=True, blank=True, help_text="Origin of indicator")
definition = models.TextField(null=True, blank=True, help_text="Descriptive text for broader definiton and goal")
justification = models.TextField(max_length=500, null=True, blank=True, verbose_name="Rationale or Justification for Indicator", help_text="Rationale or Justification for Indicator")
unit_of_measure = models.CharField(max_length=135, null=True, blank=True, verbose_name="Unit of Measure", help_text="How will progress be measured")
disaggregation = models.ManyToManyField(DisaggregationType, blank=True, help_text="Predefined units to split total actauls")
baseline = models.CharField(max_length=255, null=True, blank=True, help_text="Initial set of data used for comparison or a control")
lop_target = models.DecimalField("LOP Target", max_digits=20, decimal_places=2, default=Decimal('0.00'), blank=True, help_text="Life of Program or Project goal for actual")
rationale_for_target = models.TextField(max_length=255, null=True, blank=True, help_text="Reasoning for why the target value was set")
means_of_verification = models.CharField(max_length=255, null=True, blank=True, verbose_name="Means of Verification / Data Source", help_text="Means of Verification / Data Source")
data_collection_method = models.CharField(max_length=255, null=True, blank=True, verbose_name="Data Collection Method", help_text="How was the data collected")
data_collection_frequency = models.ForeignKey(Frequency, related_name="data_collection_frequency",null=True, blank=True, verbose_name="Frequency of Data Collection", help_text="How often was the data collected")
data_points = models.TextField(max_length=500, null=True, blank=True, verbose_name="Data Points", help_text="")
responsible_person = models.CharField(max_length=255, null=True, blank=True, verbose_name="Responsible Person(s) and Team", help_text="Responsible Person(s) and Team")
method_of_analysis = models.CharField(max_length=255, null=True, blank=True, verbose_name="Method of Analysis", help_text="Method of Analysis")
information_use = models.CharField(max_length=255, null=True, blank=True, verbose_name="Information Use", help_text="Information Use")
reporting_frequency = models.ForeignKey(Frequency, null=True, blank=True, verbose_name="Frequency of Reporting", help_text="Frequency of Reporting")
quality_assurance = models.TextField(max_length=500, null=True, blank=True, verbose_name="Quality Assurance Measures", help_text="Quality Assurance Measures")
data_issues = models.TextField(max_length=500, null=True, blank=True, verbose_name="Data Issues", help_text="Problems with the data quality if any")
indicator_changes = models.TextField(max_length=500, null=True, blank=True, verbose_name="Changes to Indicator", help_text="How did the indicator change over time if at all")
comments = models.TextField(max_length=255, null=True, blank=True, help_text="")
workflowlevel1 = models.ManyToManyField(WorkflowLevel1, help_text="Related workflowlevel1 or project/program etc.")
sector = models.ForeignKey(Sector, null=True, blank=True, help_text="Primary related sector or type of work done")
sub_sector = models.ManyToManyField(Sector, blank=True, related_name="indicator_sub_sector", help_text="Additiona related sectors or type of work if any")
key_performance_indicator = models.BooleanField("Key Performance Indicator?",default=False, help_text="Yes/No is this a key measurement for the overall effort")
approved_by = models.ForeignKey(TolaUser, blank=True, null=True, related_name="approving_indicator", help_text="Who approved the indicator")
approval_submitted_by = models.ForeignKey(TolaUser, blank=True, null=True, related_name="indicator_submitted_by", help_text="Who requested approval of the indicator")
external_service_record = models.ForeignKey(ExternalServiceRecord, verbose_name="External Service ID", blank=True, null=True, help_text="What third party indicator service was this pulled from if any")
create_date = models.DateTimeField(null=True, blank=True, help_text="")
edit_date = models.DateTimeField(null=True, blank=True, help_text="")
history = HistoricalRecords()
notes = models.TextField(max_length=500, null=True, blank=True)
notes = models.TextField(max_length=500, null=True, blank=True, help_text="")
created_by = models.ForeignKey('auth.User', related_name='indicators', null=True, blank=True, on_delete=models.SET_NULL)
#optimize query for class based views etc.
objects = IndicatorManager()
Expand Down Expand Up @@ -454,24 +455,24 @@ def get_queryset(self):


class CollectedData(models.Model):
data_uuid = models.CharField(max_length=255,verbose_name='Data UUID', default=uuid.uuid4, unique=True, blank=True)
periodic_target = models.ForeignKey(PeriodicTarget, null=True, blank=True)
data_uuid = models.CharField(max_length=255,verbose_name='Data UUID', default=uuid.uuid4, unique=True, blank=True, help_text="")
periodic_target = models.ForeignKey(PeriodicTarget, null=True, blank=True, help_text="Relate this collection to a periodic target")
#targeted = models.DecimalField("Targeted", max_digits=20, decimal_places=2, default=Decimal('0.00'))
achieved = models.DecimalField("Achieved", max_digits=20, decimal_places=2, default=Decimal('0.00'))
disaggregation_value = models.ManyToManyField(DisaggregationValue, blank=True)
description = models.TextField("Remarks/comments", blank=True, null=True)
indicator = models.ForeignKey(Indicator)
workflowlevel2 = models.ForeignKey(WorkflowLevel2, blank=True, null=True, related_name="i_workflowlevel2", verbose_name="Project Initiation")
workflowlevel1 = models.ForeignKey(WorkflowLevel1, blank=True, null=True, related_name="i_workflowlevel1")
date_collected = models.DateTimeField(null=True, blank=True)
achieved = models.DecimalField("Achieved", max_digits=20, decimal_places=2, default=Decimal('0.00'), help_text="Actual or total for this record")
disaggregation_value = models.ManyToManyField(DisaggregationValue, blank=True, help_text="Values for each disaggregated field")
description = models.TextField("Remarks/comments", blank=True, null=True, help_text="How was this data collected")
indicator = models.ForeignKey(Indicator, help_text="Related indicator for this data")
workflowlevel2 = models.ForeignKey(WorkflowLevel2, blank=True, null=True, related_name="i_workflowlevel2", verbose_name="Project Initiation", help_text="Related workflowlevel1 for this data if no indicator")
workflowlevel1 = models.ForeignKey(WorkflowLevel1, blank=True, null=True, related_name="i_workflowlevel1", help_text="Related workflowlevel1 if no workflowlevel 2 for this data and no indicator")
date_collected = models.DateTimeField(null=True, blank=True, help_text="")
comment = models.TextField("Comment/Explanation", max_length=255, blank=True, null=True)
evidence = models.ForeignKey(Documentation, null=True, blank=True, verbose_name="Evidence Document or Link")
approved_by = models.ForeignKey(TolaUser, blank=True, null=True, verbose_name="Originated By", related_name="approving_data")
tola_table = models.ForeignKey(TolaTable, blank=True, null=True)
update_count_tola_table = models.BooleanField("Would you like to update the achieved total with the row count from TolaTables?",default=False)
evidence = models.ForeignKey(Documentation, null=True, blank=True, verbose_name="Evidence Document or Link", help_text="Evidence Document or Link")
approved_by = models.ForeignKey(TolaUser, blank=True, null=True, verbose_name="Approved By", related_name="approving_data", help_text="Who approved collection")
tola_table = models.ForeignKey(TolaTable, blank=True, null=True, help_text="If Track table was used link to it here")
update_count_tola_table = models.BooleanField("Would you like to update the achieved total with the row count from TolaTables?",default=False, help_text="Update the unique count from Table if linked when updated")
create_date = models.DateTimeField(null=True, blank=True)
edit_date = models.DateTimeField(null=True, blank=True)
site = models.ManyToManyField(SiteProfile, blank=True)
site = models.ManyToManyField(SiteProfile, blank=True, help_text="Geographic location for data source")
created_by = models.ForeignKey('auth.User', related_name='collecteddata', null=True, blank=True, on_delete=models.SET_NULL)
history = HistoricalRecords()
objects = CollectedDataManager()
Expand Down
23 changes: 23 additions & 0 deletions search/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#Search
###Configuration

###Updating the index
The search index automatically updates itself whenever an object is saved. In a freshly configured, clean environment
there is no need to manually update the search index.

If the search index was corrupted or the database is build upon an import of old data the index has to be manually
populated.

To do this first make sure that no index exists for the configured environment.

Check ElasticSearch that no index exists with the index prefix defined in ```$ELASTICSEARCH_INDEX_PREFIX```
Run ```GET /_cat/indices?v``` on the cluster to see existing indices. If the prefix is already in use check the
configuration of other instances for conflicting settings and, if safe,
delete the indices by running ```DELETE /prefix_*``` where prefix is the index prefix defined in the environment
variables.

Finally run
```
python manage.py search-index _all
```
on the container to recreate the index.
Loading

0 comments on commit 1fadc34

Please sign in to comment.