Beispiel #1
0
            except IndexError:
                submission.response = "Thank you. Your data on %s has been received" % xform.keyword
        elif xform.keyword in other_keywords:
            submission.response = "Thank you. Your data on %s has been received" % xform.keyword
            submission.save()
    else:
        submission.response = "Thank you.  Your data on %s has been received" % xform.keyword
        submission.save()


def eliminate_duplicates(sender, **kwargs):
    messages = kwargs["messages"]
    messages.exclude(connection__backend__name="yo6200").update(status="C")


Poll.register_poll_type("date", "Date Response", parse_date_value, db_type=Attribute.TYPE_OBJECT)

XFormField.register_field_type("emisdate", "Date", parse_date, db_type=XFormField.TYPE_INT, xforms_type="integer")

XFormField.register_field_type("emisbool", "YesNo", parse_yesno, db_type=XFormField.TYPE_INT, xforms_type="integer")

XFormField.register_field_type(
    "fuzzynum", "Fuzzy Numbers (o/0/none)", parse_fuzzy_number, db_type=XFormField.TYPE_INT, xforms_type="integer"
)

script_progress_was_completed.connect(emis_autoreg, weak=False)
script_progress_was_completed.connect(emis_reschedule_script, weak=False)
script_progress.connect(emis_autoreg_transition, weak=False)
xform_received.connect(xform_received_handler, weak=False)
mass_text_sent.connect(eliminate_duplicates, weak=False)
def register_custom_field_types():
    XFormField.register_field_type('pin', 'Pin', _parse_pin,xforms_type='string', db_type=XFormField.TYPE_INT)
    XFormField.register_field_type('name_val', 'Name',_parse_name)
    XFormField.register_field_type('date_val','Date',_parse_date)
    XFormField.register_field_type('date_c','CDate',_parse_child_date_of_birth)
    XFormField.register_field_type('sex_val','Sex',_parse_pin, db_type=XFormField.TYPE_INT)
    XFormField.register_field_type('nat_val','Nationality',_parse_pin, db_type=XFormField.TYPE_INT)
    XFormField.register_field_type('name_sal','SName',_parse_name_single)
Beispiel #3
0
            if len(remaining) > 50:
                remaining = "%s..." % remaining[:47]
            raise ValidationError('You need to send a number for %s, you sent %s.Please resend' % (command, remaining))
        else:
            return int(num)

def parse_facility_value(value):
    try:
        return HealthFacility.objects.get(code=value)
    except:
        raise ValidationError("Expected an HMIS facility code (got: %s)." % value)

def parse_facility(command, value):
    return parse_facility_value(value)

XFormField.register_field_type('cvssex', 'Gender', parse_gender,
                               db_type=XFormField.TYPE_TEXT, xforms_type='string')

XFormField.register_field_type('cvsloc', 'Place', parse_place,
                               db_type=XFormField.TYPE_TEXT, xforms_type='string')

XFormField.register_field_type('cvstdelt', 'Time Delta', parse_timedelta,
                               db_type=XFormField.TYPE_INT, xforms_type='integer')

XFormField.register_field_type('cvsmuacr', 'Muac Reading', parse_muacreading,
                               db_type=XFormField.TYPE_TEXT, xforms_type='string')

XFormField.register_field_type('cvsodema', 'Oedema Occurrence', parse_oedema,
                               db_type=XFormField.TYPE_TEXT, xforms_type='string')

XFormField.register_field_type('facility', 'Facility Code', parse_facility,
                               db_type=XFormField.TYPE_OBJECT, xforms_type='string')
Beispiel #4
0
                for i in range(0, len(keywords)):
                    if xform.keyword == keywords[i] and sp.step.order == i:
                        sp.status = 'C'
                        sp.save()
                        submission.response = "Thank you.  Your data on %s has been received" % xform.keyword
                        submission.save()
                        return
        elif xform.keyword in keywords:
            submission.response = "Please wait to send your data on %s until the appropriate time." % xform.keyword
            submission.has_errors = True
            submission.save()
            pass
    else:
        submission.response = "Thank you.  Your data on %s has been received" % xform.keyword
        submission.save()



Poll.register_poll_type('date', 'Date Response', parse_date_value, db_type=Attribute.TYPE_OBJECT)

XFormField.register_field_type('emisdate', 'Date', parse_date,
                               db_type=XFormField.TYPE_INT, xforms_type='integer')

XFormField.register_field_type('emisbool', 'YesNo', parse_yesno,
                               db_type=XFormField.TYPE_INT, xforms_type='integer')

script_progress_was_completed.connect(emis_autoreg, weak=False)
script_progress_was_completed.connect(emis_reschedule_script, weak=False)
script_progress.connect(emis_autoreg_transition, weak=False)
xform_received.connect(xform_received_handler, weak=False)