generated from nhsbsa-data-analytics/nhsbsaShinyR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d17ee8d
commit 8ada08e
Showing
2 changed files
with
244 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Load/install all required packages and functions | ||
source("data-raw/workflow/workflow_packages.R") | ||
source("data-raw/workflow/workflow_helpers.R") | ||
source("data-raw/workflow/workflow_production.R") | ||
|
||
# Specify variables to retain at end of each script | ||
keep_vars = c(ls(), 'keep_vars') | ||
|
||
# FY 22/23 --------------------------------------------------------------------- | ||
|
||
# 1. Get latest cqc data: 0.5hr - Run once in first epoch script | ||
get_latest_cqc_data() | ||
|
||
# 2. Get latest ab plus epoch: ~2hr | ||
get_abp_from_api( | ||
end_date = "2024-03-31" | ||
) | ||
|
||
# 3. Merge and process cqc and ab plus: ~3 mins | ||
create_ab_plus_cqc_data( | ||
ab_plus_data = "INT646_ABP_20230331", | ||
cqc_data = "INT646_CQC_20230602", | ||
start_date = "2022-04-01", | ||
end_date = "2023-03-31" | ||
) | ||
|
||
# 4. Create form level fact for records with a ch-postcode: ~11-14hr | ||
create_form_level_patient_addresses( | ||
address_data = "INT646_ABP_CQC_20220401_20230331" | ||
) | ||
|
||
# 5. Match patient details against ch-postcode uprn and process: ~30-40 mins | ||
create_care_home_address_match( | ||
patient_address_data = "INT646_FORMS_20220401_20230331", | ||
lookup_address_data = "INT646_ABP_CQC_20220401_20230331", | ||
parent_uprn_data = "INT646_ABP_20230331" | ||
) | ||
|
||
# 6. Create postcode lookup table (latest available mappings) for joining in the next step: ~5 min | ||
# create_postcode_lookup() # Run once in first epoch script | ||
|
||
|
||
# 7. Join to fact table and get non ch-postcode records within time frame: ~9 hrs | ||
create_matched_prescription_base_table( | ||
match_data = "INT646_MATCH_20220401_20230331", | ||
form_data = "INT646_FORMS_20220401_20230331" | ||
) |