Great. Just realized that when you create new validation rules there is not
much point in setting last updated, created attributes. Code is also not
mandatory. Check out this minimal example.



<?xml version='1.0' encoding='UTF-8'?>
<metaData xmlns="http://dhis2.org/schema/dxf/2.0";>
    <validationRules>
        <validationRule name="Penta3, Exclusive breastfeeding, &lt;1 year
Fixed">
            <type>absolute</type><operator>less_than_or_equal_to</operator>
            <leftSide>
                <expression>#{pEOVd4Z3TAS.Prlt0C1RF0s}</expression>
                <description>People asked at Penta3 if Exclusive
breastfeeding, &lt;1 year Fixed</description>
                <nullIfBlank>true</nullIfBlank>
                <dataElements>
                    <dataElement id="pEOVd4Z3TAS"/>
                </dataElements>
            </leftSide>
            <rightSide>
                <expression>#{n6aMJNLdvep.Prlt0C1RF0s}</expression>
                <description>Penta3, &lt;1 year Fixed</description>
                <nullIfBlank>true</nullIfBlank>
                <dataElements>
                    <dataElement id="n6aMJNLdvep"/>
                </dataElements>
            </rightSide>
            <periodType>Monthly</periodType>
            <description>Question asked at Penta3 vs number of
Penta3</description>
        </validationRule>
    </validationRules>
</metaData>


On Mon, Jul 15, 2013 at 10:10 PM, Farai Mutero <fmut...@gmail.com> wrote:

> Thanks Lars and Ranga for the info. Now I'm clear.
>
> Regards
>
> Farai
>
>
> On Mon, Jul 15, 2013 at 9:03 PM, Lars Helge Øverland 
> <larshe...@gmail.com>wrote:
>
>> Hi Farai,
>>
>> the meta-data import process is documented here:
>>
>> http://www.dhis2.org/doc/snapshot/en/user/html/ch25s05.html
>>
>> First, you need to construct your XML (or possibly JSON), something like
>> this:
>>
>> <?xml version='1.0' encoding='UTF-8'?>
>> <metaData xmlns="http://dhis2.org/schema/dxf/2.0";
>> created="2013-07-15T18:54:37.575+0000">
>>     <validationRules>
>>         <validationRule name="Penta3, Exclusive breastfeeding, &lt;1 year
>> Fixed" created="2011-12-24T11:24:22.817+0000"
>> lastUpdated="2011-12-24T11:24:22.817+0000" id="B3cosSOA63b">
>>
>> <type>absolute</type><operator>less_than_or_equal_to</operator>
>>             <leftSide>
>>                 <expression>#{pEOVd4Z3TAS.Prlt0C1RF0s}</expression>
>>                 <description>People asked at Penta3 if Exclusive
>> breastfeeding, &lt;1 year Fixed[33.292]</description>
>>                 <nullIfBlank>true</nullIfBlank>
>>                 <dataElements>
>>                     <dataElement code="DE_33" name="Q_Exclusive
>> breastfeeding at time of Penta 3" created="2011-12-24T11:24:25.088+0000"
>> lastUpdated="2013-03-15T16:32:25.814+0000" id="pEOVd4Z3TAS"/>
>>                 </dataElements>
>>             </leftSide>
>>             <rightSide>
>>                 <expression>#{n6aMJNLdvep.Prlt0C1RF0s}</expression>
>>                 <description>Penta3, &lt;1 year
>> Fixed[25.292]</description>
>>                 <nullIfBlank>true</nullIfBlank>
>>                 <dataElements>
>>                     <dataElement code="DE_25" name="Penta3 doses given"
>> created="2012-11-05T11:56:39.621+0000"
>> lastUpdated="2013-03-15T16:32:25.950+0000" id="n6aMJNLdvep"/>
>>                 </dataElements>
>>             </rightSide>
>>             <periodType>Monthly</periodType><description>Question asked
>> at Penta3 vs number of Penta3</description>
>>         </validationRule>
>>     </validationRules>
>> </metaData>
>>
>>
>>
>> Please note the <metaData> wrapper element. After that you can POST your
>> xml to the metaData web api resource with something like this if using curl
>> and naming the file metaData.xml:
>>
>> curl -H "Content-Type: application/xml" -u admin:district -d @metaData.xml 
>> "http://your-server-url/api/metaData"; -X POST
>>
>>
>> regards,
>>
>> Lars
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Jun 27, 2013 at 5:25 PM, Farai Mutero <fmut...@gmail.com> wrote:
>>
>>> Hi Guys
>>>
>>> Could anyone please be kind enough to share the steps to import
>>> Validation Rules through the Web API? Please also provide a sample url and
>>> possibly a template csv file (if necessary).
>>>
>>> Your assistance will be much appreciated.
>>>
>>> Regards
>>> --
>>> Farai Mutero
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
>
> --
> Farai Mutero
>
>
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to