Skip to contents

All functions

add_activity_after_death_flag()
Match on BOXI NRS death dates to process activity after death flag
add_acute_columns()
Add Acute columns
add_ae_columns()
Add AE columns
add_age_group()
add_age_group
add_all_columns()
Add all columns
add_at_columns()
Add AT columns
add_ch_columns()
Add CH columns
add_cij_columns()
Add CIJ-related columns
add_cmh_columns()
Add CMH columns
add_dd_columns()
Add DD columns
add_dn_columns()
Add DN columns
add_gls_columns()
Add GLS columns
add_hc_columns()
Add HC columns
add_hl1_columns()
Add HL1 columns
add_homelessness_date_flags()
Add homelessness date flags episode
add_homelessness_flag()
Add 'homelessness in FY' flag
add_hri_variables()
Add HRI variables to an SLF Individual File
add_ipdc_cols()
Add columns based on IPDC
add_keep_population_flag()
Add keep_popluation flag
add_mat_columns()
Add Mat columns
add_mh_columns()
Add MH columns
add_nrs_columns()
Add NRS columns
add_nsu_cohort()
Add NSU cohort to working file
add_nsu_columns()
Add NSU columns
add_ooh_columns()
Add OoH columns
add_op_columns()
Add OP columns
add_operation_flag()
Add operation flag
add_pis_columns()
Add PIS columns
add_ppa_flag()
Add Potentially Preventable Admission (PPA) Marker
add_sds_columns()
Add SDS columns
add_smrtype()
Add smrtype variable based on record ID
add_standard_cols()
Add standard columns
aggregate_by_chi()
Aggregate by CHI
aggregate_ch_episodes()
Aggregate Care Home episodes to ch_cis
apply_cost_uplift()
Uplift costs
assign_cohort_names()
Assign service use cohort into string format
assign_death_flag()
Assign a flag for deaths
assign_d_cohort_mh() assign_d_cohort_frailty() assign_d_cohort_maternity() assign_d_cohort_high_cc() assign_d_cohort_medium_cc() assign_d_cohort_low_cc() assign_d_cohort_comm_living() assign_d_cohort_adult_major() assign_d_cohort_child_major() assign_d_cohort_eol() assign_d_cohort_substance()
Assign Mental Health cohort
assign_elective_daycase_instances()
Assign a flag for elective daycase instances
assign_elective_inpatient_flag()
Assign a flag for elective inpatients
assign_elective_inpatient_instances()
Assign a flag for elective inpatient instances
assign_elective_instances()
Assign a flag for elective instances
assign_emergency_instances()
Assign a flag for emergency instances
assign_s_cohort_ae2()
Assign A&E cohort flag
assign_s_cohort_community_care()
Assign Community Care cohort flag
assign_s_cohort_elective_inpatient()
Assign elective inpatient cohort flag
assign_s_cohort_geriatric()
Assign geriatric cohort flag
assign_s_cohort_limited_daycases()
Assign limited daycases cohort flag
assign_s_cohort_maternity()
Assign maternity cohort flag
assign_s_cohort_multiple_emergency()
Assign multiple emergency cohort flag
assign_s_cohort_outpatient()
Assign outpatient cohort flag
assign_s_cohort_prescribing()
Assign prescribing cohort flag
assign_s_cohort_psychiatry()
Assign psychiatry cohort flag
assign_s_cohort_residential_care()
Assign residential care cohort flag
assign_s_cohort_routine_daycase()
Assign routine daycase cohort flag
assign_s_cohort_single_emergency()
Assign single emergency cohort flag
calculate_acute_elective_cost()
Calculate cost for Acute Elective records
calculate_acute_emergency_cost()
Calculate cost for Acute Emergency records
calculate_ae2_cost()
Calculate cost for Accident & Emergency records
calculate_care_home_cost()
Calculate cost for Care Home records
calculate_community_care_cost()
Calculate community care cost
calculate_community_health_cost()
Calculate cost for Community Health records
calculate_elective_inpatient_cost()
Calculate cost for Elective Inpatient records
calculate_geriatric_cost()
Calculate cost for Geriatric Care records
calculate_home_care_cost()
Calculate cost for Home Care records
calculate_hospital_elective_cost()
Calculate cost for Hospital Elective records
calculate_hospital_emergency_cost()
Calculate cost for Hospital Emergency records
calculate_limited_daycases_cost()
Calculate limited daycases cost
calculate_maternity_cost()
Calculate cost for Maternity records
calculate_measures()
Calculate Measures for Testing
calculate_multiple_emergency_cost()
Calculate multiple emergency cost
calculate_outpatient_costs()
Calculate cost for Outpatient records
calculate_prescribing_cost()
Calculate cost for Prescribing records
calculate_psychiatry_cost()
Calculate cost for Psychiatry records
calculate_residential_care_cost()
Calculate residential care cost
calculate_routine_daycase_cost()
Calculate routine daycase cost
calculate_single_emergency_cost()
Calculate single emergency cost
calculate_stay()
Calculate total length of stay
cascade_geographies()
Match dummy HSCP and LCA codes
ch_name_extract_keyword()
extract keyword in a care home name
check_it_reference()
Check that an IT reference looks valid
check_variables_exist()
Check variables exist in data
check_year_format()
Check that the year is in the correct format
check_year_valid()
Check data exists for a year
clean_individual_file()
Clean individual file
clean_temp_data()
Clean temp data from disk
clean_up_ch()
Clean up CH
clean_up_free_text()
Clean up a free text string
clean_up_gender()
Clean up gender column
compute_mid_year_age()
Compute Age at Midpoint of Year
condition_cols()
Condition columns
convert_ca_to_lca()
Convert Council Areas into Local Council Authority Codes
convert_date_to_numeric()
Convert a date type to the 'SLF numeric format'
convert_eng_gpprac_to_dummy()
Convert GP Practice Codes to a Dummy Code
convert_fyyear_to_year()
Convert year types - Financial year form to the alternate form
convert_hb_to_hbnames()
Convert NHS Health Board Codes to Names
convert_hscp_to_hscpnames()
Convert HSCP Codes to Names
convert_monthly_rows_to_vars()
Convert Monthly Rows to Variables
convert_numeric_to_date()
Convert a date in 'SLF numeric format' to Date type
convert_sc_sending_location_to_lca()
Convert Social Care Sending Location Codes into LCA Codes
convert_year_to_fyyear()
Convert year types - Alternate year form to financial year form
correct_cij_vars()
Correct the CIJ variables
correct_demographics()
Correct date of birth and ages of records
create_cohort_lookups()
Create the cohort lookups
create_cost_inc_dna()
Create cost total net inc DNA
create_day_episode_costs()
Assign costs for single day episodes
create_demog_test_flags()
Create demographic test flags
create_demographic_cohorts()
Create the Demographic Cohort lookup
create_episode_file()
Produce the Source Episode file
create_hb_cost_test_flags()
Create Health Board cost test flags
create_hb_test_flags()
Create Health Board test flags
create_homelessness_lookup()
Create a homelessness lookup
create_hscp_test_flags()
Create HSCP test flags
create_individual_file()
Create the Source Individual file
create_lca_test_flags()
Create LCA test flags
create_monthly_beddays()
Create Monthly Beddays
create_monthly_costs()
Create Monthly Costs
create_person_id()
Create the Person ID variable
create_sending_location_test_flags()
Create sending location test flags
create_service_use_cohorts()
Create the Service Use Cohort lookup
end_date()
End date
end_fy()
Return the end date of FY years
end_fy_quarter()
Return the end of a quarter
end_next_fy_quarter()
Return the end of the next quarter
fill_ch_names()
Fix and fill care home name and postcodes
fill_geographies()
Fill postcode and GP practice geographies
fill_missing_cij_markers()
Fill any missing CIJ markers for records that should have them
find_latest_file()
Find the latest version of a file
fix_c3_costs()
Fix C3 Costs - Acute Extract
fix_east_ayrshire_duplicates()
Fix the East Ayrshire duplicates - Homelessness
fix_sc_end_dates()
Fix sc end dates
fix_sc_missing_end_dates()
Fix sc missing end dates
fix_sc_start_dates()
Fix sc start dates
fix_west_dun_duplicates()
Fix the West Dunbartonshire duplicates - Homelessness
flag_non_scottish_residents()
Flag non-Scottish residents
fy()
Extract latest FY from end_date
fy_interval()
Financial Year interval
get_boxi_extract_path()
Get BOXI extract
get_ch_costs_path()
Care Home Costs File Path
get_combined_slf_deaths_lookup_path()
SLF death dates File Path
get_dd_path()
Get the Delayed Discharges file path
get_dd_period()
Delayed Discharge period
get_demographic_cohorts_path()
Demographic cohorts lookup Path
get_dev_dir()
SLF directory - sourcedev / Source_Linkage_File_Updates
get_dn_costs_path()
District Nursing Costs File Path
get_dn_raw_costs_path()
Raw District Nursing Costs File Path
get_dummy_boxi_extract_path()
Get a path to a dummy file
get_existing_data_for_tests()
SLF Data for Testing
get_file_path()
Get and check and full file path
get_gp_ooh_costs_path()
GP Out of Hours Costs File Path
get_gp_ooh_raw_costs_path()
Raw GP OoH Costs File Path
get_gpprac_opendata()
GP Practice details from PHS open data
get_gpprac_ref_path()
GP Practice Reference File Path (gpprac)
get_hc_costs_path()
Full Home Care Costs File Path
get_hc_raw_costs_path()
Raw Home Care Costs File Path
get_hhg_path()
HHG Extract File Path
get_homelessness_completeness_path()
Homelessness Completeness lookup path
get_it_deaths_path()
IT Deaths File Path
get_it_ltc_path()
IT Long Term Conditions File Path
get_it_prescribing_path()
IT Prescribing File Path
get_la_code_opendata_lookup()
Download the LA code lookup
get_locality_path()
Locality File Path
get_lookups_dir()
Lookups Directory Path
get_ltcs_path()
Long Term Conditions File Path
get_nsu_path()
NSU File Path
get_pop_path()
Populations File Path for different types
get_practice_details_path()
Practice Details File Path
get_readcode_lookup_path()
Get the full path to the SLF read code lookup
get_sandpit_extract_path()
Sandpit Extract File Path
get_sc_at_episodes_path()
Alarms and Telecare Episodes File Path
get_sc_ch_episodes_path()
Care Home Episodes File Path
get_sc_client_lookup_path()
Social Care Client Lookup File Path
get_sc_demog_lookup_path()
Social Care Demographic Lookup File Path
get_sc_hc_episodes_path()
Home Care Episodes File Path
get_sc_sds_episodes_path()
SDS Episodes File Path
get_service_use_cohorts_path()
Service-use cohorts lookup Path
get_sg_homelessness_pub_path()
Homelessness Completeness SG publication figures
get_simd_path()
SIMD File Path
get_slf_ch_name_lookup_path()
SLF Care Home Lookup File Path
get_slf_chi_deaths_path()
SLF CHI Deaths File Path
get_slf_deaths_lookup_path()
SLF Deaths lookup path
get_slf_dir()
SLF directory - hscdiip
get_slf_episode_path()
Get the slf episode file path
get_slf_gpprac_path()
SLF GP Lookup File Path
get_slf_individual_path()
Get the SLF individual file path
get_slf_postcode_path()
SLF Postcode Lookup File Path
get_source_extract_path()
Source Extract File Path
get_sparra_path()
SPARRA Extract File Path
get_spd_path()
Scottish Postcode Directory File Path
get_uk_postcode_path()
get uk postcode list file path
get_year_dir()
Year Directory
gzip_files()
Compress CSV with gzip
is_date_in_fyyear()
Check if a date, or interval is in the financial year
is_missing()
Check for NA or blank values in a character vector
join_cohort_lookups()
Join cohort lookups
join_deaths_data()
Join Deaths data
join_sc_client()
Join sc client variables onto episode file
join_slf_lookup_vars()
Join slf lookup variables
join_sparra_hhg()
Join SPARRA and HHG
last_date_month()
Return the end date of the month of the given date
latest_cost_year()
The latest financial year for Cost uplift setting
latest_update()
Latest update
link_delayed_discharge_eps()
Link Delayed Discharge to WIP episode file
load_ep_file_vars()
Load the unneeded episode file variables
lookup_uplift()
Set uplift scale
make_gpprac_lookup()
Make a GP practice lookup for filling to most recent postcodes based on CHI
make_lowercase_ext()
Make file path extensions lower-case
make_postcode_lookup()
Make a postcode lookup for filling to most recent postcodes based on CHI
match_on_ltcs()
Match on LTC DoB and dates of LTC incidence
max_no_inf()
Custom maximum
midpoint_fy()
Return the date of the midpoint of the FY year
min_no_inf()
Custom minimum
next_fy()
Return the next financial year
phs_db_connection()
Open a connection to a PHS database
previous_update()
Previous update
process_costs_ch_rmd()
Process care homes cost lookup Rmd file
process_costs_dn_rmd()
Process District Nursing cost lookup Rmd file
process_costs_gp_ooh_rmd()
Process GP ooh cost lookup Rmd file
process_costs_hc_rmd()
Process Home Care cost lookup Rmd file
process_costs_rmd()
Process the cost lookup files
process_extract_acute()
Process the Acute extract
process_extract_ae()
Process the A&E extract
process_extract_alarms_telecare()
Process the (year specific) Alarms Telecare extract
process_extract_care_home()
Process the (year specific) Care Home extract
process_extract_cmh()
Process the Community Mental Health (CMH) extract
process_extract_delayed_discharges()
Process the delayed discharges extract
process_extract_district_nursing()
Process the District Nursing extract
process_extract_gp_ooh()
Process the GP OoH extract
process_extract_home_care()
Process the (year specific) Home Care extract
process_extract_homelessness()
Process the Homelessness Extract
process_extract_maternity()
Process the maternity extract
process_extract_mental_health()
Process the mental health extract
process_extract_nrs_deaths()
Process the Nation Records of Scotland (NRS) Deaths extract
process_extract_ooh_consultations()
Process the GP OOH Consultations extract
process_extract_ooh_diagnosis()
Process the GP OOH Diagnosis extract
process_extract_ooh_outcomes()
Process the GP OOH Outcomes extract
process_extract_outpatients()
Process the Outpatients extract
process_extract_prescribing()
Process the prescribing extract
process_extract_sds()
Process the (year specific) SDS extract
process_it_chi_deaths()
Process the CHI deaths extract
process_lookup_gpprac()
Process the SLF gpprac lookup
process_lookup_ltc()
Process LTC IT extract
process_lookup_postcode()
Process the SLF postcode lookup
process_lookup_sc_client()
Process the social care client lookup
process_lookup_sc_demographics()
Process the social care demographic lookup
process_refined_death()
Process the refined death data
process_sc_all_alarms_telecare()
Process the all Alarms Telecare extract
process_sc_all_care_home()
Process the all Care Home extract
process_sc_all_home_care()
Process the all home care extract
process_sc_all_sds()
Process the all SDS extract
process_slf_deaths_lookup()
Create the SLF Deaths lookup
process_tests_acute()
Process Acute tests
process_tests_ae()
Process A&E tests
process_tests_alarms_telecare()
Process Alarms Telecare tests
process_tests_care_home()
Process Care Home tests
process_tests_cmh()
Process CMH tests
process_tests_cross_year()
Process cross year tests
process_tests_delayed_discharges()
Process Delayed Discharges tests
process_tests_district_nursing()
Process District Nursing tests
process_tests_episode_file()
Process Episode file tests
process_tests_gp_ooh()
Process GP OOH tests
process_tests_home_care()
Process Home Care tests
process_tests_homelessness()
Process Homelessness tests
process_tests_individual_file()
Process Individual file tests
process_tests_it_chi_deaths()
Process CHI Deaths tests
process_tests_lookup_gpprac()
Process GP (gpprac) Lookup tests
process_tests_lookup_pc()
Process PC (postcode) Lookup tests
process_tests_ltcs()
Process LTCs tests
process_tests_maternity()
Process Maternity tests
process_tests_mental_health()
Process Mental Health tests
process_tests_nrs_deaths()
Process National Records of Scotland (NRS) deaths tests
process_tests_outpatients()
Process Outpatients tests
process_tests_prescribing()
Process prescribing tests
process_tests_sc_all_at_episodes()
Process Social Care Alarms Telecare all episodes tests
process_tests_sc_all_ch_episodes()
Process Social Care, Care Home all episodes tests
process_tests_sc_all_hc_episodes()
Process Social Care Home Care all episodes tests
process_tests_sc_all_sds_episodes()
Process Social Care SDS all episodes tests
process_tests_sc_client_lookup()
Social care client lookup tests
process_tests_sc_demographics()
Process Social Care Demographics tests
process_tests_sc_sandpit()
Process tests for the social care sandpit extracts
process_tests_sds()
Process SDS tests
produce_episode_file_tests()
Source Extract Tests
produce_homelessness_completeness()
Produce the Homelessness Completeness lookup
produce_individual_file_tests()
Source Extract Tests
produce_it_chi_deaths_tests()
CHI death tests
produce_sc_all_episodes_tests()
Social care All Episodes Tests
produce_sc_demog_lookup_tests()
Social Care Demographic Lookup Tests
produce_sc_sandpit_tests()
Produce tests for social care sandpit extracts.
produce_slf_gpprac_tests()
SLF GP Practice Lookup Tests
produce_slf_homelessness_tests()
SLF Homelessness Extract Tests
produce_slf_postcode_tests()
SLF Postcode Lookup Tests
produce_source_at_tests()
Alarm Telecare Episodes Tests
produce_source_ch_tests()
Source Care Home Tests
produce_source_cmh_tests()
Source Extract Tests
produce_source_dd_tests()
Delayed Discharges extract tests
produce_source_dn_tests()
Source District Nursing Tests
produce_source_extract_tests()
Source Extract Tests
produce_source_hc_tests()
Source Care Home Tests
produce_source_nrs_tests()
Source Extract Tests
produce_source_pis_tests()
Source PIS Tests
produce_source_sds_tests()
SDS Episodes Tests
produce_test_comparison()
Test Comparison
produce_tests_sc_client_lookup()
Social care Client lookup Tests
qtr()
Extract latest quarter from end_date
read_dev_slf_file()
Read development SLF files (using SLFhelper)
read_extract_acute()
Read Acute extract
read_extract_ae()
Read A&E extract
read_extract_cmh()
Read CMH extract
read_extract_delayed_discharges()
Read Delayed Discharges extract
read_extract_district_nursing()
Read district nursing extract
read_extract_gp_ooh()
Process the GP OoH extract
read_extract_homelessness()
Read Homelessness extract
read_extract_maternity()
Read Maternity extract
read_extract_mental_health()
Read Mental Health extract
read_extract_nrs_deaths()
Read NRS Deaths extract
read_extract_ooh_consultations()
Read GP OOH Consultations extract
read_extract_ooh_diagnosis()
Read GP OOH Diagnosis extract
read_extract_ooh_outcomes()
Read GP OOH Outcomes extract
read_extract_outpatients()
Read Outpatients extract
read_extract_prescribing()
Read Prescribing extract
read_file()
Read a file
read_it_chi_deaths()
Read the CHI deaths extract
read_lookup_ltc()
Read LTC IT extract
read_lookup_sc_client()
Process the social care client lookup
read_lookup_sc_demographics()
Read SC demographics
read_sc_all_alarms_telecare()
Read Social Care Alarms Telecare data
read_sc_all_care_home()
Read Social Care - Care Home data
read_sc_all_home_care()
Read Social Care Home Care data
read_sc_all_sds()
Read Social Care SDS data
read_temp_data()
Read a temp data from disk for debugging purpose
recalculate_elective_inpatient_cost()
Recalculate elective inpatient costs
recode_gender()
Recode gender
recode_health_boards()
Recode Health Board code to 2018 standard
recode_hscp()
Recode HSCP code to 2018 standard
remove_blank_chi()
Remove blank CHI
rename_hscp()
Rename hscp where applicable for testing
replace_sc_id_with_latest()
Replace sc id with the latest sc id
setup_keyring()
Interactively set up the keyring
start_fy()
Return the start date of FY year
start_fy_quarter()
Return the start of a quarter
start_next_fy_quarter()
Return the start of the next quarter
store_ep_file_vars()
Store the unneeded episode file variables
vars_end_with() vars_start_with() vars_contain()
Select columns according to a pattern
write_file()
Write a data to a file
write_temp_data()
Write a temp data to disk in parquet format for debugging purpose
write_tests_xlsx()
Write out Tests
years_to_run()
The year list for slf to update