---
title: "Introduction to hansard"
author: "Evan Odell"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Introduction to hansard}
%\VignetteEngine{knitr::rmarkdown}
\usepackage[utf8]{inputenc}
---
`hansard` is an R package to pull data from the UK parliament through the
73 clinical commissioning groups (CCGs) applied for Wave 2 funding under the diabetes prevention programme. Their bids were made as part of collaborative arrangements involving several CCGs, and not all CCGs will implement the programme at the same pace.
The estimated total cost of implementing the diabetes prevention programme to date, covering the wave 1 areas, is £12 million. Actual payments are dependent on the performance of providers. The details of these contracts are shown in the attached table. Contracts for Wave 2 are due to be approved and awarded in March 2017.
The attached table shows the lead CCGs that have applied for diabetes transformation funding for any of the following interventions (this does not include details of all CCGs that are involved with bids, as in some cases many CCGs collaborated to deliver a project):
- improving uptake of structured education for people with diabetes;
- improving the achievement of the treatment targets recommended by the National Institute for Health and Care Excellence;
- new or expanded multi-disciplinary footcare teams; and
- new or expanded diabetes inpatient specialist nursing services.
", "73 clinical commissioning groups (CCGs) applied for Wave 2 funding under the diabetes prevention programme. Their bids were made as part of collaborative arrangements involving several CCGs, and not all CCGs will implement the programme at the same pace.
The estimated total cost of implementing the diabetes prevention programme to date, covering the wave 1 areas, is £12 million. Actual payments are dependent on the performance of providers. The details of these contracts are shown in the attached table. Contracts for Wave 2 are due to be approved and awarded in March 2017.
The attached table shows the lead CCGs that have applied for diabetes transformation funding for any of the following interventions (this does not include details of all CCGs that are involved with bids, as in some cases many CCGs collaborated to deliver a project):
- improving uptake of structured education for people with diabetes;
- improving the achievement of the treatment targets recommended by the National Institute for Health and Care Excellence;
- new or expanded multi-disciplinary footcare teams; and
- new or expanded diabetes inpatient specialist nursing services.
", "73 clinical commissioning groups (CCGs) applied for Wave 2 funding under the diabetes prevention programme. Their bids were made as part of collaborative arrangements involving several CCGs, and not all CCGs will implement the programme at the same pace.
The estimated total cost of implementing the diabetes prevention programme to date, covering the wave 1 areas, is £12 million. Actual payments are dependent on the performance of providers. The details of these contracts are shown in the attached table. Contracts for Wave 2 are due to be approved and awarded in March 2017.
The attached table shows the lead CCGs that have applied for diabetes transformation funding for any of the following interventions (this does not include details of all CCGs that are involved with bids, as in some cases many CCGs collaborated to deliver a project):
- improving uptake of structured education for people with diabetes;
- improving the achievement of the treatment targets recommended by the National Institute for Health and Care Excellence;
- new or expanded multi-disciplinary footcare teams; and
- new or expanded diabetes inpatient specialist nursing services.
", "General practitioners are paid £9.80 for each dose of influenza vaccine that they administer to eligible patients under the General Medical Services contract 2016/17.
Participating pharmacists are paid a total of £9.14 for each dose of the influenza vaccine that they administer to eligible patients under the national Influenza Adult Vaccination Service delivered through the Community Pharmacy Contractual Framework for 2016/17.
", "General practitioners are paid £9.80 for each dose of influenza vaccine that they administer to eligible patients under the General Medical Services contract 2016/17.
Participating pharmacists are paid a total of £9.14 for each dose of the influenza vaccine that they administer to eligible patients under the national Influenza Adult Vaccination Service delivered through the Community Pharmacy Contractual Framework for 2016/17.
", "In 2016/17, NHS England funded local health economies with a total of £1,474,500 to support implementation activities and costs relating to the NHS Diabetes Prevention Programme (NHS DPP). Health economies are partnerships of clinical commissioning groups and local authorities.
NHS England has also nationally commissioned the NHS DPP behavioural interventions that are provided to local health economies.
", "The NHS Diabetes Prevention Programme (NHS DPP) is for individuals diagnosed as high risk of type 2 diabetes, with a high blood sugar recorded in the past 12 months either through a National Health Service health check or other means. NHS DPP does not test for diabetes but rather offers support to those at risk of type 2 diabetes.
", "The mean and median average length of stay for hospital patients with a primary diagnosis for diabetes and a primary or secondary diagnosis of diabetes in England for 2015/16 are shown in the table below.
| Mean Length of stay (days) | Median length of stay (days) |
Primary diagnosis of diabetes | 3 | 1 |
Primary and secondary diagnosis of diabetes | 4 | 1 |
A count of finished admission episodes where patients have been admitted from accident and emergency with a primary diagnosis for diabetes and arrived to accident and emergency by ambulance in England and within East Leicestershire and Rutland, Leicester City and West Leicestershire clinical commissioning groups (CCGs) areas of residence for 2015/16 are provided in the following table.
| Primary diagnosis admissions for diabetes | Admissions for diabetes who arrived by ambulance |
England | 27,201 | 16,937 |
East Leicestershire and Rutland CCG | 90 | 62 |
Leicester City CCG | 174 | 130 |
West Leicestershire CCG | 110 | 70 |
Data on how many diabetic patients experienced complications with that condition, separate from the reason for their admittance, while they were in hospital as inpatients is not available in the format requested.
Data on the number of ambulance call-outs for patients experiencing diabetic complications in 2016 is not available in the format requested.
Approximately 240 bids have been received for National Health Service transformation funding for diabetes prevention and treatment.
", "The mean and median average length of stay for hospital patients with a primary diagnosis for diabetes and a primary or secondary diagnosis of diabetes in England for 2015/16 are shown in the table below.
| Mean Length of stay (days) | Median length of stay (days) |
Primary diagnosis of diabetes | 3 | 1 |
Primary and secondary diagnosis of diabetes | 4 | 1 |
A count of finished admission episodes where patients have been admitted from accident and emergency with a primary diagnosis for diabetes and arrived to accident and emergency by ambulance in England and within East Leicestershire and Rutland, Leicester City and West Leicestershire clinical commissioning groups (CCGs) areas of residence for 2015/16 are provided in the following table.
| Primary diagnosis admissions for diabetes | Admissions for diabetes who arrived by ambulance |
England | 27,201 | 16,937 |
East Leicestershire and Rutland CCG | 90 | 62 |
Leicester City CCG | 174 | 130 |
West Leicestershire CCG | 110 | 70 |
Data on how many diabetic patients experienced complications with that condition, separate from the reason for their admittance, while they were in hospital as inpatients is not available in the format requested.
Data on the number of ambulance call-outs for patients experiencing diabetic complications in 2016 is not available in the format requested.
Approximately 240 bids have been received for National Health Service transformation funding for diabetes prevention and treatment.
", "The mean and median average length of stay for hospital patients with a primary diagnosis for diabetes and a primary or secondary diagnosis of diabetes in England for 2015/16 are shown in the table below.
| Mean Length of stay (days) | Median length of stay (days) |
Primary diagnosis of diabetes | 3 | 1 |
Primary and secondary diagnosis of diabetes | 4 | 1 |
A count of finished admission episodes where patients have been admitted from accident and emergency with a primary diagnosis for diabetes and arrived to accident and emergency by ambulance in England and within East Leicestershire and Rutland, Leicester City and West Leicestershire clinical commissioning groups (CCGs) areas of residence for 2015/16 are provided in the following table.
| Primary diagnosis admissions for diabetes | Admissions for diabetes who arrived by ambulance |
England | 27,201 | 16,937 |
East Leicestershire and Rutland CCG | 90 | 62 |
Leicester City CCG | 174 | 130 |
West Leicestershire CCG | 110 | 70 |
Data on how many diabetic patients experienced complications with that condition, separate from the reason for their admittance, while they were in hospital as inpatients is not available in the format requested.
Data on the number of ambulance call-outs for patients experiencing diabetic complications in 2016 is not available in the format requested.
Approximately 240 bids have been received for National Health Service transformation funding for diabetes prevention and treatment.
", "The mean and median average length of stay for hospital patients with a primary diagnosis for diabetes and a primary or secondary diagnosis of diabetes in England for 2015/16 are shown in the table below.
| Mean Length of stay (days) | Median length of stay (days) |
Primary diagnosis of diabetes | 3 | 1 |
Primary and secondary diagnosis of diabetes | 4 | 1 |
A count of finished admission episodes where patients have been admitted from accident and emergency with a primary diagnosis for diabetes and arrived to accident and emergency by ambulance in England and within East Leicestershire and Rutland, Leicester City and West Leicestershire clinical commissioning groups (CCGs) areas of residence for 2015/16 are provided in the following table.
| Primary diagnosis admissions for diabetes | Admissions for diabetes who arrived by ambulance |
England | 27,201 | 16,937 |
East Leicestershire and Rutland CCG | 90 | 62 |
Leicester City CCG | 174 | 130 |
West Leicestershire CCG | 110 | 70 |
Data on how many diabetic patients experienced complications with that condition, separate from the reason for their admittance, while they were in hospital as inpatients is not available in the format requested.
Data on the number of ambulance call-outs for patients experiencing diabetic complications in 2016 is not available in the format requested.
Approximately 240 bids have been received for National Health Service transformation funding for diabetes prevention and treatment.
", "The mean and median average length of stay for hospital patients with a primary diagnosis for diabetes and a primary or secondary diagnosis of diabetes in England for 2015/16 are shown in the table below.
| Mean Length of stay (days) | Median length of stay (days) |
Primary diagnosis of diabetes | 3 | 1 |
Primary and secondary diagnosis of diabetes | 4 | 1 |
A count of finished admission episodes where patients have been admitted from accident and emergency with a primary diagnosis for diabetes and arrived to accident and emergency by ambulance in England and within East Leicestershire and Rutland, Leicester City and West Leicestershire clinical commissioning groups (CCGs) areas of residence for 2015/16 are provided in the following table.
| Primary diagnosis admissions for diabetes | Admissions for diabetes who arrived by ambulance |
England | 27,201 | 16,937 |
East Leicestershire and Rutland CCG | 90 | 62 |
Leicester City CCG | 174 | 130 |
West Leicestershire CCG | 110 | 70 |
Data on how many diabetic patients experienced complications with that condition, separate from the reason for their admittance, while they were in hospital as inpatients is not available in the format requested.
Data on the number of ambulance call-outs for patients experiencing diabetic complications in 2016 is not available in the format requested.
Approximately 240 bids have been received for National Health Service transformation funding for diabetes prevention and treatment.
", "The mean and median average length of stay for hospital patients with a primary diagnosis for diabetes and a primary or secondary diagnosis of diabetes in England for 2015/16 are shown in the table below.
| Mean Length of stay (days) | Median length of stay (days) |
Primary diagnosis of diabetes | 3 | 1 |
Primary and secondary diagnosis of diabetes | 4 | 1 |
A count of finished admission episodes where patients have been admitted from accident and emergency with a primary diagnosis for diabetes and arrived to accident and emergency by ambulance in England and within East Leicestershire and Rutland, Leicester City and West Leicestershire clinical commissioning groups (CCGs) areas of residence for 2015/16 are provided in the following table.
| Primary diagnosis admissions for diabetes | Admissions for diabetes who arrived by ambulance |
England | 27,201 | 16,937 |
East Leicestershire and Rutland CCG | 90 | 62 |
Leicester City CCG | 174 | 130 |
West Leicestershire CCG | 110 | 70 |
Data on how many diabetic patients experienced complications with that condition, separate from the reason for their admittance, while they were in hospital as inpatients is not available in the format requested.
Data on the number of ambulance call-outs for patients experiencing diabetic complications in 2016 is not available in the format requested.
Approximately 240 bids have been received for National Health Service transformation funding for diabetes prevention and treatment.
", "The National Institute for Health and Clinical Excellence Guidance NG3, as updated in August 2015, covers the care of diabetic patients who are pregnant, and patients with gestational diabetes. The guidance can be found here:
https://www.nice.org.uk/guidance/ng3
In addition, there is a specific module of the National Diabetes Audit – the Diabetes and Pregnancy Audit that audits quality of care (including pre-conception care) and outcomes for those who have Type 1 or Type 2 diabetes and are pregnant. Further information on the audit can be found here:
http://content.digital.nhs.uk/npid
", "The National Institute for Health and Clinical Excellence Guidance NG3, as updated in August 2015, covers the care of diabetic patients who are pregnant, and patients with gestational diabetes. The guidance can be found here:
https://www.nice.org.uk/guidance/ng3
In addition, there is a specific module of the National Diabetes Audit – the Diabetes and Pregnancy Audit that audits quality of care (including pre-conception care) and outcomes for those who have Type 1 or Type 2 diabetes and are pregnant. Further information on the audit can be found here:
http://content.digital.nhs.uk/npid
", "The information is not available in the format requested.
", "The Secretary of State for Justice last met with the Prison Officers Association (POA) on 10th January 2017.
", "The budget of HM Prison Maidstone for 2017-18 has not yet been set. Discussions on the prison’s Performance Agreement 2017-18 which will include its budget are due to conclude by 31 March 2017
The budget of HM Prison Maidstone does not presently include provision for prisoner education as this is made through the central Offender Learning & Skills Service. In future that funding will be devolved to the prison under the changes proposed in the White Paper Prison Safety & Reform. In its present 2016-17 budget the prison has provision of 0.32% of the total budget for prisoner recreation.
", "
The budget of HM Prison Maidstone for 2017-18 has not yet been set. Discussions on the prison’s Performance Agreement 2017-18 which will include its budget are due to conclude by 31 March 2017
The budget of HM Prison Maidstone does not presently include provision for prisoner education as this is made through the central Offender Learning & Skills Service. In future that funding will be devolved to the prison under the changes proposed in the White Paper Prison Safety & Reform. In its present 2016-17 budget the prison has provision of 0.32% of the total budget for prisoner recreation.
", "
The budget of HM Prison Huntercombe for 2017-18 has not yet been set. Discussions on the prison’s Performance Agreement 2017-18 which will include its budget are due to conclude by 31 March 2017.
The budget of HM Prison Huntercombe does not presently include provision for prisoner education as this is made through the central Offender Learning & Skills Service. In future that funding will be devolved to the prison under the changes proposed in the White Paper Prison Safety & Reform. In its present 2016-17 budget the prison has provision of 0.15% of the total budget for prisoner recreation.
", "The budget of HM Prison Huntercombe for 2017-18 has not yet been set. Discussions on the prison’s Performance Agreement 2017-18 which will include its budget are due to conclude by 31 March 2017.
The budget of HM Prison Huntercombe does not presently include provision for prisoner education as this is made through the central Offender Learning & Skills Service. In future that funding will be devolved to the prison under the changes proposed in the White Paper Prison Safety & Reform. In its present 2016-17 budget the prison has provision of 0.15% of the total budget for prisoner recreation.
", "This data is published quarterly on gov.uk. The data as at 31 December 2016 is scheduled to be published on 26 January 2017.
", "The Government believes that prisons should be places of safety and reform. As part of this, reducing the incidence of suicide is a key priority. Our recent White Paper sets out the specific steps that we are taking to improve safety. They include investing over £100m to recruit an additional 2,500 staff across the estate by the end of 2018. The National Offender Management Service has launched a suicide and self-harm reduction project, led by an experienced prison governor, which is driving work in this area. This includes implementing the recommendations of a review of the Assessment, Care in Custody and Teamwork (ACCT) process, the multi-disciplinary case management process that is the main tool for managing prisoners at risk of suicide and self-harm. Providing the right intervention and treatment is vital to improving the outcomes for people who are in distress, and all prisons have established procedures in place to identify, manage and support people at risk of suicide or self-harm. But we recognise that more can be done. That is why we have invested in specialist mental health training for prison officers and allocated more funding for prison safety. These improvements and reforms will benefit prisoners who are vulnerable, suffering from mental health problems or at risk of committing suicide.") answering_member_about <- c(rep("4019", 16), rep("3980", 7)) answering_member_label_value <- c(rep("Biography information for Baroness Blackwood of North Oxford", 16), rep("Biography information for Mr Sam Gyimah", 7)) answering_member_constituency_value <- c(rep("Oxford West and Abingdon", 16), rep("East Surrey", 7)) answering_member_printed_value <- c("Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Nicola Blackwood", "Mr Sam Gyimah", "Mr Sam Gyimah", "Mr Sam Gyimah", "Mr Sam Gyimah", "Mr Sam Gyimah", "Mr Sam Gyimah", "Mr Sam Gyimah") date_of_answer_value <- as.POSIXct(c("2017-03-07", "2017-03-07", "2017-03-07", "2017-01-27", "2017-01-27", "2017-01-27", "2017-01-24", "2017-01-20", "2017-01-20", "2017-01-20", "2017-01-20", "2017-01-20", "2017-01-20", "2017-01-19", "2017-01-19", "2017-01-18", "2017-03-07", "2017-02-13", "2017-02-13", "2017-02-13", "2017-02-13", "2017-01-23", "2017-01-13")) answer_date_time <- as.POSIXct(c(1488906939.89, 1488906939.953, 1488906940.013, 1485519348.847, 1485519348.897, 1485517489.11, 1485275067.01, 1484920109.533, 1484920109.593, 1484920109.673, 1484920109.737, 1484920109.813, 1484920109.453, 1484827382.323, 1484827382.4, 1484740917.15, 1488907643.557, 1486991285.387, 1486991285.433, 1486991718.683, 1486991718.763, 1485184936.807, 1484320085.87), origin = "1970-01-01") date_of_answer_datatype <- c(rep("POXIXct", 23)) is_ministerial_correction_value <- c(rep("false", 23)) is_ministerial_correction_datatype <- c(rep("boolean", 23)) answering_dept_id_value <- c(rep("17", 16), rep("54", 7)) answering_dept_short_name_value <- c(rep("Health", 16), rep("Justice", 7)) answering_dept_sort_name_value <- c(rep("Health", 16), rep("Justice", 7)) date_value <- c("2017-02-27", "2017-02-27", "2017-02-27", "2017-01-24", "2017-01-24", "2017-01-19", "2017-01-19", "2017-01-12", "2017-01-12", "2017-01-12", "2017-01-12", "2017-01-12", "2017-01-12", "2017-01-12", "2017-01-12", "2017-01-11", "2017-02-27", "2017-01-26", "2017-01-26", "2017-01-26", "2017-01-26", "2017-01-11", "2016-12-19") date_datatype <- c("dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime", "dateTime") hansard_heading_value <- c("Diabetes", "Diabetes", "Diabetes", "Influenza: Vaccination", "Influenza: Vaccination", "Diabetes: Health Education", "Diabetes: Screening", "Diabetes", "Diabetes", "Diabetes", "Diabetes", "Diabetes", "Diabetes: Leicester", "Diabetes: Pregnancy", "Diabetes: Pregnancy", "Diabetes", "Prison Officers Association", "Maidstone Prison", "Maidstone Prison", "Huntercombe Prison", "Huntercombe Prison", "Prisoners: Foreign Nationals", "Prisoners: Suicide") house_id_value <- c(rep("1", 23)) registered_interest_value <- c(rep("false", 23)) registered_interest_datatype <- c(rep("boolean", 23)) tabling_member_about <- c(rep("338", 22), "172") tabling_member_label_value <- c(rep("Biography information for Keith Vaz", 22), "Biography information for Ms Diane Abbott") tabling_member_constituency_value <- c(rep("Leicester East", 22), "Hackney North and Stoke Newington") legislature_pref_label_value<- c(rep("House of Commons", 23)) legislature_about <- c(rep("25259", 23)) w <- tibble::tibble(about, answering_body, question_text, tabling_member_printed, uin,attachment, grouped_question_uin, answer_text_value, answering_member_about, answering_member_label_value, answering_member_constituency_value,answering_member_printed_value, date_of_answer_value, answer_date_time, date_of_answer_datatype, is_ministerial_correction_value, is_ministerial_correction_datatype, answering_dept_id_value, answering_dept_short_name_value, answering_dept_sort_name_value, date_value, date_datatype, hansard_heading_value, house_id_value, registered_interest_value, registered_interest_datatype, tabling_member_about, tabling_member_label_value, tabling_member_constituency_value, legislature_pref_label_value, legislature_about) tibble::glimpse(w) ``` ### Special functions Several functions have special or experimental features: * `research_briefings_lists()` An experimental feature that creates lists of possible parameters, and allows the user to call to the API based on the content of the list. Currently only available with the `research_briefings_lists` function. * `hansard_generic()` A basic wrapper function for any of the available APIs. Users must specify the exact path they want the function to call from, and must also specify JSON formatting. * `members_search()` A search function for members of the House of Commons and House of Lords. ### The `research_briefings()` function The `research_briefings()` function includes the feature of requesting data using lists created using the `research_briefings_lists` functions: ```{r eval=FALSE, message=TRUE, warning=FALSE} research_topics_list <- research_topics_list() research_topics_list[[7]] ``` ```{r echo=FALSE} research_topics_list <- list("Agriculture, animals, food and rural affairs", "Asylum, immigration and nationality", "Business, industry and consumers", "Communities and families", "Crime, civil law, justice and rights", "Culture, media and sport", "Defence", "Economy and finance", "Education", "Employment and training", "Energy and environment", "European Union", "Health services and medicine", "Housing and planning", "International affairs", "Parliament, government and politics", "Science and technology", "Social Security and pensions", "Social services", "Transport") research_topics_list[[7]] ``` In this case I have given them the same name as their function, but you can assign any name you wish to them. Having created the lists, they can be used to specify which topics and subtopics to call, although strings can also be used. In the example below, `a` and `c` contain the same data. ```{r echo=TRUE, eval=FALSE, message=TRUE, warning=FALSE} a <- research_briefings(topic = research_topics_list[[7]]) c <- research_briefings(topic = "Defence") ``` If a specific subtopic is called, but the topic is not specified, the function will still return all data within that specific subtopic. Note that this is slower than specifying the topic and subtopic. If a specified subtopic is not a subtopic of the specified topic, the function will not return any data. ### The `hansard_generic()` function The `hansard_generic()` function allows you to put in your own paths to the API. Information on all the paths available in the API can be found on the [DDP Explorer website](http://explore.data.parliament.uk/). ```{r, eval=FALSE} x <- hansard_generic("commonsansweredquestions.json") ``` Note that the API defaults to returning 10 items per page, but allows up to 500 items per page, the default used by `hansard`.