Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added report showing how often users are syncing

  • Loading branch information...
commit 7a18028945afbd262c0cf9603843b7ba18b2726e 1 parent e616620
@mikeymckay authored
Showing with 266 additions and 926 deletions.
  1. +2 −2 _attachments/app/app.coffee
  2. +1 −1  _attachments/app/app.js
  3. +1 −1  _attachments/app/models/GeoHierarchy.coffee
  4. +1 −1  _attachments/app/models/GeoHierarchy.js
  5. +35 −15 _attachments/app/models/Sync.coffee
  6. +43 −15 _attachments/app/models/Sync.js
  7. +3 −0  _attachments/app/models/User.coffee
  8. +4 −0 _attachments/app/models/User.js
  9. +0 −113 _attachments/app/models/WardHierarchy.coffee
  10. +0 −159 _attachments/app/models/WardHierarchy.js
  11. +1 −2  _attachments/app/views/MenuView.coffee
  12. +0 −2  _attachments/app/views/MenuView.js
  13. +1 −1  _attachments/app/views/MessagingView.coffee
  14. +1 −1  _attachments/app/views/MessagingView.js
  15. +88 −1 _attachments/app/views/ReportView.coffee
  16. +73 −1 _attachments/app/views/ReportView.js
  17. +6 −3 _attachments/app/views/UsersView.coffee
  18. +3 −6 _attachments/app/views/UsersView.js
  19. +0 −1  _attachments/index.html
  20. +0 −52 _docs/Case Notification.json
  21. +0 −174 _docs/Facility.json
  22. +0 −155 _docs/Household Members.json
  23. +0 −204 _docs/Household.json
  24. +0 −10 _docs/coconut.config.json
  25. +1 −1  _docs/version.json
  26. +2 −5 build_android_app/make.sh
View
4 _attachments/app/app.coffee
@@ -440,8 +440,8 @@ class Router extends Backbone.Router
$("[data-role=footer]").navbar()
$('#application-title').html Coconut.config.title()
- # Only start app after Ward/Facility data has been loaded
- classesToLoad = [FacilityHierarchy, WardHierarchy, GeoHierarchy]
+ # Only start app after Geo/Facility data has been loaded
+ classesToLoad = [FacilityHierarchy, GeoHierarchy]
startApplication = _.after classesToLoad.length, ->
Coconut.loginView = new LoginView()
View
2  _attachments/app/app.js
@@ -633,7 +633,7 @@ Router = (function(_super) {
}, document.addEventListener("offline", onOffline, false), document.addEventListener("online", onOnline, false), " <a href='#sync/send'>Send data (last success: <span class='sync-sent-status'></span>)</a> <a href='#sync/get'>Get data (last success: <span class='sync-get-status'></span>)</a> ")) + " &nbsp; <a id='manage-button' style='display:none' href='#manage'>Manage</a> &nbsp; <a href='#help'>Help</a> <span style='font-size:75%;display:inline-block'>Version<br/><span id='version'></span></span> <span style='font-size:75%;display:inline-block'><br/><span id='databaseStatus'></span></span> </center> ");
$("[data-role=footer]").navbar();
$('#application-title').html(Coconut.config.title());
- classesToLoad = [FacilityHierarchy, WardHierarchy, GeoHierarchy];
+ classesToLoad = [FacilityHierarchy, GeoHierarchy];
startApplication = _.after(classesToLoad.length, function() {
Coconut.loginView = new LoginView();
Coconut.questions = new QuestionCollection();
View
2  _attachments/app/models/GeoHierarchy.coffee
@@ -99,7 +99,6 @@ class GeoHierarchy extends Backbone.Model
# I think this is redundant-ish
GeoHierarchy.findAllDescendantsAtLevel = (name, sourceLevel, targetLevel) ->
- sourceNode = GeoHierarchy.find(name, sourceLevel)
getLevelDescendants = (node) ->
return node if node.level is targetLevel
@@ -107,6 +106,7 @@ class GeoHierarchy extends Backbone.Model
getLevelDescendants(childNode)
)
+ sourceNode = GeoHierarchy.find(name, sourceLevel)
_.flatten(getLevelDescendants sourceNode[0])
GeoHierarchy.findShehia = (targetShehia) ->
View
2  _attachments/app/models/GeoHierarchy.js
@@ -156,7 +156,6 @@ GeoHierarchy = (function(_super) {
GeoHierarchy.findAllDescendantsAtLevel = function(name, sourceLevel, targetLevel) {
var getLevelDescendants, sourceNode;
- sourceNode = GeoHierarchy.find(name, sourceLevel);
getLevelDescendants = function(node) {
var childNode;
@@ -175,6 +174,7 @@ GeoHierarchy = (function(_super) {
return _results;
})();
};
+ sourceNode = GeoHierarchy.find(name, sourceLevel);
return _.flatten(getLevelDescendants(sourceNode[0]));
};
View
50 _attachments/app/models/Sync.coffee
@@ -205,13 +205,13 @@ class Sync extends Backbone.Model
success: (result) =>
mostRecentNotification = result.rows?[0]?.doc.date || (new moment).subtract('months',3).format(Coconut.config.get("date_format"))
- url = "#{Coconut.config.cloud_url_with_credentials()}/_design/#{Coconut.config.design_doc_name()}/_view/notifications?&ascending=true&include_docs=true"
+ url = "#{Coconut.config.cloud_url_with_credentials()}/_design/#{Coconut.config.design_doc_name()}/_view/rawNotificationsNotConvertedToCaseNotifications?&ascending=true&include_docs=true"
url += "&startkey=\"#{mostRecentNotification}\"&skip=1" if mostRecentNotification?
district = User.currentUser.get("district")
shehias = GeoHierarchy.findAllShehiaNamesFor(district, "DISTRICT")
shehias = [] unless district
- @log "Looking for USSD notifications #{if mostRecentNotification? then "after #{mostRecentNotification}" else ""}. Please wait."
+ @log "Looking for USSD notifications without Case Notifications #{if mostRecentNotification? then "after #{mostRecentNotification}" else ""}. Please wait."
$.ajax
url: url
dataType: "jsonp"
@@ -222,20 +222,40 @@ class Sync extends Backbone.Model
if _.include(shehias, notification.shehia)
- result = new Result
- question: "Case Notification"
- MalariaCaseID: notification.caseid
- FacilityName: notification.hf
- Shehia: notification.shehia
- Name: notification.name
- result.save()
-
- notification.hasCaseNotification = true
- $.couch.db(Coconut.config.database_name()).saveDoc notification
- @log "Created new case notification #{result.get "MalariaCaseID"} for patient #{result.get "Name"} at #{result.get "FacilityName"}"
+ if confirm "Accept new case? Facility: #{notification.hf}, Shehia: #{notification.shehia}, Name: #{notification.name}, ID: #{notification.caseid}. You may need to coordinate with another DMSO."
+ result = new Result
+ question: "Case Notification"
+ MalariaCaseID: notification.caseid
+ FacilityName: notification.hf
+ Shehia: notification.shehia
+ Name: notification.name
+ result.save null,
+ error: (error) ->
+ @log "Could not save #{result.toJSON()}: #{JSON.stringify error}"
+ success: (error) =>
+ notification.hasCaseNotification = true
+ $.couch.db(Coconut.config.database_name()).saveDoc notification
+ @log "Created new case notification #{result.get "MalariaCaseID"} for patient #{result.get "Name"} at #{result.get "FacilityName"}"
+ doc_ids = [result.get("_id"), notification._id ]
+ # Sync results back to the
+ $.couch.replicate(
+ Coconut.config.database_name(),
+ Coconut.config.cloud_url_with_credentials(),
+ error: (error) =>
+ @log "Error replicating #{doc_ids} back to server: #{JSON.stringify error}"
+ success: (result) =>
+ @log "Sent docs: #{doc_ids}"
+ @save
+ last_send_result: result
+ last_send_error: false
+ last_send_time: new Date().getTime()
+ , doc_ids: doc_ids
+ )
+ else
+ @log "Case notification #{notification.caseid}, not accepted by #{User.currentUser.username()}"
options.success?()
- error: (result) =>
- @log "ERROR, could not download USSD notifications."
+ error: (error) =>
+ @log "ERROR, could not download USSD notifications: #{JSON.stringify error}"
replicate: (options) ->
$.couch.login
View
58 _attachments/app/models/Sync.js
@@ -319,7 +319,7 @@ Sync = (function(_super) {
var district, mostRecentNotification, shehias, url, _ref1, _ref2;
mostRecentNotification = ((_ref1 = result.rows) != null ? (_ref2 = _ref1[0]) != null ? _ref2.doc.date : void 0 : void 0) || (new moment).subtract('months', 3).format(Coconut.config.get("date_format"));
- url = "" + (Coconut.config.cloud_url_with_credentials()) + "/_design/" + (Coconut.config.design_doc_name()) + "/_view/notifications?&ascending=true&include_docs=true";
+ url = "" + (Coconut.config.cloud_url_with_credentials()) + "/_design/" + (Coconut.config.design_doc_name()) + "/_view/rawNotificationsNotConvertedToCaseNotifications?&ascending=true&include_docs=true";
if (mostRecentNotification != null) {
url += "&startkey=\"" + mostRecentNotification + "\"&skip=1";
}
@@ -328,7 +328,7 @@ Sync = (function(_super) {
if (!district) {
shehias = [];
}
- _this.log("Looking for USSD notifications " + (mostRecentNotification != null ? "after " + mostRecentNotification : "") + ". Please wait.");
+ _this.log("Looking for USSD notifications without Case Notifications " + (mostRecentNotification != null ? "after " + mostRecentNotification : "") + ". Please wait.");
return $.ajax({
url: url,
dataType: "jsonp",
@@ -339,23 +339,51 @@ Sync = (function(_super) {
notification = row.doc;
if (_.include(shehias, notification.shehia)) {
- result = new Result({
- question: "Case Notification",
- MalariaCaseID: notification.caseid,
- FacilityName: notification.hf,
- Shehia: notification.shehia,
- Name: notification.name
- });
- result.save();
- notification.hasCaseNotification = true;
- $.couch.db(Coconut.config.database_name()).saveDoc(notification);
- return _this.log("Created new case notification " + (result.get("MalariaCaseID")) + " for patient " + (result.get("Name")) + " at " + (result.get("FacilityName")));
+ if (confirm("Accept new case? Facility: " + notification.hf + ", Shehia: " + notification.shehia + ", Name: " + notification.name + ", ID: " + notification.caseid + ". You may need to coordinate with another DMSO.")) {
+ result = new Result({
+ question: "Case Notification",
+ MalariaCaseID: notification.caseid,
+ FacilityName: notification.hf,
+ Shehia: notification.shehia,
+ Name: notification.name
+ });
+ return result.save(null, {
+ error: function(error) {
+ return this.log("Could not save " + (result.toJSON()) + ": " + (JSON.stringify(error)));
+ },
+ success: function(error) {
+ var doc_ids;
+
+ notification.hasCaseNotification = true;
+ $.couch.db(Coconut.config.database_name()).saveDoc(notification);
+ _this.log("Created new case notification " + (result.get("MalariaCaseID")) + " for patient " + (result.get("Name")) + " at " + (result.get("FacilityName")));
+ doc_ids = [result.get("_id"), notification._id];
+ return $.couch.replicate(Coconut.config.database_name(), Coconut.config.cloud_url_with_credentials(), {
+ error: function(error) {
+ return _this.log("Error replicating " + doc_ids + " back to server: " + (JSON.stringify(error)));
+ },
+ success: function(result) {
+ _this.log("Sent docs: " + doc_ids);
+ return _this.save({
+ last_send_result: result,
+ last_send_error: false,
+ last_send_time: new Date().getTime()
+ });
+ }
+ }, {
+ doc_ids: doc_ids
+ });
+ }
+ });
+ } else {
+ return _this.log("Case notification " + notification.caseid + ", not accepted by " + (User.currentUser.username()));
+ }
}
});
return typeof options.success === "function" ? options.success() : void 0;
},
- error: function(result) {
- return _this.log("ERROR, could not download USSD notifications.");
+ error: function(error) {
+ return _this.log("ERROR, could not download USSD notifications: " + (JSON.stringify(error)));
}
});
}
View
3  _attachments/app/models/User.coffee
@@ -4,6 +4,9 @@ class User extends Backbone.Model
username: ->
@get("_id").replace(/^user\./,"")
+ district: ->
+ @get("district")
+
passwordIsValid: (password) ->
@get("password") is password
View
4 _attachments/app/models/User.js
@@ -17,6 +17,10 @@ User = (function(_super) {
return this.get("_id").replace(/^user\./, "");
};
+ User.prototype.district = function() {
+ return this.get("district");
+ };
+
User.prototype.passwordIsValid = function(password) {
return this.get("password") === password;
};
View
113 _attachments/app/models/WardHierarchy.coffee
@@ -1,113 +0,0 @@
-# This is kind of strange
-# We initialize this, then fetch it, then set the hierarchy property to the hierarchy attribute
-# This was a quick fix - a bit of code debt probably
-###
-wardHierarchy = new WardHierarchy()
-wardHierarchy.fetch
- success: ->
- WardHierarchy.hierarchy = wardHierarchy.get("hierarchy")
- Backbone.history.start()
- error: (error) ->
- console.error "Error loading Ward Hierarchy: #{error}"
-###
-#
-class WardHierarchy extends Backbone.Model
- initialize: ->
- @set
- _id: "Ward Hierarchy"
-
- url: "/wardHierarchy"
-
-# ward_shehia_breakdown_by_constituan_district_region
-
-# "REGION": {
-# "DISTRICT": {
-# "CONSTITUAN": [
-# "WARD/ Shehia"
-# ]
-# }
-# },
-#
-#
-
- WardHierarchy.load = (options) ->
- wardHierarchy = new WardHierarchy()
- wardHierarchy.fetch
- success: ->
- WardHierarchy.hierarchy = wardHierarchy.get("hierarchy")
- options.success()
- error: (error) ->
- console.error "Error loading Ward Hierarchy: #{error}"
- options.error(error)
-
- WardHierarchy.byWard = (targetWard) ->
- result = {}
- _.each WardHierarchy.hierarchy, (districts,region) ->
- _.each districts, (constituans,district) ->
- _.each constituans, (wards,constituan) ->
- _.each wards, (ward) ->
- if ward is targetWard
- result = {
- region: region
- district: district
- constituan: constituan
- }
- return result
-
- WardHierarchy.region = (ward) ->
- return unless ward?
- WardHierarchy.byWard(ward.toUpperCase()).region
-
- WardHierarchy.district = (ward) ->
- return unless ward?
- WardHierarchy.byWard(ward.toUpperCase()).district
-
- WardHierarchy.constituan = (ward) ->
- return unless ward?
- WardHierarchy.byWard(ward.toUpperCase()).constituan
-
- WardHierarchy.ward = (ward) ->
- ward
-
- WardHierarchy.shehia = (shehia) ->
- shehia
-
- WardHierarchy.allRegions = ->
- _.sortBy(_.keys(WardHierarchy.hierarchy), (region) -> region)
-
- WardHierarchy.allDistricts = ->
- _.chain(
- _.map WardHierarchy.hierarchy, (districts,region) ->
- _.keys districts
- )
- .flatten()
- .sortBy((district) -> district)
- .value()
-
- WardHierarchy.allConstituans = ->
- _.chain(
- _.map WardHierarchy.hierarchy, (districts,region) ->
- _.map districts, (constituans,district) ->
- _.keys constituans
- )
- .flatten()
- .sortBy((constituan) -> constituan)
- .value()
-
- WardHierarchy.allWards = (options = {}) ->
- _.chain(
- _.map WardHierarchy.hierarchy, (districts,region) ->
- if options.region
- return unless region is options.region
- _.map districts, (constituans,district) ->
- if options.district
- return unless district is options.district
- _.map constituans, (wards,constituan) ->
- if options.constituan
- return unless constituan is options.constituan
- wards
- )
- .flatten()
- .compact()
- .sortBy((ward) -> ward)
- .value()
View
159 _attachments/app/models/WardHierarchy.js
@@ -1,159 +0,0 @@
-// Generated by CoffeeScript 1.6.2
-/*
-wardHierarchy = new WardHierarchy()
-wardHierarchy.fetch
- success: ->
- WardHierarchy.hierarchy = wardHierarchy.get("hierarchy")
- Backbone.history.start()
- error: (error) ->
- console.error "Error loading Ward Hierarchy: #{error}"
-*/
-
-var WardHierarchy, _ref,
- __hasProp = {}.hasOwnProperty,
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
-
-WardHierarchy = (function(_super) {
- __extends(WardHierarchy, _super);
-
- function WardHierarchy() {
- _ref = WardHierarchy.__super__.constructor.apply(this, arguments);
- return _ref;
- }
-
- WardHierarchy.prototype.initialize = function() {
- return this.set({
- _id: "Ward Hierarchy"
- });
- };
-
- WardHierarchy.prototype.url = "/wardHierarchy";
-
- WardHierarchy.load = function(options) {
- var wardHierarchy;
-
- wardHierarchy = new WardHierarchy();
- return wardHierarchy.fetch({
- success: function() {
- WardHierarchy.hierarchy = wardHierarchy.get("hierarchy");
- return options.success();
- },
- error: function(error) {
- console.error("Error loading Ward Hierarchy: " + error);
- return options.error(error);
- }
- });
- };
-
- WardHierarchy.byWard = function(targetWard) {
- var result;
-
- result = {};
- _.each(WardHierarchy.hierarchy, function(districts, region) {
- return _.each(districts, function(constituans, district) {
- return _.each(constituans, function(wards, constituan) {
- return _.each(wards, function(ward) {
- if (ward === targetWard) {
- return result = {
- region: region,
- district: district,
- constituan: constituan
- };
- }
- });
- });
- });
- });
- return result;
- };
-
- WardHierarchy.region = function(ward) {
- if (ward == null) {
- return;
- }
- return WardHierarchy.byWard(ward.toUpperCase()).region;
- };
-
- WardHierarchy.district = function(ward) {
- if (ward == null) {
- return;
- }
- return WardHierarchy.byWard(ward.toUpperCase()).district;
- };
-
- WardHierarchy.constituan = function(ward) {
- if (ward == null) {
- return;
- }
- return WardHierarchy.byWard(ward.toUpperCase()).constituan;
- };
-
- WardHierarchy.ward = function(ward) {
- return ward;
- };
-
- WardHierarchy.shehia = function(shehia) {
- return shehia;
- };
-
- WardHierarchy.allRegions = function() {
- return _.sortBy(_.keys(WardHierarchy.hierarchy), function(region) {
- return region;
- });
- };
-
- WardHierarchy.allDistricts = function() {
- return _.chain(_.map(WardHierarchy.hierarchy, function(districts, region) {
- return _.keys(districts);
- })).flatten().sortBy(function(district) {
- return district;
- }).value();
- };
-
- WardHierarchy.allConstituans = function() {
- return _.chain(_.map(WardHierarchy.hierarchy, function(districts, region) {
- return _.map(districts, function(constituans, district) {
- return _.keys(constituans);
- });
- })).flatten().sortBy(function(constituan) {
- return constituan;
- }).value();
- };
-
- WardHierarchy.allWards = function(options) {
- if (options == null) {
- options = {};
- }
- return _.chain(_.map(WardHierarchy.hierarchy, function(districts, region) {
- if (options.region) {
- if (region !== options.region) {
- return;
- }
- }
- return _.map(districts, function(constituans, district) {
- if (options.district) {
- if (district !== options.district) {
- return;
- }
- }
- return _.map(constituans, function(wards, constituan) {
- if (options.constituan) {
- if (constituan !== options.constituan) {
- return;
- }
- }
- return wards;
- });
- });
- })).flatten().compact().sortBy(function(ward) {
- return ward;
- }).value();
- };
-
- return WardHierarchy;
-
-})(Backbone.Model);
-
-/*
-//@ sourceMappingURL=WardHierarchy.map
-*/
View
3  _attachments/app/views/MenuView.coffee
@@ -56,13 +56,12 @@ class MenuView extends Backbone.View
dataType: 'json'
success: (response) =>
# This doesn't seem to work on Kindle - always get []. Works fine if I hit kindle from chrome on laptop. Go fig.
- console.log JSON.stringify(response)
+ #console.log JSON.stringify(response)
progress = response?[0]?.progress
if progress
$("#databaseStatus").html "#{progress}% Complete"
_.delay @checkReplicationStatus,1000
else
- console.log "No database status update"
$("#databaseStatus").html ""
_.delay @checkReplicationStatus,60000
error: (error) =>
View
2  _attachments/app/views/MenuView.js
@@ -81,13 +81,11 @@ MenuView = (function(_super) {
success: function(response) {
var progress, _ref1;
- console.log(JSON.stringify(response));
progress = response != null ? (_ref1 = response[0]) != null ? _ref1.progress : void 0 : void 0;
if (progress) {
$("#databaseStatus").html("" + progress + "% Complete");
return _.delay(_this.checkReplicationStatus, 1000);
} else {
- console.log("No database status update");
$("#databaseStatus").html("");
return _.delay(_this.checkReplicationStatus, 60000);
}
View
2  _attachments/app/views/MessagingView.coffee
@@ -47,7 +47,7 @@ class MessagingView extends Backbone.View
$("#to").html @phoneNumbers.join(", ")
render: =>
- fields = "_id,district,name,comments".split(",")
+ fields = "_id,district,name,inactive".split(",")
messageFields = "date,to,text".split(",")
@$el.html "
<h2>Send Message</h2>
View
2  _attachments/app/views/MessagingView.js
@@ -81,7 +81,7 @@ MessagingView = (function(_super) {
var fields, messageFields,
_this = this;
- fields = "_id,district,name,comments".split(",");
+ fields = "_id,district,name,inactive".split(",");
messageFields = "date,to,text".split(",");
this.$el.html(" <h2>Send Message</h2> <h3>Select Recipients</h2> <table class='recipients'> <thead> <th></th> " + (_.map(fields, function(field) {
return "<th>" + (field === "_id" ? "Phone Number" : field.humanize()) + "</th>";
View
89 _attachments/app/views/ReportView.coffee
@@ -188,7 +188,7 @@ USSD}
form: "
<select data-role='selector' id='report-type'>
#{
- _.map(["dashboard","locations","spreadsheet","summarytables","analysis","alerts", "weeklySummary","periodSummary","incidenceGraph","systemErrors","casesNotFollowedUp","casesWithUnknownDistricts"], (type) =>
+ _.map(["dashboard","locations","spreadsheet","summarytables","analysis","alerts", "weeklySummary","periodSummary","incidenceGraph","systemErrors","casesNotFollowedUp","casesWithUnknownDistricts","tabletSync"], (type) =>
"<option #{"selected='true'" if type is @reportType}>#{type}</option>"
).join("")
}
@@ -1614,3 +1614,90 @@ USSD}
</table>
"
afterFinished()
+
+
+ tabletSync: (options) =>
+ startDate = moment(@startDate)
+ endDate = moment(@endDate)
+ $.couch.db(Coconut.config.database_name()).view "#{Coconut.config.design_doc_name()}/syncLogByDate",
+ startkey: @startDate
+ endkey: @endDate
+ include_docs: false
+ success: (syncLogResult) =>
+
+ users = new UserCollection()
+ users.fetch
+ error: (error) -> console.error "Couldn't fetch UserCollection"
+ success: =>
+
+ numberOfDays = endDate.diff(startDate, 'days')
+
+ # call this from user list perspective and sync list perspective in case they don't match
+ initializeEntryForUser = (user) =>
+ numberOfSyncsPerDayByUser[user] = {}
+ _(numberOfDays).times( (dayNumber) =>
+ numberOfSyncsPerDayByUser[user][moment(@startDate).add(dayNumber,"days").format("YYYY-MM-DD")] = 0
+ )
+
+ numberOfSyncsPerDayByUser = {}
+ _(users.models).each (user) =>
+ console.log user.get("name") if user.district()? and not (user.inactive is "true" or user.inactive)
+ console.log user if user.district()? and not (user.inactive is "true" or user.inactive)
+ initializeEntryForUser(user.get("_id")) if user.district()? and not (user.get("inactive") is "true" or user.get("inactive"))
+
+ _(syncLogResult.rows).each (syncEntry) =>
+ unless numberOfSyncsPerDayByUser[syncEntry.value]?
+ initializeEntryForUser(syncEntry.value)
+ numberOfSyncsPerDayByUser[syncEntry.value][moment(syncEntry.key).format("YYYY-MM-DD")] += 1
+
+ console.table numberOfSyncsPerDayByUser
+
+ $("#reportContents").html "
+ <br/>
+ <br/>
+ Number of Syncs Performed by User<br/>
+ <br/>
+ <table id='syncLogTable'>
+ <thead>
+ <th>District</th>
+ <th>Name</th>
+ #{
+ _(numberOfDays).times( (dayNumber) =>
+ "<th>#{moment(@startDate).add(dayNumber, "days").format("YYYY-MM-DD")}</th>"
+ ).join("")
+ }
+ </thead>
+ <tbody>
+ #{
+ _(numberOfSyncsPerDayByUser).map( (data,user) ->
+ if not users.get(user)?
+ console.error "Could not find user: #{user}"
+ return
+ "
+ <tr>
+ <td>#{users.get(user).district()}</td>
+ <td>#{users.get(user).get("name")}</td>
+ #{
+ _(numberOfSyncsPerDayByUser[user]).map( (value, day) ->
+ color =
+ if value is 0
+ "#FFCCFF"
+ else if value <= 5
+ "#CCFFCC"
+ else
+ "#8AFF8A"
+ "<td style='text-align:center; background-color: #{color}'>#{value}</td>"
+ ).join("")
+ }
+ </tr>
+ "
+ ).join("")
+ }
+ </tbody>
+ </table>
+ "
+
+ $("#syncLogTable").dataTable
+ aaSorting: [[0,"asc"]]
+ iDisplayLength: 50
+
View
74 _attachments/app/views/ReportView.js
@@ -8,6 +8,7 @@ ReportView = (function(_super) {
__extends(ReportView, _super);
function ReportView() {
+ this.tabletSync = __bind(this.tabletSync, this);
this.casesWithUnknownDistricts = __bind(this.casesWithUnknownDistricts, this);
this.casesNotFollowedUp = __bind(this.casesNotFollowedUp, this);
this.systemErrors = __bind(this.systemErrors, this);
@@ -194,7 +195,7 @@ ReportView = (function(_super) {
$("#reportOptions").append(this.formFilterTemplate({
id: "report-type",
label: "Report Type",
- form: " <select data-role='selector' id='report-type'> " + (_.map(["dashboard", "locations", "spreadsheet", "summarytables", "analysis", "alerts", "weeklySummary", "periodSummary", "incidenceGraph", "systemErrors", "casesNotFollowedUp", "casesWithUnknownDistricts"], function(type) {
+ form: " <select data-role='selector' id='report-type'> " + (_.map(["dashboard", "locations", "spreadsheet", "summarytables", "analysis", "alerts", "weeklySummary", "periodSummary", "incidenceGraph", "systemErrors", "casesNotFollowedUp", "casesWithUnknownDistricts", "tabletSync"], function(type) {
return "<option " + (type === _this.reportType ? "selected='true'" : void 0) + ">" + type + "</option>";
}).join("")) + " </select> "
}));
@@ -1216,6 +1217,77 @@ ReportView = (function(_super) {
});
};
+ ReportView.prototype.tabletSync = function(options) {
+ var endDate, startDate,
+ _this = this;
+
+ startDate = moment(this.startDate);
+ endDate = moment(this.endDate);
+ return $.couch.db(Coconut.config.database_name()).view("" + (Coconut.config.design_doc_name()) + "/syncLogByDate", {
+ startkey: this.startDate,
+ endkey: this.endDate,
+ include_docs: false,
+ success: function(syncLogResult) {
+ var users;
+
+ users = new UserCollection();
+ return users.fetch({
+ error: function(error) {
+ return console.error("Couldn't fetch UserCollection");
+ },
+ success: function() {
+ var initializeEntryForUser, numberOfDays, numberOfSyncsPerDayByUser;
+
+ numberOfDays = endDate.diff(startDate, 'days');
+ initializeEntryForUser = function(user) {
+ numberOfSyncsPerDayByUser[user] = {};
+ return _(numberOfDays).times(function(dayNumber) {
+ return numberOfSyncsPerDayByUser[user][moment(_this.startDate).add(dayNumber, "days").format("YYYY-MM-DD")] = 0;
+ });
+ };
+ numberOfSyncsPerDayByUser = {};
+ _(users.models).each(function(user) {
+ if ((user.district() != null) && !(user.inactive === "true" || user.inactive)) {
+ console.log(user.get("name"));
+ }
+ if ((user.district() != null) && !(user.inactive === "true" || user.inactive)) {
+ console.log(user);
+ }
+ if ((user.district() != null) && !(user.get("inactive") === "true" || user.get("inactive"))) {
+ return initializeEntryForUser(user.get("_id"));
+ }
+ });
+ _(syncLogResult.rows).each(function(syncEntry) {
+ if (numberOfSyncsPerDayByUser[syncEntry.value] == null) {
+ initializeEntryForUser(syncEntry.value);
+ }
+ return numberOfSyncsPerDayByUser[syncEntry.value][moment(syncEntry.key).format("YYYY-MM-DD")] += 1;
+ });
+ console.table(numberOfSyncsPerDayByUser);
+ $("#reportContents").html(" <br/> <br/> Number of Syncs Performed by User<br/> <br/> <table id='syncLogTable'> <thead> <th>District</th> <th>Name</th> " + (_(numberOfDays).times(function(dayNumber) {
+ return "<th>" + (moment(_this.startDate).add(dayNumber, "days").format("YYYY-MM-DD")) + "</th>";
+ }).join("")) + " </thead> <tbody> " + (_(numberOfSyncsPerDayByUser).map(function(data, user) {
+ if (users.get(user) == null) {
+ console.error("Could not find user: " + user);
+ return;
+ }
+ return " <tr> <td>" + (users.get(user).district()) + "</td> <td>" + (users.get(user).get("name")) + "</td> " + (_(numberOfSyncsPerDayByUser[user]).map(function(value, day) {
+ var color;
+
+ color = value === 0 ? "#FFCCFF" : value <= 5 ? "#CCFFCC" : "#8AFF8A";
+ return "<td style='text-align:center; background-color: " + color + "'>" + value + "</td>";
+ }).join("")) + " </tr> ";
+ }).join("")) + " </tbody> </table> ");
+ return $("#syncLogTable").dataTable({
+ aaSorting: [[0, "asc"]],
+ iDisplayLength: 50
+ });
+ }
+ });
+ }
+ });
+ };
+
return ReportView;
})(Backbone.View);
View
9 _attachments/app/views/UsersView.coffee
@@ -62,12 +62,14 @@ class UsersView extends Backbone.View
<table>
<thead>
+ <tr>
#{
fields.push "inactive"
_.map( fields, (field) ->
"<th>#{if field is "_id" then "Username" else field.humanize()}</th>"
).join("")
}
+ </tr>
</thead>
<tbody>
</tbody>
@@ -94,6 +96,7 @@ class UsersView extends Backbone.View
"
$("a").button()
- $('table').addTableFilter
- labelText: null
- $("input[type=search]").textinput()
+ #$('table').addTableFilter
+ # labelText: null
+ #$("input[type=search]").textinput()
+ $('table').dataTable()
View
9 _attachments/app/views/UsersView.js
@@ -85,9 +85,9 @@ UsersView = (function(_super) {
fields = "_id,password,district,name,comments".split(",");
this.$el.html(" <h2>Create/edit users</h2> <h3>Use phone number for username to enable SMS messages</h3> <form id='user'> " + (_.map(fields, function(field) {
return " <label style='display:block' for='" + field + "'>" + (field === "_id" ? "Username" : field.humanize()) + "</label> <input id='" + field + "' name='" + field + "' type='text'></input> ";
- }).join("")) + " <label style='display:block' for='inactive'>Inactive</label> <input id='inactive' name='inactive' type='checkbox'></input> <input type='submit'></input> </form> <h2>Click username to edit</h2> <table> <thead> " + (fields.push("inactive"), _.map(fields, function(field) {
+ }).join("")) + " <label style='display:block' for='inactive'>Inactive</label> <input id='inactive' name='inactive' type='checkbox'></input> <input type='submit'></input> </form> <h2>Click username to edit</h2> <table> <thead> <tr> " + (fields.push("inactive"), _.map(fields, function(field) {
return "<th>" + (field === "_id" ? "Username" : field.humanize()) + "</th>";
- }).join("")) + " </thead> <tbody> </tbody> </table> ");
+ }).join("")) + " </tr> </thead> <tbody> </tbody> </table> ");
this.userCollection.fetch({
success: function() {
_this.userCollection.sortBy(function(user) {
@@ -107,10 +107,7 @@ UsersView = (function(_super) {
return $("a").button();
}
});
- $('table').addTableFilter({
- labelText: null
- });
- return $("input[type=search]").textinput();
+ return $('table').dataTable();
};
return UsersView;
View
1  _attachments/index.html
@@ -99,7 +99,6 @@
<script type='text/javascript' src='app/models/Sync.js'></script>
<script type='text/javascript' src='app/models/User.js'></script>
<script type='text/javascript' src='app/models/UserCollection.js'></script>
-<script type='text/javascript' src='app/models/WardHierarchy.js'></script>
<script type='text/javascript' src='app/views/CaseView.js'></script>
<script type='text/javascript' src='app/views/CleanView.js'></script>
<script type='text/javascript' src='app/views/CsvView.js'></script>
View
52 _docs/Case Notification.json
@@ -1,52 +0,0 @@
-{
- "isApplicationDoc": true,
- "collection": "question",
- "questions": [
- {
- "id": "81",
- "repeatable": "false",
- "label": "Facility Name",
- "type": "autocomplete from code",
- "autocomplete-options": "window.FacilityOptions = FacilityHierarchy.allFacilities()",
- "repeatable": "false",
- "_id": "81",
- "validation" : "return 'Facility Name is not valid' unless _.contains(window.FacilityOptions, value)"
-
- },
- {
- "id": "311",
- "repeatable": "false",
- "type": "text",
- "label": "Malaria Case ID",
- "_id": "311"
- },
- {
- "id": "211",
- "repeatable": "false",
- "label": "Shehia",
- "type": "autocomplete from code",
- "autocomplete-options": "window.ShehiaOptions = WardHierarchy.allWards()",
- "_id": "211"
- },
- {
- "id": "221",
- "repeatable": "false",
- "type": "text",
- "label": "Name",
- "_id": "221"
- },
- {
- "id": "341",
- "_id": "341",
- "label": "complete",
- "type": "checkbox",
- "repeatable": "false"
- }
- ],
- "id": "Case Notification",
- "resultSummaryFields": {
- "Malaria Case ID": "on",
- "Facility Name": "on"
- },
- "_id": "Case Notification"
-}
View
174 _docs/Facility.json
@@ -1,174 +0,0 @@
-{
- "isApplicationDoc": true,
- "id": "Facility",
- "resultSummaryFields": {
- "Facility Name": "on",
- "Shehia": "on",
- "Malaria Case ID": "on",
- "Head of Household Name": "on"
- },
- "collection": "question",
- "_id": "Facility",
- "questions": [
- {
- "label": "Facility Name",
- "id": "81",
- "type": "autocomplete from code",
- "autocomplete-options": "window.FacilityOptions = FacilityHierarchy.allFacilities()",
- "repeatable": "false",
- "_id": "81",
- "validation" : "return 'Facility Name is not valid' unless _.contains(window.FacilityOptions, value)"
- },
- {
- "label": "Malaria Case ID",
- "id": "311",
- "type": "text",
- "repeatable": "false",
- "_id": "311"
- },
- {
- "label": "Date of Positive Results",
- "id": "558",
- "type": "date",
- "repeatable": "false",
- "_id": "558"
- },
- {
- "label": "Parasite Species",
- "id": "632",
- "type": "radio",
- "repeatable": "false",
- "_id": "632",
- "radio-options": "PF,NF,Unknown,Not Applicable"
- },
- {
- "label": "Reference # in OPD Register",
- "id": "202",
- "type": "number",
- "repeatable": "false",
- "_id": "202"
- },
- {
- "label": "First Name",
- "id": "623",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "623"
- },
- {
- "label": "Middle Name",
- "id": "366",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "required": "false",
- "_id": "366"
- },
- {
- "label": "Last Name",
- "id": "310",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "310"
- },
- {
- "label": "Age",
- "id": "46",
- "type": "number",
- "repeatable": "false",
- "validation": "return 'Age must be between 0 and 200' if value < 0 or value > 200",
- "_id": "46"
- },
- {
- "label": "Age in Months or Years",
- "id": "92",
- "type": "radio",
- "repeatable": "false",
- "_id": "92",
- "radio-options": "Years, Months,Unknown,Not Applicable"
- },
- {
- "label": "Sex",
- "id": "214",
- "type": "radio",
- "repeatable": "false",
- "_id": "214",
- "radio-options": "Male,Female,Unknown,Not Applicable"
- },
- {
- "label": "Shehia",
- "id": "798",
- "type": "autocomplete from code",
- "autocomplete-options": "window.ShehiaOptions = WardHierarchy.allWards()",
- "repeatable": "false",
- "validation" : "return 'Shehia is not valid' unless _.contains(window.ShehiaOptions, value)",
- "_id": "798"
- },
- {
- "label": "Village",
- "id": "334",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "334"
- },
- {
- "label": "Sheha/Mjumbe",
- "id": "907",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "907"
- },
- {
- "label": "Head of Household Name",
- "id": "720",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "720"
- },
- {
- "label": "Contact Mobile # (patient/relative)",
- "id": "363",
- "type": "text",
- "repeatable": "false",
- "_id": "363"
- },
- {
- "label": "Treatment Given",
- "id": "302",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "302"
- },
- {
- "label": "Travelled Overnight in past month",
- "id": "153",
- "type": "radio",
- "repeatable": "false",
- "_id": "153",
- "radio-options": "No, Yes within Zanzibar, Yes outside Zanzibar, Yes within and outside Zanzibar, Not Applicable"
- },
- {
- "label": "If YES, list ALL places travelled",
- "id": "573",
- "type": "text",
- "repeatable": "false",
- "required": "false",
- "skip_logic": "ResultOfQuestion('TravelledOvernightinpastmonth').indexOf('No') >= 0 if ResultOfQuestion('TravelledOvernightinpastmonth')?",
- "_id": "573"
- },
- {
- "label": "Comment/Remarks",
- "id": "566",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "required": "false",
- "_id": "566"
- },
- {
- "id": "341",
- "_id": "341",
- "label": "complete",
- "type": "checkbox",
- "repeatable": "false"
- }
- ]
-}
View
155 _docs/Household Members.json
@@ -1,155 +0,0 @@
-{
- "isApplicationDoc": true,
- "questions": [
- {
- "label": "Malaria Case ID",
- "id": "804",
- "type": "text",
- "repeatable": "false",
- "_id": "804"
- },
- {
- "label": "Head of Household Name",
- "id": "150",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "150"
- },
- {
- "label": "First Name",
- "id": "391",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "391"
- },
- {
- "label": "Last Name",
- "id": "259",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "259"
- },
- {
- "label": "Resident of Shehia",
- "id": "280",
- "radio-options": "Yes,No,Unknown,Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "_id": "280"
- },
- {
- "label": "Age",
- "id": "109",
- "type": "number",
- "repeatable": "false",
- "validation": "return 'Age must be between 0 and 200' if value < 0 or value > 200",
- "_id": "109"
- },
- {
- "label": "Age in Years or Months",
- "id": "79",
- "radio-options": "Years,Months,Unknown,Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "_id": "79"
- },
- {
- "label": "Sex",
- "id": "673",
- "radio-options": "Male,Female,Unknown,Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "_id": "673"
- },
- {
- "label": "Fever currently or in the last two weeks?",
- "id": "960",
- "radio-options": "Yes,No,Unknown,Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "_id": "960"
- },
- {
- "label": "Current Body Temperature (°C)",
- "id": "582",
- "type": "number",
- "repeatable": "false",
- "_id": "582"
- },
- {
- "label": "Malaria Test Result",
- "id": "350",
- "radio-options": "PF,NPF,Mixed,Not Tested",
- "type": "radio",
- "repeatable": "false",
- "_id": "350"
- },
- {
- "label": "Treatment Provided?",
- "id": "564",
- "radio-options": "Yes,No,Unknown,Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "skip_logic": "ResultOfQuestion('MalariaTestResult') is 'NPF' or ResultOfQuestion('MalariaTestResult') is 'Not Tested'",
- "_id": "564"
- },
- {
- "label": "Referred to Health Facility?",
- "id": "445",
- "radio-options": "Yes,No,Unknown,Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "skip_logic": "ResultOfQuestion('MalariaTestResult') is 'NPF' or ResultOfQuestion('MalariaTestResult') is 'Not Tested'",
- "_id": "445"
- },
- {
- "label": "Slept under LLIN last night?",
- "id": "768",
- "radio-options": "Yes,No,Unknown,Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "_id": "768"
- },
- {
- "label": "Overnight Travel in past month?",
- "id": "383",
- "radio-options": "No, Yes within Zanzibar, Yes outside Zanzibar, Yes within and outside Zanzibar, Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "_id": "383"
- },
- {
- "label": "If yes list all places travelled",
- "id": "969",
- "type": "text",
- "repeatable": "false",
- "required": "false",
- "skip_logic": "ResultOfQuestion('OvernightTravelinpastmonth').indexOf('No') >= 0 if ResultOfQuestion('OvernightTravelinpastmonth')?",
- "_id": "969"
- },
- {
- "label": "Comments",
- "id": "7",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "required": "false",
- "_id": "7"
- },
- {
- "id": "341",
- "_id": "341",
- "label": "complete",
- "type": "checkbox",
- "repeatable": "false"
- }
- ],
- "id": "Household Members",
- "resultSummaryFields": {
- "Malaria Test Result": "on",
- "First Name": "on",
- "Malaria Case ID": "on",
- "Head of Household Name": "on"
- },
- "collection": "question",
- "_id": "Household Members"
-}
View
204 _docs/Household.json
@@ -1,204 +0,0 @@
-{
- "isApplicationDoc": true,
- "collection": "question",
- "_id": "Household",
- "questions": [
-
- {
- "_id": "22531",
- "label": "Reason for visiting household",
- "repeatable": "false",
- "id": "22531",
- "radio-options": "Index Case Household, Index Case Neighbors, Mass Screen",
- "type": "radio",
- "action_on_change": "if (ResultOfQuestion('MalariaCaseID') is null and value is 'Mass Screen') then $('[name=MalariaCaseID]').val(moment().format('YYMD') + Math.floor(Math.random()*100000))",
-
- "repeatable": "false"
- },
-
- {
- "_id": "531",
- "label": "Malaria Case ID",
- "repeatable": "false",
- "type": "text",
- "id": "531"
- },
- {
- "_id": "401",
- "label": "Head of Household Name",
- "repeatable": "false",
- "type": "autocomplete from previous entries",
- "id": "401"
- },
- {
- "label": "Shehia",
- "id": "398",
- "repeatable": "false",
- "type": "autocomplete from code",
- "autocomplete-options": "window.ShehiaOptions = WardHierarchy.allWards()",
- "validation" : "return 'Shehia is not valid' unless _.contains(window.ShehiaOptions, value)",
- "_id": "398"
- },
- {
- "label": "Village",
- "id": "333",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "333"
- },
- {
- "label": "Sheha/Mjumbe",
- "id": "937",
- "type": "autocomplete from previous entries",
- "repeatable": "false",
- "_id": "937"
- },
- {
- "label": "Contact Mobile # (patient/relative)",
- "id": "363",
- "type": "text",
- "repeatable": "false",
- "_id": "363"
- },
- {
- "_id": "467",
- "label": "Household Location",
- "repeatable": "false",
- "required": "false",
- "type": "location",
- "id": "467"
- },
- {
- "_id": "22467",
- "label": "Followup Neighbors?",
- "repeatable": "false",
- "type": "radio",
- "radio-options": "Yes,No",
- "id": "22467"
- },
- {
- "_id": "22464",
- "label": "Number of other households within 50 steps of index case household",
- "repeatable": "false",
- "type": "number",
- "radio-options": "Yes,No",
- "skip_logic": "ResultOfQuestion('FollowupNeighbors') is 'No'",
- "id": "22464"
- },
- {
- "_id": "618",
- "label": "Total Number of Residents in the Household",
- "repeatable": "false",
- "type": "number",
- "validation" : "return 'Value must be between 0 and 20' if value < 0 or value > 20",
- "id": "618"
- },
- {
- "_id": "771",
- "label": "Number of LLIN",
- "repeatable": "false",
- "type": "number",
- "validation" : "return 'Value must be between 0 and 20' if value < 0 or value > 20",
- "id": "771"
- },
- {
- "_id": "233",
- "label": "Number of Sleeping Places (beds/mattresses)",
- "repeatable": "false",
- "type": "number",
- "validation" : "return 'Value must be between 0 and 20' if value < 0 or value > 20",
- "id": "233"
- },
-
-
- {
- "_id": "7233",
- "label": "Have you given coupon(s) for nets",
- "radio-options": "Yes,No",
- "repeatable": "false",
- "type": "radio",
- "skip_logic": "console.log ResultOfQuestion('NumberofLLIN');ResultOfQuestion('NumberofLLIN') >= ResultOfQuestion('NumberofSleepingPlacesbedsmattresses')",
- "id": "7233"
- },
- {
- "_id": "8233",
- "label": "Coupon Numbers",
- "repeatable": "false",
- "type": "text",
- "required": "false",
- "skip_logic": "ResultOfQuestion('Haveyougivencouponsfornets') is null or ResultOfQuestion('Haveyougivencouponsfornets') is 'No' ",
- "id": "8233"
- },
-
-
-
- {
- "_id": "625",
- "label": "Number of Household Members with Fever or History of Fever Within Past Week",
- "repeatable": "false",
- "type": "number",
- "validation" : "return 'Value must be between 0 and 20' if value < 0 or value > 20",
- "id": "625"
- },
- {
- "_id": "305",
- "label": "Number of Household Members Treated for Malaria Within Past Week",
- "repeatable": "false",
- "type": "number",
- "validation" : "return 'Value must be between 0 and 20' if value < 0 or value > 20",
- "id": "305"
- },
- {
- "_id": "105",
- "radio-options": "Yes,No,Unknown,Not Applicable",
- "label": "Index case: If patient is female 15-45 years of age, is she is pregant?",
- "repeatable": "false",
- "type": "radio",
- "id": "105"
- },
- {
- "label": "Index case: Patient's current status",
- "id": "768",
- "radio-options": "Feeling Better, Feeling Unchanged, Feeling Worse, Admitted, Died ",
- "type": "radio",
- "repeatable": "false",
- "_id": "768"
- },
- {
- "label": "Index case: Patient's treatment status",
- "id": "168",
- "radio-options": "Completed, In Progress, Stopped",
- "type": "radio",
- "repeatable": "false",
- "_id": "768"
- },
- {
- "label": "Index case: Slept under LLIN last night?",
- "id": "728",
- "radio-options": "Yes,No,Unknown,Not Applicable",
- "type": "radio",
- "repeatable": "false",
- "_id": "768"
- },
- {
- "_id": "755",
- "label": "Last date of IRS",
- "repeatable": "false",
- "type": "date",
- "id": "755"
- },
- {
- "id": "341",
- "_id": "341",
- "label": "complete",
- "type": "checkbox",
- "repeatable": "false"
- }
- ],
- "resultSummaryFields": {
- "Head of Household Name": "on",
- "Total Number of Residents in the Household": "on",
- "Malaria Case ID": "on"
- },
- "id": "Household"
-}
View
10 _docs/coconut.config.json
@@ -1,10 +0,0 @@
-{
- "isApplicationDoc": true,
- "_id": "coconut.config",
- "title": "Zanzibar Malaria Elimination",
- "cloud": "coconut.zmcp.org",
- "local_couchdb_admin_username": "coco",
- "local_couchdb_admin_password": "cocopuffs",
- "cloud_credentials": "coconutsurveillance:zanzibar",
- "date_format": "YYYY-MM-DD HH:mm:ss"
-}
View
2  _docs/version.json
@@ -1 +1 @@
-{"version":"1624339","isApplicationDoc":true}
+{"version":"e616620","isApplicationDoc":true}
View
7 build_android_app/make.sh
@@ -14,18 +14,15 @@ cd -
curl -H "Content-Type: application/json" -d '{"mode":"mobile","collection":"local_configuration"}' -X PUT http://coco:cocopuffs@localhost:5984/zanzibar/coconut.config.local;
-curl --compressed -s http://coconut.zmcp.org/zanzibar/Facility%20Hierarchy > /tmp/Facility\ Hierarchy.json
-curl -H "Content-Type: application/json" -d @/tmp/Facility\ Hierarchy.json -X PUT http://coco:cocopuffs@localhost:5984/zanzibar/Facility%20Hierarchy
+echo "Retrieving application files from cloud to put in local database:"
-curl --compressed -s http://coconut.zmcp.org/zanzibar/Ward%20Hierarchy > /tmp/Ward\ Hierarchy.json
-curl -H "Content-Type: application/json" -d @/tmp/Ward\ Hierarchy.json -X PUT http://coco:cocopuffs@localhost:5984/zanzibar/Ward%20Hierarchy
+/usr/bin/ruby copy_application_docs_to_local_db.rb
echo
echo "********"
echo "Cleaning"
echo "********"
ant clean
-# ant debug clean
echo
echo "********"
echo "Compacting database"

2 comments on commit 7a18028

@gmcressman

Useful in many, if not all, Coconut apps.

@mikeymckay
Owner
Please sign in to comment.
Something went wrong with that request. Please try again.