← Back to team overview

dhis2-users team mailing list archive

Re: Complete DataSets after bulk data values import

 

I think you will also need the "date" which the dataset was completed.
Again, this is fairly subjective about when the data would have been
completed, but you could set it to some date after the end date of the
period.

Here is some SQL for Postgres which  I have used for this type of operation
which may help you get started. This will delete all existing records for a
given dataset, which you may or may not want.


--Change this to the datasetID you wish to update.
DELETE FROM completedatasetregistration where datasetid = 3438;
--Set to 15 days after the end date of the period
 INSERT INTO completedatasetregistration
 SELECT DISTINCT 3438::integer as datasetid,a.periodid, a.sourceid,
 (b.enddate+'15 days'::interval)::date as date,'admin'::character
varying(255) as storedby  from datavalue a
INNER JOIN period b on a.periodid = b.periodid
 where a.dataelementid
IN (SELECT DISTINCT dataelementid from datasetmembers where datasetid
=3438);

Of course, you could create some procedural code/SQL to loop over a number
of datasets if you need to.

Regards,
Jason



On Wed, Aug 7, 2013 at 9:50 PM, Ola Hodne Titlestad <olati@xxxxxxxxxx>wrote:

> While waiting for the new feature a workaround would be to do some sql
> statements directly on the database and insert new records into the
> completedatasetregistration table for the orgunit, period, dataset
> combinations where you have "complete data". How you define "complete"
> would then be an objective evaluation based on the data values you have
> imported, e.g. where a specific data element is present or where there is
> at least one value for any of the data elements in the dataset.
>
> Ola
> ------
> On 7 Aug 2013 20:41, "Lars Helge Øverland" <larshelge@xxxxxxxxx> wrote:
>
>> Hello Paulo,
>>
>> sorry to say we don't support bulk complete data set registrations yet.
>>
>> We plan to fix this by including it directly in the XML/JSON export
>> files. Its on the plan for 2.13:
>>
>>
>> https://blueprints.launchpad.net/dhis2/+spec/complete-registrations-datavalue-exchange
>>
>> regards,
>>
>> Lars
>>
>>
>>
>> On Mon, Aug 5, 2013 at 8:15 PM, Paulo Grácio <
>> pgracio@xxxxxxxxxxxxxxxxxxxx> wrote:
>>
>>> Hi all,****
>>>
>>> After Sending large bulks of data values how do you think is the best
>>> way to mark data sets as complete?****
>>>
>>> Regards,****
>>>
>>> Paulo Grácio****
>>>
>>> ** **
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-users
>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References