Welcome to TolaActivity’s documentation!

API

Endpoints

Example

::
curl -H “Authorization: Token adkai39a9sdfj239m0afi2” https://activity.toladata.io/api/programs/{{id}}/`

GET /api/programs/

HTTP 200 OK Allow: GET, POST, OPTIONS Content-Type: application/json Vary: Accept

Response

[
  {
    "url": "http://activity.toladata.io/api/programs/1/",
    "gaitid": "1001",
    "name": "Financial Assistance to Affected Communities",
    "funding_status": "Funded",
    "cost_center": "12345",
    "description": "DFID Funded Cash Emergency Distribution Program",
    "create_date": "2017-02-22T18:25:37Z",
    "edit_date": "2017-06-26T15:05:39Z",
    "budget_check": true,
    "public_dashboard": true,
    "fund_code": [],
    "sector": [
        "http://activity.toladata.io/api/sector/31/",
        "http://activity.toladata.io/api/sector/32/"
    ],
    "country": [
        "http://activity.toladata.io/api/country/1/"
    ],
    "user_access": []
  },
  ...
]

Install

http://toladata.github.io/TolaActivity

TolaActivity extends the functionality of TolaData to include a set of forms and reports for managing project activities for a Program. It includes workflow for approving and completing projects as well as sharing the output data.

TolaActivity functionality http:www.github.com/toladata/TolaAcitivty is intended to allow importing and exporting of project specific data from 3rd party data sources or excel files.

## Configuration Ensure that the configuration files (.secret, .secret.yml) are in the config folder.

## To deploy changes in activity servers Once all your changes have been commited to the repo, and before pushing them, run: . travis.sh

## To deploy locally Run the following commands from the root of this repository:

  • docker-compose build
  • docker-compose up

## USING virtualenv (Install virtualenv) pip install virtualenv

# Create Virtualenv virtualenv —no-site-packages venv * use no site packages to prevent virtualenv from seeing your global packages

. venv/bin/activate * allows us to just use pip from command line by adding to the path rather then full path

##Activate Virtualenv source venv/bin/activate

## Fix probable mysql path issue (for mac) export PATH=$PATH:/usr/local/mysql/bin * or whatever path you have to your installed mysql_config file in the bin folder of mysql

pip install -r requirements.txt

## Set up DB python manage.py migrate

# Run App If your using more then one settings file change manage.py to point to local or dev file first python manage.py runserver 0.0.0.0:8000 GOOGLE API sudo pip install –upgrade google-api-python-client * 0’s let it run on any local address i.e. localhost,127.0.0.1 etc.

Indicator

Endpoint

This endpoint provides access to submitted indicators in JSON format.

GET JSON List of all Indicators

Lists the programs endpoints accessible to requesting user

GET /api/indicator/

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/indicator/

Response

[
  {
    "url": "http://activity.toladata.io/api/indicator/20/",
    "name": "Number and percent of households using a financial product or service developed through SimulaKO",
    "number": "3.3",
    "source": "DFID",
    "definition": "Banko accounts opened through TabanKO that enrolled in a new financial product developed by SimulaKO and opened by Banko. This does not include HH accessing their accounts through the agent network",
    "baseline": "0",
    "lop_target": "7500",
    "means_of_verification": "Banko records",
    "data_collection_method": "reviewing banko reports and data",
    "responsible_person": "Simulako research manager",
    "method_of_analysis": "",
    "information_use": "",
    "comments": "",
    "key_performance_indicator": false,
    "create_date": "2017-02-22T18:26:12Z",
    "edit_date": "2017-02-22T18:26:12Z",
    "notes": null,
    "reporting_frequency": null,
    "sector": "http://activity.toladata.io/api/sector/4/",
    "approved_by": null,
    "approval_submitted_by": null,
    "external_service_record": null,
    "indicator_type": [
        "http://activity.toladata.io/api/indicatortype/1/"
    ],
    "level": [
        "http://activity.toladata.io/api/level/3/"
    ],
    "objectives": [],
    "strategic_objectives": [],
    "disaggregation": [],
    "program": [
        "http://activity.toladata.io/api/programs/1/"
    ]
  },
  ...
]

GET JSON List of indicator end points using limit operators

Lists the programs endpoints accesible to the requesting user based on ‘start’ and/or ‘limit’ query parameters. Use the start parameter to skip a number of records and the limit parameter to limit the number of records returned.

GET /api/indicator/?start=start_value
::
curl -H “Authorization: Token adkai39a9sdfj239m0afi2” https://activity.toladata.io/api/indicator/?start=5
GET /api/indicator/limit=limit_value
curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/indicator/?limit=2
GET /api/indicator/{pk}?start=start_value&limit=limit_value
curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/indicator/?start=3&limit=4

GET JSON List of indicator end points filter by program name

Lists the data endpoints accessible to requesting user, for the specified program name as a query parameter.

GET /api/indicator/?program_name=program_name

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/indicator/?program_name=Financial Assistance to Affected Communities

GET JSON List of indicator end points filter by program country

Lists the indicator endpoints accessible to requesting user, for the specified program country as a query parameter.

GET /api/indicator/?program_country_country=programs_country

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/indicator/?program_country_country=Afghanistan

Retrieve a specific Indicator

Provides a list of json submitted data for a specific indicator.

GET /api/indicator/{id}

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/indicator/2

Response

::
{

“url”: “http://activity.toladata.io/api/indicator/2/”, “name”: “Total number of male and female individuals participating in cash transfer programming (CTP)”, “number”: “1.1”, “source”: “Mercy Corps”, “definition”: “This is the total number of individuals included in the program, specifically per activity. For instance, total # of program participants receiving cash transfers, participating in CFW, receiving vouchers, or other activities falling under Early Economic Recovery (EER).”, “baseline”: “0”, “lop_target”: “1300”, “means_of_verification”: “”, “data_collection_method”: “”, “responsible_person”: “”, “method_of_analysis”: “”, “information_use”: “”, “comments”: “”, “key_performance_indicator”: true, “create_date”: “2017-02-22T18:26:13Z”, “edit_date”: “2017-03-09T04:46:39Z”, “notes”: “”, “reporting_frequency”: null, “sector”: “http://activity.toladata.io/api/sector/4/”, “approved_by”: null, “approval_submitted_by”: null, “external_service_record”: null, “indicator_type”: [

], “level”: [

], “objectives”: [], “strategic_objectives”: [

], “disaggregation”: [], “program”: [

]

}

Paginate data of a specific form

Returns a list of json submitted data for a specific form using page number and the number of items per page. Use the page parameter to specify page number and page_size parameter is used to set the custom page size.

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/indicator/20.json?page=1&page_size=4

Country

Endpoint

This endpoint provides access to submitted countries in JSON format.

GET JSON List of all Countries

Lists the countries endpoints accessible to requesting user

GET /api/country/

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/country/

Response

[
    {
    "url": "http://activity.toladata.io/api/country/1/",
    "country": "Afghanistan",
    "code": "AF",
    "description": "",
    "latitude": "34.5333",
    "longitude": "69.1333",
    "zoom": 5,
    "create_date": "2015-02-05T21:21:53Z",
    "edit_date": "2015-04-14T17:09:07Z",
    "organization": "http://activity.toladata.io/api/organization/1/"
    },
    ...
]

GET JSON List of countries end points using limit operators

Lists the programs endpoints accesible to the requesting user based on ‘start’ and/or ‘limit’ query parameters. Use the start parameter to skip a number of records and the limit parameter to limit the number of records returned.

GET /api/country/?start=start_value
::
curl -H “Authorization: Token adkai39a9sdfj239m0afi2” https://activity.toladata.io/api/country/?start=5
GET /api/country/limit=limit_value
curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/country/?limit=2
GET /api/country/{pk}?start=start_value&limit=limit_value
curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/country/?start=3&limit=4

Retrieve a specific Country

Provides a list of json submitted data for a specific country

GET /api/country/{id}

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/country/2

Response

::
{
“url”: “http://activity.toladata.io/api/country/2/”, “country”: “Pakistan”, “code”: “PK”, “description”: “”, “latitude”: “33.6667”, “longitude”: “73.1667”, “zoom”: 5, “create_date”: “2015-04-14T17:12:49Z”, “edit_date”: “2015-04-14T17:12:49Z”, “organization”: “http://activity.toladata.io/api/organization/1/

}

Paginate data of a specific form

Returns a list of json submitted data for a specific form using page number and the number of items per page. Use the page parameter to specify page number and page_size parameter is used to set the custom page size.

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/country.json?page=1&page_size=4

Programs

Endpoint

This endpoint provides access to submitted programs in JSON format. Where:

  • id - the form unique identifier

GET JSON List of all Programs

Lists the programs endpoints accessible to requesting user

GET /api/programs/

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/programs/

Response

[
  {
    "url": "http://activity.toladata.io/api/programs/1/",
    "gaitid": "1001",
    "name": "Financial Assistance to Affected Communities",
    "funding_status": "Funded",
    "cost_center": "12345",
    "description": "DFID Funded Cash Emergency Distribution Program",
    "create_date": "2017-02-22T18:25:37Z",
    "edit_date": "2017-06-26T15:05:39Z",
    "budget_check": true,
    "public_dashboard": true,
    "fund_code": [],
    "sector": [
        "http://activity.toladata.io/api/sector/31/",
        "http://activity.toladata.io/api/sector/32/"
    ],
    "country": [
        "http://activity.toladata.io/api/country/1/"
    ],
    "user_access": []
  },
  ...
]

GET JSON List of programs end points using limit operators

Lists the programs endpoints accesible to the requesting user based on ‘start’ and/or ‘limit’ query parameters. Use the start parameter to skip a number of records and the limit parameter to limit the number of records returned.

GET /api/programs/?start=start_value
::
curl -H “Authorization: Token adkai39a9sdfj239m0afi2” https://activity.toladata.io/api/programs/?start=5
GET /api/programs/limit=limit_value
curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/programs/?limit=2
GET /api/programs/{pk}?start=start_value&limit=limit_value
curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/programs/?start=3&limit=4

GET JSON List of data end points filter by name

Lists the data endpoints accessible to requesting user, for the specified name as a query parameter.

GET /api/programs/?name=programs_name

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/programs/?name=Financial Assistance to Affected Communities

GET JSON List of data end points filter by country

Lists the programs endpoints accessible to requesting user, for the specified country as a query parameter.

GET /api/programs/?country_country=programs_country

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/programs/?country_country=Afghanistan

Retrieve a specific Program

Provides a list of json submitted data for a specific program.

GET /api/programs/{id}

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/programs/1

Response

::
{

“url”: “http://activity.toladata.io/api/programs/1/”, “gaitid”: “1001”, “name”: “Financial Assistance to Affected Communities”, “funding_status”: “Funded”, “cost_center”: “12345”, “description”: “DFID Funded Cash Emergency Distribution Program”, “create_date”: “2017-02-22T18:25:37Z”, “edit_date”: “2017-06-26T15:05:39Z”, “budget_check”: true, “public_dashboard”: true, “fund_code”: [], “sector”: [

], “country”: [

], “user_access”: []

}

Paginate data of a specific form

Returns a list of json submitted data for a specific form using page number and the number of items per page. Use the page parameter to specify page number and page_size parameter is used to set the custom page size.

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/programs/1.json?page=1&page_size=4

Create a new Program

POST /api/programs/

Example

{
    'name': 'My Program',
    'gaitid': '1111',
    'country':  ["http://activity.toladata.io/api/country/1/"]
}

Response

    {
    "url": "http://activity.toladata.io/api/programs/588/",
    "gaitid": "1111",
    "name": "My Program",
    "funding_status": "",
    "cost_center": null,
    "description": null,
    "create_date": "2017-06-27T15:29:37Z",
    "edit_date": "2017-06-27T15:29:37Z",
    "budget_check": false,
    "public_dashboard": false,
    "fund_code": [],
    "sector": [],
    "country": [
        "http://activity.toladata.io/api/country/1/"
    ],
    "user_access": []

}

Sector

Endpoint

This endpoint provides access to submitted sectors in JSON format.

GET JSON List of all Sectors

Lists the sector endpoints accessible to requesting user

GET /api/sector/

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/sector/

Response

[
    {
    "url": "http://activity.toladata.io/api/sector/11/",
    "sector": "Agribusiness",
    "create_date": "2015-04-30T21:08:12Z",
    "edit_date": "2016-02-01T15:03:47Z"
    },
    ...
]

GET JSON List of sector end points using limit operators

Lists the programs endpoints accesible to the requesting user based on ‘start’ and/or ‘limit’ query parameters. Use the start parameter to skip a number of records and the limit parameter to limit the number of records returned.

GET /api/sector/?start=start_value
::
curl -H “Authorization: Token adkai39a9sdfj239m0afi2” https://activity.toladata.io/api/sector/?start=5
GET /api/sector/limit=limit_value
curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/sector/?limit=2
GET /api/sector/{pk}?start=start_value&limit=limit_value
curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/sector/?start=3&limit=4

Retrieve a specific Sector

Provides a list of json submitted data for a specific sector.

GET /api/sector/{id}

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/sector/22

Response

::
{
“url”: “http://activity.toladata.io/api/sector/22/”, “sector”: “Agriculture”, “create_date”: “2015-11-25T02:23:46Z”, “edit_date”: “2015-11-25T02:23:46Z”

}

Paginate data of a specific form

Returns a list of json submitted data for a specific form using page number and the number of items per page. Use the page parameter to specify page number and page_size parameter is used to set the custom page size.

Example

curl -H "Authorization: Token adkai39a9sdfj239m0afi2" https://activity.toladata.io/api/sector.json?page=1&page_size=4

Indices and tables