← Back to team overview

dhis2-devs team mailing list archive

[Bug 1251157] Re: Web API Tracker - user as parameter in events list and shown in result

 

It seems the Event model object supports person-info, but that this
information is not populated in the Hibernate call.

>From DefaultEventStore:

    @Override
    public List<Event> getAll( List<Program> programs, List<ProgramStage> programStages, List<OrganisationUnit> organisationUnits, Date startDate, Date endDate )
    {
        List<Event> events = new ArrayList<Event>();
        String sql = buildSql( getIdList( programs ), getIdList( programStages ), getIdList( organisationUnits ),
            startDate, endDate );

        SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );

        Event event = new Event();
        event.setEvent( "not_valid" );

        while ( rowSet.next() )
        {
            if ( !event.getEvent().equals( rowSet.getString( "psi_uid" ) ) )
            {
                event = new Event();

                event.setEvent( rowSet.getString( "psi_uid" ) );
                event.setStatus( EventStatus.fromInt( rowSet.getInt( "psi_status" ) ) );
                event.setProgram( rowSet.getString( "p_uid" ) );
                event.setProgramStage( rowSet.getString( "ps_uid" ) );
                event.setStoredBy( rowSet.getString( "psi_completeduser" ) );
                event.setOrgUnit( rowSet.getString( "ou_uid" ) );
                event.setEventDate( rowSet.getString( "psi_executiondate" ) );

                events.add( event );
            }

            DataValue dataValue = new DataValue();
            dataValue.setValue( rowSet.getString( "pdv_value" ) );
            dataValue.setProvidedElsewhere( rowSet.getBoolean( "pdv_providedelsewhere" ) );
            dataValue.setDataElement( rowSet.getString( "de_uid" ) );
            dataValue.setStoredBy( rowSet.getString( "pdv_storedby" ) );

            event.getDataValues().add( dataValue );
        }

        return events;
    }

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1251157

Title:
  Web API Tracker - user as parameter in events list and shown in result

Status in DHIS 2:
  New

Bug description:
  I guess I'm stretching the bug-definition here, but it would be
  extremely useful for our 'Embedding apps in tracker' groups in INF5750
  if it was possible to add the patient identifier to the events API
  string to list events for a given patient.

  I request:

  1. That the person id can be used to search
  2. That the person-information/id is in the event result. 

  So for example (today):

  http://apps.dhis2.org/demo/api/events.json?orgUnit=DiszpKrYNg8&program=uy2gU8kT1jF&programStage=grIfo3oOf4Y&startDate=2013-01-01&endDate=2013-12-01

  I'd like to add:

  http://apps.dhis2.org/demo/api/events.json?orgUnit=DiszpKrYNg8&program=uy2gU8kT1jF&programStage=grIfo3oOf4Y&startDate=2013-01-01&endDate=2013-12-01&person=<id>

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1251157/+subscriptions


References