Parse contents of API data set json output
parse_api_dataset.Rd
This takes the json results output from the API and converts it into a usable data frame. It's primary use is as a helper to get_dataset and post_dataset, but can be used in isolation from those by running an API query and passing the following to parse_api_dataset(): response |> httr::content("text") |> jsonlite::fromJSON() |> parse_api_dataset()
Usage
parse_api_dataset(
api_data_result,
dataset_id,
dataset_version = NULL,
ees_environment = NULL,
api_version = NULL,
verbose = FALSE
)
Arguments
- api_data_result
A json data result list as returned from the API
- 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"
- 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
- verbose
Run with additional contextual messaging. Logical, default = FALSE
Examples
example_data_raw(group = "attendance") |>
parse_api_dataset(example_id(group = "attendance"))
#> code period geographic_level la_name la_code
#> 1 W25 2024 LA Bath and North East Somerset E06000022
#> 2 W25 2024 LA Bath and North East Somerset E06000022
#> 3 W25 2024 LA Bath and North East Somerset E06000022
#> 4 W25 2024 LA Bath and North East Somerset E06000022
#> 5 W25 2024 LA Bath and North East Somerset E06000022
#> 6 W25 2024 LA Bath and North East Somerset E06000022
#> 7 W25 2024 LA Bath and North East Somerset E06000022
#> 8 W25 2024 LA Bath and North East Somerset E06000022
#> 9 W25 2024 LA Bath and North East Somerset E06000022
#> 10 W25 2024 LA Bath and North East Somerset E06000022
#> 11 W25 2024 LA Bath and North East Somerset E06000022
#> 12 W25 2024 LA Bath and North East Somerset E06000022
#> 13 W25 2024 LA Bath and North East Somerset E06000022
#> 14 W25 2024 LA Bath and North East Somerset E06000022
#> 15 W25 2024 LA Bath and North East Somerset E06000022
#> 16 W25 2024 LA Bath and North East Somerset E06000022
#> 17 W25 2024 LA Bath and North East Somerset E06000022
#> 18 W25 2024 LA Bath and North East Somerset E06000022
#> 19 W25 2024 LA Bath and North East Somerset E06000022
#> 20 W25 2024 LA Bath and North East Somerset E06000022
#> 21 W25 2024 LA Bath and North East Somerset E06000022
#> 22 W25 2024 LA Bath and North East Somerset E06000022
#> 23 W25 2024 LA Bath and North East Somerset E06000022
#> 24 W25 2024 LA Bath and North East Somerset E06000022
#> 25 W25 2024 LA Bath and North East Somerset E06000022
#> 26 W25 2024 LA Bath and North East Somerset E06000022
#> 27 W25 2024 LA Bath and North East Somerset E06000022
#> 28 W25 2024 LA Bath and North East Somerset E06000022
#> 29 W25 2024 LA Bath and North East Somerset E06000022
#> 30 W25 2024 LA Bath and North East Somerset E06000022
#> 31 W25 2024 LA Bath and North East Somerset E06000022
#> 32 W25 2024 LA Bath and North East Somerset E06000022
#> la_oldCode nat_name nat_code reg_name reg_code attendance_status
#> 1 800 England E92000001 South West E12000009 Attendance
#> 2 800 England E92000001 South West E12000009 Attendance
#> 3 800 England E92000001 South West E12000009 Attendance
#> 4 800 England E92000001 South West E12000009 Absence
#> 5 800 England E92000001 South West E12000009 Absence
#> 6 800 England E92000001 South West E12000009 Absence
#> 7 800 England E92000001 South West E12000009 Late sessions
#> 8 800 England E92000001 South West E12000009 Possible sessions
#> 9 800 England E92000001 South West E12000009 Attendance
#> 10 800 England E92000001 South West E12000009 Attendance
#> 11 800 England E92000001 South West E12000009 Attendance
#> 12 800 England E92000001 South West E12000009 Attendance
#> 13 800 England E92000001 South West E12000009 Absence
#> 14 800 England E92000001 South West E12000009 Absence
#> 15 800 England E92000001 South West E12000009 Absence
#> 16 800 England E92000001 South West E12000009 Absence
#> 17 800 England E92000001 South West E12000009 Absence
#> 18 800 England E92000001 South West E12000009 Absence
#> 19 800 England E92000001 South West E12000009 Absence
#> 20 800 England E92000001 South West E12000009 Absence
#> 21 800 England E92000001 South West E12000009 Attendance
#> 22 800 England E92000001 South West E12000009 Not a possible session
#> 23 800 England E92000001 South West E12000009 Attendance
#> 24 800 England E92000001 South West E12000009 Attendance
#> 25 800 England E92000001 South West E12000009 Attendance
#> 26 800 England E92000001 South West E12000009 Absence
#> 27 800 England E92000001 South West E12000009 Absence
#> 28 800 England E92000001 South West E12000009 Absence
#> 29 800 England E92000001 South West E12000009 Absence
#> 30 800 England E92000001 South West E12000009 Administrative code
#> 31 800 England E92000001 South West E12000009 Not a possible session
#> 32 800 England E92000001 South West E12000009 Administrative code
#> attendance_type day_number education_phase
#> 1 Present 1 Special
#> 2 Approved educational activity 1 Special
#> 3 Total 1 Special
#> 4 Total 1 Special
#> 5 Authorised 1 Special
#> 6 Unauthorised 1 Special
#> 7 Total 1 Special
#> 8 Total 1 Special
#> 9 Present 1 Special
#> 10 Present 1 Special
#> 11 Present 1 Special
#> 12 Late 1 Special
#> 13 Authorised 1 Special
#> 14 Authorised 1 Special
#> 15 Authorised 1 Special
#> 16 Authorised 1 Special
#> 17 Authorised 1 Special
#> 18 Authorised 1 Special
#> 19 Authorised 1 Special
#> 20 Authorised 1 Special
#> 21 Approved educational activity 1 Special
#> 22 Total 1 Special
#> 23 Approved educational activity 1 Special
#> 24 Approved educational activity 1 Special
#> 25 Approved educational activity 1 Special
#> 26 Unauthorised 1 Special
#> 27 Unauthorised 1 Special
#> 28 Unauthorised 1 Special
#> 29 Unauthorised 1 Special
#> 30 Administrative code 1 Special
#> 31 Total 1 Special
#> 32 Administrative code 1 Special
#> attendance_reason session_count
#> 1 Total 438
#> 2 Total 22
#> 3 Total 460
#> 4 Total 78
#> 5 Total 50
#> 6 Total 28
#> 7 Total 9
#> 8 Total 538
#> 9 Present am 214
#> 10 Present pm 219
#> 11 Present 433
#> 12 L present late before registers closed 5
#> 13 I authorised illness 24
#> 14 M authorised medical dental 6
#> 15 R authorised religious observance 0
#> 16 S authorised study leave 0
#> 17 T authorised grt absence 0
#> 18 H authorised holiday 14
#> 19 E authorised excluded 0
#> 20 C authorised other 6
#> 21 B education off site 15
#> 22 D dual registration 0
#> 23 P approved sporting activity 0
#> 24 V educational visit trip 7
#> 25 W work experience 0
#> 26 G unauthorised holiday 8
#> 27 U unauthorised late after registers closed 4
#> 28 O other unauthorised 16
#> 29 N no reason yet 0
#> 30 Not attending planned closed 0
#> 31 Y not attending enforced closure 0
#> 32 Z not attending not on roll 0