(app, lang, enroll_form_id)
Creates Identification Module for Biometrics
Creates Identification Module for Biometrics
Creates Identification Module for Biometrics
def _init_biometrics_identify_module(app, lang, enroll_form_id):
    """
    Creates Identification Module for Biometrics
    """
    module = app.add_module(Module.new_module(_("Identify Registered Person"), lang))

    # make sure app has Register From Case List Add-On enabled
    app.add_ons["register_from_case_list"] = True

    # turn on Register from Case List with Simprints Enrolment form
    module.case_list_form = CaseListForm(
        form_id=enroll_form_id,
        label=dict([(lang, _("Enroll New Person"))]),
    )
    case_list = module.case_details.short
    case_list.lookup_enabled = True
    case_list.lookup_action = "com.simprints.id.IDENTIFY"
    case_list.lookup_name = _("Scan Fingerprint")
    case_list.lookup_extras = list([
        dict(key=key, value="'{}'".format(value))
        for key, value in app.biometric_context.items()
    ])
    case_list.lookup_responses = [
        {'key': 'fake'},
    ]
    case_list.lookup_display_results = True
    case_list.lookup_field_header[lang] = _("Confidence")
    case_list.lookup_field_template = 'simprintsId'

    form_name = _("Followup with Person")

    output_tag = mark_safe(  # nosec: no user input
        "<output value=\"instance('casedb')/casedb/case[@case_id = "
        "instance('commcaresession')/session/data/case_id]/case_name\" "
        "vellum:value=\"#case/case_name\" />"
    )

    context = {
        'xmlns_uuid': generate_xmlns(),
        'form_name': form_name,
        'lang': lang,
        'placeholder_label': format_html(_(
            "This is your follow up form for {}. Delete this label and add "
            "questions for any follow up visits."
        ), output_tag)
    }
    attachment = render_to_string(
        "app_manager/simprints_followup_form.xml",
        context=context
    )

    identify = app.new_form(module.id, form_name, lang, attachment=attachment)
    identify.requires = 'case'
    identify.actions.update_case = UpdateCaseAction(
        condition=FormActionCondition(type='always'))

    module.case_type = 'person'
def _init_biometrics_identify_module ( app , lang , enroll_form_id ) : module = app . add_module ( Module . new_module ( _ ( "Identify Registered Person" ) , lang ) ) # make sure app has Register From Case List Add-On enabled app . add_ons [ "register_from_case_list" ] = True # turn on Register from Case List with Simprints Enrolment form module . case_list_form = CaseListForm ( form_id = enroll_form_id , label = dict ( [ ( lang , _ ( "Enroll New Person" ) ) ] ) , ) case_list = module . case_details . short case_list . lookup_enabled = True case_list . lookup_action = "com.simprints.id.IDENTIFY" case_list . lookup_name = _ ( "Scan Fingerprint" ) case_list . lookup_extras = list ( [ dict ( key = key , value = "'{}'" . format ( value ) ) for key , value in app . biometric_context . items ( ) ] ) case_list . lookup_responses = [ { 'key' : 'fake' } , ] case_list . lookup_display_results = True case_list . lookup_field_header [ lang ] = _ ( "Confidence" ) case_list . lookup_field_template = 'simprintsId' form_name = _ ( "Followup with Person" ) output_tag = mark_safe ( # nosec: no user input "<output value=\"instance('casedb')/casedb/case[@case_id = " "instance('commcaresession')/session/data/case_id]/case_name\" " "vellum:value=\"#case/case_name\" />" ) context = { 'xmlns_uuid' : generate_xmlns ( ) , 'form_name' : form_name , 'lang' : lang , 'placeholder_label' : format_html ( _ ( "This is your follow up form for {}. Delete this label and add " "questions for any follow up visits." ) , output_tag ) } attachment = render_to_string ( "app_manager/simprints_followup_form.xml" , context = context ) identify = app . new_form ( module . id , form_name , lang , attachment = attachment ) identify . requires = 'case' identify . actions . update_case = UpdateCaseAction ( condition = FormActionCondition ( type = 'always' ) ) module . case_type = 'person'