Extract a particular subset for a dataset

Please i will like to know how to extract a particular subset from a subset from a whole data

Hi @adepojufg and welcome to the community!

Can you elaborate by providing more details and giving some examples of how you define your particular subset?

how can i extract a subgroup of a particular datasets from my existing data file. e g the column header name is Diagnosis/Causes which has three categories : infective, traumatic, degenerative.

HOW CAN I EXTRACT ONLY THE RECORDS RELATING TO DIAGNOSIS/CAUSES FOR TRAUMATIC

@adepojufg, Please be informed that this feature of filtering and downloading your dataset is currently unavailable within the system (UI). However, you could do this by exploiting the API as outlined below:

  • Open your KoboToolbox project in a browser. Try using modern (and updated to it’s latest version) browsers like Chrome, Edge, Firefox for this.

  • Once your project is open, type in this API endpoint:

    • For Global Server:https://kf.kobotoolbox.org/api/v2/docs/?q=api/v2/assets/{uid_asset}/exports/
    • For EU Server:https://eu.kobotoolbox.org/api/v2/docs/?q=api/v2/assets/{uid_asset}/exports/
  • You should now see something like this:

  • Now, select POST as shown below:

  • Now fill up the required details (1) and (2) as shown in the image below:

    You should be able to get the uid_assetfrom the URL of your project which should be something like this:

    Image 3Modify the query section as needed:

  • {
      "fields_from_all_versions": true,
      "group_sep": "/",
      "hierarchy_in_labels": true,
      "lang": "_default",
      "multiple_select": "both",
      "type": "xls",
      "xls_types_as_text": false,
      "include_media_url": true,
      "query": {
        "Name": "Kalyan"
      }
    }
    
  • If you are trying to filter a select_one question type like Sex=Female then you may need to use this format (use the xml value instead of the label):

  • {
      "fields_from_all_versions": true,
      "group_sep": "/",
      "hierarchy_in_labels": true,
      "lang": "_default",
      "multiple_select": "both",
      "type": "xls",
      "xls_types_as_text": false,
      "include_media_url": true,
      "query": {
        "Sex": "2"
      }
    }
    
  • Especially, Name and Kalyan where Name is the variable name/question name and Kalyan is the value that should be in your dataset.

  • Once this is done, press Execute.

  • Upon pressing the Execute button, you can then go back to your project download page. There you should already see a download link ready with the query you made as shown in the screenshot below:

2 Likes