childcount.utils

class childcount.utils.DOBProcessor[source]

Date-of-Birth parser

MAX_AGE

Age (in years) beyond which we don’t recognize

classmethod from_age(lang, string, date_ref)[source]
classmethod from_age_or_dob(lang, age_or_dob, date_ref=None)[source]
classmethod from_dob(lang, string, date_ref=None)[source]
classmethod get_age_units(lang)[source]
classmethod is_valid_age(lang, age_string, date_ref=None)[source]
classmethod is_valid_dob(lang, dob_string, date_ref=None)[source]
classmethod is_valid_dob_or_age(lang, age_or_dob, date_ref=None)[source]
class childcount.utils.KeywordMapper[source]

Parser for SMS keywords

add_class(cls)[source]
add_classes(classes)[source]
get_all_keywords()[source]
get_class(lang, keyword)[source]
get_keywords(lang)[source]
is_keyword(lang, keyword)[source]
class childcount.utils.RotatedParagraph(paragraph, aW, aH)[source]

Rotates a paragraph

draw()[source]
childcount.utils.alert_health_team(name, msg)[source]
childcount.utils.authenticated(func)[source]

decorator checking if sender is allowed to process feature.

checks if sender property is set on message

Returns:function or bool
childcount.utils.clean_names(flat_name, surname_first=True)[source]

Takes a persons name as a single string and returns surname, first names, and alias:

>>> clean_names("smith john")
(u'Smith', u'John', u'jsmith')

Also can be passed an optional argument surname_first=False:

>>> clean_names("john ADAM smith", surname_first=False)
(u'Smith', u'John Adam', u'jasmith')
childcount.utils.day_end(date)[source]

end of day from date.

:returns datetime.datetime

childcount.utils.day_start(date)[source]

begining of day from date.

:returns datetime.datetime

childcount.utils.first_date_of_week(givendate)[source]

Return date of first Monday before givendate

childcount.utils.first_day_of_month(date)[source]
childcount.utils.get_ccforms_by_name()[source]
childcount.utils.get_dates_of_the_week(givendate=None)[source]
childcount.utils.get_indicators()[source]
childcount.utils.get_median(listOfNumericValues)[source]

get the median of a list of numeric values

childcount.utils.last_day_of_month(date)[source]
childcount.utils.respond_exceptions(func)[source]

A decorator that catches exceptions and sends the text of the exception to the sender by responding to the message object. It can be used on the rapidsms.app.App methods that are passed (self, message)

childcount.utils.send_msg(reporter, text)[source]

Sends a message to a reporter using the ajax app. This goes to ajax_POST_send_message in apps/findtb/app.py

childcount.utils.seven_days_to_date(givendate=None)[source]

Previous topic

childcount.tasks

Next topic

libreport

This Page