← Back to team overview

dhis2-devs team mailing list archive

Re: Using SMS Commands for data capture


Hi Jasper,

OrgUnit code is unique identifier for organisation unit so in that sense its same as ID. For period type there is no prefix because the date mentioned in SMS text is used to create PeriodType. If Date is not mentioned in SMS then it is retrieved from DataSet.

I will test and share sample SMS command by tomorrow.

On 01. sep. 2016 16:55, Jasper Timm wrote:
Thanks very much for the response Zubair, that's quite helpful.

So when specifying the orgUnit in the command you need to precede it by 'org '? What exactly is meant by <orgUnitCode>, is it simply the id of the orgUnit? Is there a similar prefix required when specifying period?

Maybe you could give an example of an SMS Command submission specifying both orgUnit and period?


- Jasper

On Tue, Aug 30, 2016 at 9:01 PM, Zubair Asghar Raja <zubair@xxxxxxxxx <mailto:zubair@xxxxxxxxx>> wrote:

    Hi Jasper,

    Sorry for the late response.

    In SMS orgUnit can be specified like this "org <orgUnitCode>" If
    no orgUnit is specified in SMS then first user is retrieved from
    phoneNumber and then orgUnit from that user.
    As far as PeriodType is concerned it should be specified in this
    format "ddMM" for example 3108, but in case its not specified then
    PeriodType will be retrieved from DataSet attached to SMSCommand.

    On 30. aug. 2016 20:17, Jasper Timm wrote:
    Still hoping for a response on this regarding the more specific
    questions regarding identifying OrgUnit by phone and how to
    specify OrgUnit/Period.

    Zubair - are you aware of how that works? Or any other DHIS2 dev?


    - Jasper

    On Wed, Aug 24, 2016 at 1:38 PM, Jasper Timm
    <mailto:jasper.timm@xxxxxxxxxxxxxxxxxx>> wrote:

        Hi Zubair,

        Thanks for the quick response but I don't think it answered
        the questions I asked regarding how to specify the OrgUnit
        and Period at all.

        Also, in the case where no OrgUnit is specified in the SMS,
        I'm assuming given there is a 'User belongs to more than one
        OrgUnit' message that DHIS2 attempts to guess the user by the
        phone number the SMS was received from and uses the OrgUnit
        the user is assigned to?

        And for the multiple messages then - I assume you need to
        split the submission up into multiple SMSs with the same
        'header' (command name, orgunit, period?) and separate lists
        of the key,value pairs for the data elements?

        As in:

        MSG1 = "report <orgUnitCode> <period> de1,1 de2,0 de3,4"
        MSG2 = "report <orgUnitCode> <period> de4,2 de5,2" e.t.c.

        Which makes it a bit tricky when it comes to considering the
        submission 'complete' I suppose. I guess then you'd have to
        allow partial submissions to complete the form.


        - Jasper

        On Wed, Aug 24, 2016 at 1:04 PM, Zubair Asghar Raja
        <zubair@xxxxxxxxx <mailto:zubair@xxxxxxxxx>> wrote:

            Hi Jasper,

            please find the answers in line.

            On 24. aug. 2016 13:58, Jasper Timm wrote:
            Hi there,

            We're considering using the SMS Commands functionality
            of DHIS2 to receive data from the data capture Android
            App when there is no internet connectivity.

            I'm working from the documentation here:

            Unfortunately it still leaves a few questions:

            - How do you specify the OrgUnit and Period? Does the
            discussion from this thread still apply?
            If so - how does the parser differentiate when you
            specify BOTH OrgUnit and Period? Where does one assign
            codes to the OrgUnits?
            *       SMSCommand is associated with a Parser and parser
            is attached to certain Programs (with/without registration).

                   1. Create SMSCommand
                   2. Edit SMSCommand
                   3. Set response messages to be sent to the
            originating user.
                   4. Set codes for data elements ( for example age,
            height, orgunit etc )

            - What happens when a message is longer than one SMS
            *  When text is longer then one SMS(160 characters) then
            it will be sent as multiple SMSes each having <= 160
            characters. *

            It'd be great to see these answers in the documentation


            - Jasper

            Mailing list:https://launchpad.net/~dhis2-devs
            Post to     :dhis2-devs@xxxxxxxxxxxxxxxxxxx
            Unsubscribe :https://launchpad.net/~dhis2-devs
            More help   :https://help.launchpad.net/ListHelp

-- Zubair Asghar
            Software Developer, DHIS2
            University of Oslo
            www.dhis2.org <http://www.dhis2.org>

-- Zubair Asghar
    Software Developer, DHIS2
    University of Oslo
    www.dhis2.org <http://www.dhis2.org>

Zubair Asghar
Software Developer, DHIS2
University of Oslo

Follow ups