Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label extraction on data_viewset.py #515

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mgogh
Copy link

@mgogh mgogh commented Jan 21, 2019

Add on the route: /api/v1/data/{pk}/{dataid} a parameter allowing to extract labels only (for data use).
It will replace "name" fields by there labels saved on the xform.

xform -> {
         "Sexe": {
                  "name": "F",
                  "label": "Woman"
         }
}

Ex: /api/v1/data/1/3?label=true

{
         "_id": 4503,
         "_bamboo_dataset_id": "",
         "_deleted_at": null,
         "expense_type": "service",
         "_xform_id_string": "exp",
         "_geolocation": [
                  null,
                  null
         ],
         "end": "2013-01-03T10:26:25.674+03",
         "start": "2013-01-03T10:25:17.409+03",
         "expense_date": "2011-12-23",
         "Sexe": "Woman"
}

/api/v1/data/1/3?label=false

{
         "_id": 4503,
         "_bamboo_dataset_id": "",
         "_deleted_at": null,
         "expense_type": "service",
         "_xform_id_string": "exp",
         "_geolocation": [
                  null,
                  null
         ],
         "end": "2013-01-03T10:26:25.674+03",
         "start": "2013-01-03T10:25:17.409+03",
         "expense_date": "2011-12-23",
         "Sexe": "F"
}

Add on the route: /api/v1/data/{pk}/{dataid} a parameter allowing to extract labels only (for data use).
It will replace "name" fields by there labels saved on the xform.

Ex: /api/v1/data/1/3?label=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant