Skip to contents

This function provides a method for generating and sending a json based data query to the EES API. As a minimum, it requires the dataset_id flag and either the indicators flag or a json file containing a query to be provided.

Usage

post_dataset(
  dataset_id,
  indicators = NULL,
  time_periods = NULL,
  geographies = NULL,
  filter_items = NULL,
  json_query = NULL,
  dataset_version = NULL,
  ees_environment = NULL,
  api_version = NULL,
  page = NULL,
  page_size = 10000,
  parse = TRUE,
  debug = FALSE,
  verbose = FALSE
)

Arguments

dataset_id

ID of data set to be connected to. This is required if the endpoint is one of "get-summary", "get-meta", "get-csv", "get-data" or "post-data"

indicators

Indicators required as a string or vector of strings (required)

time_periods

Time periods required as a string ("period|code") or vector of strings

geographies

String, vector or data frame containing the geographic levels and locations to be queried.

filter_items

Filter items required as a string or vector of strings

json_query

Optional path to a json file containing the query parameters

dataset_version

Version of data set to be connected to

ees_environment

EES ees_environment to connect to: "dev", "test", "preprod" or "prod"

api_version

EES API version

page

Page number of query results to return

page_size

Number of results to return in a single query

parse

Logical flag to activate parsing of the results. Default: TRUE

debug

Run POST query in debug mode. Logical, default = FALSE

verbose

Run with additional contextual messaging. Logical, default = FALSE

Value

Data frame containing query results of an API data set

Examples

post_dataset(
  example_id(group = "attendance"),
  json_query = example_json_query()
)
#>   code period geographic_level nat_name  nat_code   reg_name  reg_code
#> 1  W23   2024              REG  England E92000001 North East E12000001
#> 2  W23   2024              REG  England E92000001 North East E12000001
#> 3  W23   2024              REG  England E92000001 North West E12000002
#> 4  W23   2024              REG  England E92000001 North West E12000002
#> 5  W23   2024              REG  England E92000001 North East E12000001
#> 6  W23   2024              REG  England E92000001 North East E12000001
#> 7  W23   2024              REG  England E92000001 North West E12000002
#> 8  W23   2024              REG  England E92000001 North West E12000002
#>   attendance_status attendance_type day_number education_phase
#> 1           Absence      Authorised      Total       Secondary
#> 2           Absence    Unauthorised      Total       Secondary
#> 3           Absence      Authorised      Total       Secondary
#> 4           Absence    Unauthorised      Total       Secondary
#> 5           Absence      Authorised      Total           Total
#> 6           Absence    Unauthorised      Total           Total
#> 7           Absence      Authorised      Total           Total
#> 8           Absence    Unauthorised      Total           Total
#>   attendance_reason session_count
#> 1             Total         53326
#> 2             Total         64441
#> 3             Total        152262
#> 4             Total        167394
#> 5             Total        107165
#> 6             Total        117871
#> 7             Total        273327
#> 8             Total        273633

# Run post_dataset() to select rows containing either of two geographic locations and a single
# filter item.
post_dataset(
  example_id(group = "attendance"),
  indicators = example_id("indicator", group = "attendance"),
  time_periods = example_id("time_period", group = "attendance"),
  geographies = example_id("location_code", group = "attendance"),
  filter_items = example_id("filter_item", group = "attendance"),
  page = 1,
  page_size = 32
)
#>    code period geographic_level nat_name  nat_code attendance_status
#> 1   W23   2024              NAT  England E92000001           Absence
#> 2   W23   2024              NAT  England E92000001           Absence
#> 3   W23   2024              NAT  England E92000001           Absence
#> 4   W23   2024              NAT  England E92000001           Absence
#> 5   W23   2024              NAT  England E92000001           Absence
#> 6   W23   2024              NAT  England E92000001           Absence
#> 7   W23   2024              NAT  England E92000001           Absence
#> 8   W23   2024              NAT  England E92000001           Absence
#> 9   W23   2024              NAT  England E92000001           Absence
#> 10  W23   2024              NAT  England E92000001           Absence
#> 11  W23   2024              NAT  England E92000001           Absence
#> 12  W23   2024              NAT  England E92000001           Absence
#> 13  W23   2024              NAT  England E92000001           Absence
#> 14  W23   2024              NAT  England E92000001           Absence
#> 15  W23   2024              NAT  England E92000001           Absence
#> 16  W23   2024              NAT  England E92000001           Absence
#> 17  W23   2024              NAT  England E92000001           Absence
#> 18  W23   2024              NAT  England E92000001           Absence
#> 19  W23   2024              NAT  England E92000001           Absence
#> 20  W23   2024              NAT  England E92000001           Absence
#> 21  W23   2024              NAT  England E92000001           Absence
#> 22  W23   2024              NAT  England E92000001           Absence
#> 23  W23   2024              NAT  England E92000001           Absence
#> 24  W23   2024              NAT  England E92000001           Absence
#>    attendance_type day_number education_phase      attendance_reason
#> 1     Unauthorised          1         Special G unauthorised holiday
#> 2     Unauthorised          1         Primary G unauthorised holiday
#> 3     Unauthorised          1       Secondary G unauthorised holiday
#> 4     Unauthorised          2         Special G unauthorised holiday
#> 5     Unauthorised          2         Primary G unauthorised holiday
#> 6     Unauthorised          2       Secondary G unauthorised holiday
#> 7     Unauthorised          3       Secondary G unauthorised holiday
#> 8     Unauthorised          3         Special G unauthorised holiday
#> 9     Unauthorised          3         Primary G unauthorised holiday
#> 10    Unauthorised          4       Secondary G unauthorised holiday
#> 11    Unauthorised          4         Primary G unauthorised holiday
#> 12    Unauthorised          4         Special G unauthorised holiday
#> 13    Unauthorised          5       Secondary G unauthorised holiday
#> 14    Unauthorised          5         Special G unauthorised holiday
#> 15    Unauthorised          5         Primary G unauthorised holiday
#> 16    Unauthorised      Total         Special G unauthorised holiday
#> 17    Unauthorised      Total         Primary G unauthorised holiday
#> 18    Unauthorised      Total       Secondary G unauthorised holiday
#> 19    Unauthorised          2           Total G unauthorised holiday
#> 20    Unauthorised          3           Total G unauthorised holiday
#> 21    Unauthorised          4           Total G unauthorised holiday
#> 22    Unauthorised          5           Total G unauthorised holiday
#> 23    Unauthorised      Total           Total G unauthorised holiday
#> 24    Unauthorised          1           Total G unauthorised holiday
#>    session_count
#> 1           1574
#> 2          84811
#> 3          44458
#> 4           1443
#> 5          98308
#> 6          37788
#> 7          33274
#> 8           1372
#> 9          86219
#> 10         29610
#> 11         75852
#> 12          1345
#> 13         29339
#> 14          1410
#> 15         77983
#> 16          7144
#> 17        423173
#> 18        174469
#> 19        137539
#> 20        120865
#> 21        106807
#> 22        108732
#> 23        604786
#> 24        130843