← Back to team overview

dhis2-devs team mailing list archive

Re: Tracker - ProgramStageInstance/Events tracked against different org unit to TrackedEntityInstance

 

Hi,

The new tracker capture UI (already in trunk) has support for this.

The advanced search also provides a different orgunit tree in order to
search TEIs outside the "data entering" org unit.

-----
Thank you,
Abyot.

(sent from mobile)
Hi all,

Although it's not possible to create an event that is linked to a different
org unit to the trackedentityinstance org unit through the user interface,
this can be done via the api.
We have a use case where it is normal for events to be registered against
different org units, with the org unit of the tracked entity being not very
interesting.
I've tested the aggregation and it works on the psi org unit (as can be
seen from the validation sql query below) - I'd like to use this paradigm
in the momconnect program - we have hundreds of thousands of events, and
the program is rolled out nationally.

Can anyone see a problem with doing this?

 I know there have been discussions about not linking tracked
entities/enrolments against an org unit - maybe it would be good enough to
have that org unit as the 'initially enrolled at' org unit (which would
really be the same as the org unit of the first event assuming that the
event is registered upon enrolment). So allowing events to be registered
against a specific org unit in the front end could solve this.

Thoughts?

Thanks



SELECT '0' as dataelementid,
'0' as categoryoptioncomboid,
'16' as attributeoptioncomboid,
ou.organisationunitid as sourceid,
'0' as periodid,
'aggregated_from_tracker' as storedby,
'201502' as periodIsoDate,
'dataelementname' as dataelementname,
'optioncomboid' as categoryoptioncomboname,
ou.name as organisationunitname,
sum( cast( pdv.value as double precision ) )
FROM trackedentitydatavalue pdv
INNER JOIN programstageinstance psi ON psi.programstageinstanceid =
pdv.programstageinstanceid
INNER JOIN organisationunit ou ON ou.organisationunitid=
*psi.organisationunitid*
WHERE executiondate >='2015-02-24' AND executiondate <='2015-02-24' AND
pdv.dataelementid=null
AND  EXISTS (
SELECT *
FROM trackedentitydatavalue _pdv
inner join programstageinstance _psi ON
_pdv.programstageinstanceid=_psi.programstageinstanceid
JOIN programinstance _pi ON _pi.programinstanceid=_psi.programinstanceid
WHERE psi.programstageinstanceid=_pdv.programstageinstanceid
AND _pdv.dataelementid=7256314
AND _psi.organisationunitid in (0)
AND _pi.programid = 47884
AND _psi.executionDate>='2015-02-24'
AND _psi.executionDate <= '2015-02-24'
AND _psi.programstageid = 7256329
AND _pdv.value ='1'
)
GROUP BY ou.organisationunitid, ou.name

_______________________________________________
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

References