@staticmethod
    def irs_dispatch(r, **attr):

        if r.representation == "html" and \
           r.name == "ireport" and r.id and not r.component:

            T = current.T
            msg = current.msg

            record = r.record
            id = record.id

            contact = ""
            if record.contact:
                contact = "\n%s: %s" (T("Contact"),
                                      record.contact)
            message = ""
            if record.message:
                message = "\n%s" % record.message
            text = "SI#%s\n%s%s%s" % (id,
                                   record.name,
                                   contact,
                                   message)
            text += "\nSend help to see how to respond!"

            # Encode the message as an OpenGeoSMS
            message = msg.prepare_opengeosms(record.location_id,
                                             code="ST",
                                             map="google",
                                             text=text)

            # URL to redirect to after message sent
            url = URL(c="irs",
                      f="ireport",
                      args=r.id)

            # Create the form
            opts = dict(
                    type="SMS",
                    # @ToDo: deployment_setting
                    subject = T("Deployment Request"),
                    message = message,
                    url = url,
                    #formid = r.id
                )
            # Pre-populate the recipients list if we can
            # @ToDo: Check that we have valid contact details
            #        - slower, but useful to fail early if we need to
            s3db = current.s3db
            if current.deployment_settings.get_irs_vehicle():
                # @ToDo: This workflow requires more work
                #        - no ic defined yet in this case
                table = s3db.irs_ireport_vehicle_human_resource
            else:
                table = s3db.irs_ireport_human_resource
            htable = s3db.hrm_human_resource
            ptable = s3db.pr_person
            query = (table.ireport_id == id) & \
                    (table.deleted == False) & \
                    (table.human_resource_id == htable.id) & \
                    (htable.person_id == ptable.id)
            recipients = current.db(query).select(table.incident_commander,
                                                  ptable.pe_id)
            if not recipients:
                # Provide an Autocomplete the select the person to send the notice to
                opts["recipient_type"] = "pr_person"
            elif len(recipients) == 1:
                # Send to this person
                opts["recipient"] = recipients.first()["pr_person"].pe_id
            else:
                # Send to the Incident Commander
                ic = False
                for row in recipients:
                    if row["irs_ireport_human_resource"].incident_commander == True:
                        opts["recipient"] = row["pr_person"].pe_id
                        ic = True
                        break
                if not ic:
                    # Provide an Autocomplete the select the person to send the notice to
                    opts["recipient_type"] = "pr_person"
            output = msg.compose(**opts)

            # Maintain RHeader for consistency
            if attr.get("rheader"):
                rheader = attr["rheader"](r)
                if rheader:
                    output["rheader"] = rheader

            output["title"] = T("Send Dispatch Update")
            current.response.view = "msg/compose.html"
            return output

        else:
            raise HTTP(405, current.ERROR.BAD_METHOD)

    # -------------------------------------------------------------------------
return index in self.det_desc most closely matching supplied string
dataset/ETHPy150Open sahana/eden/modules/s3db/irs.py/S3IRSModel.irs_dispatch--crossover with--dataset/ETHPy150Open xraypy/xraylarch/plugins/io/gse_escan.py/EscanData.match_detector_name