Skip to content

Commit 0743f49

Browse files
committed
artifacts for FRS
1 parent 3e11264 commit 0743f49

20 files changed

+72
-6133
lines changed

Artifacts.toml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
[augdata]
2-
git-tree-sha1 = "288471b266e4ec933d1c6190c8dd7fc3e82d3f4c"
2+
git-tree-sha1 = "b1ad31b8fcd1165a57e02d7de274b7140254b480"
3+
lazy = true
34

45
[[augdata.download]]
5-
sha256 = "774759a0726fe9d904016569c643650ad1cb0bcf650784c52f60bdcb35a0f2db"
6-
url = "https://virtual-worlds.biz/artifacts//aux-data.tar.gz"
6+
sha256 = "ff09ec25734af6aecd831a4fb89ba3c402945812f5b34a29986aed8252dadf02"
7+
url = "https://virtual-worlds.biz/artifacts//augdata.tar.gz"
8+
9+
[disability]
10+
git-tree-sha1 = "288ef84eac1aad34af423852e64001e75be3b822"
11+
lazy = true
12+
13+
[[disability.download]]
14+
sha256 = "7ed1e796fc2e09a4c48f772ea3cd06b7c6aab721c183f6905b2fa83890d0184b"
15+
url = "https://virtual-worlds.biz/artifacts//disability.tar.gz"
716

817
[exampledata]
918
git-tree-sha1 = "7853136d3530ea531e4f45a29f8fcef81d08fc1c"

Project.toml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ version = "0.1.2"
66
[deps]
77
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
88
ArtifactUtils = "8b73e784-e7d8-4ea5-973d-377fed4e3bce"
9+
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
910
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
1011
BudgetConstraints = "51aacf4b-43e8-45f9-b960-ce5126c2a956"
1112
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
@@ -63,6 +64,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
6364
[compat]
6465
ArgCheck = "2.3.0, 4"
6566
ArtifactUtils = "0.2.4"
67+
Artifacts = "1.11.0"
6668
BenchmarkTools = "1.3.2, 4"
6769
BudgetConstraints = "1.0.1, 3"
6870
CSV = "0.10.10, 1"
@@ -115,22 +117,19 @@ artifact_server_upload = "[email protected]:public_html/artifacts/"
115117
artifact_server_url = "https://virtual-worlds.biz/artifacts/"
116118
auto_weight = true
117119
default_run_name = "default_run"
118-
use_weighting = true
119-
target_nation = "N_Scotland"
120+
do_marginal_rates = false
121+
do_replacement_rates = false
120122
dump_frames = false
121-
to_y = 2024
122-
to_q = 3
123+
dump_frames2 = true
124+
ineq_income_measure = "eq_bhc_net_income"
123125
means_tested_routing = "modelled_phase_in"
124126
poverty_line_source = "pl_first_sys"
125-
ineq_income_measure = "eq_bhc_net_income"
126-
do_marginal_rates = false
127-
do_replacement_rates = false
127+
prem2 = "enhanced_disability_child"
128128
replacement_rate_hours = 30
129+
target_nation = "N_Scotland"
130+
to_q = 3
131+
to_y = 2024
132+
use_weighting = true
129133

130-
prem2 = "enhanced_disability_child"
131-
dump_frames2 = true
132-
133134
[targets]
134135
test = ["Test"]
135-
136-

docs/ima-pluto.jl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ begin
5757
const DEFAULT_NUM_TYPE = Float64
5858
settings = RunSettings.Settings()
5959
settings.requested_threads = 4
60-
data_dir( settings ) = "/home/graham_s/julia/vw/ScottishTaxBenefitModel/data"
6160

6261
function init_data(; reset :: Bool = false )
6362
nhh = FRSHouseholdGetter.get_num_households()
@@ -71,14 +70,6 @@ begin
7170

7271
function load_system()::TaxBenefitSystem
7372
sys = get_default_system_for_cal_year( 2021 )
74-
# load_file( joinpath( Definitions.MODEL_PARAMS_DIR, "sys_2021_22.jl" ))
75-
#
76-
# Note that as of Budget21 removing these doesn't actually happen till May 2022.
77-
#
78-
# load_file!( sys, joinpath( Definitions.MODEL_PARAMS_DIR, "sys_2021-uplift-removed.jl"))
79-
# uc taper to 55
80-
# load_file!( sys, joinpath( Definitions.MODEL_PARAMS_DIR, "budget_2021_uc_changes.jl"))
81-
# weeklyise!( sys )
8273
return sys
8374
end
8475

params/sys_2023_24_ruk.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function load_sys_2023_24_ruk!( sys :: TaxBenefitSystem{T} ) where T
359359
:NIRELAND => -99999.99
360360
] )
361361

362-
brmapath = joinpath(MODEL_DATA_DIR, "local", "brma-2023-2024-country-averages.csv")
362+
brmapath = joinpath( artifact"augdata", "brma-2023-2024-country-averages.csv" )
363363

364364
sys.hr.brmas = loadBRMAs( 4, Float64, brmapath )
365365

params/sys_2023_24_scotland.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function load_sys_2023_24_scotland!( sys :: TaxBenefitSystem )
1010
sys.it.non_savings_thresholds = [2_162, 13_118, 31_092, 125_120.0]
1111
sys.it.non_savings_basic_rate = 2 # above this counts as higher rate rate FIXME 3???
1212
sys.nmt_bens.carers.scottish_supplement = 0.0 # FROM APRIL 2021
13-
brmapath = joinpath(MODEL_DATA_DIR, "local", "lha_rates_scotland_2023_24.csv")
13+
brmapath = joinpath( artifact"augdata", "lha_rates_scotland_2023_24.csv")
1414
sys.hr.brmas = loadBRMAs( 4, Float64, brmapath )
1515
sys.loctax.ct.band_d = Dict(
1616
[

regressions/disability_regressions.jl

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,11 @@ using CSV,DataFrames,GLM,RegressionTables
1010

1111

1212
const settings = Settings()
13+
# settings.data_source = SyntheticSource # !!! changeme!!!
14+
daf = get_data_artifact( settings )
1315

14-
const LOCAL_DATA_DIR = data_dir( settings )
15-
#
16-
# !!! For Actual Dataset, UK wide with Scottish dummy
17-
# For synth data, Scotland only for now!!!
18-
#
19-
settings.data_source = SyntheticSource # !!! changeme!!!
20-
if settings.data_source == FRS
21-
settings.household_name = "model_households-2015-2021.tab"
22-
settings.people_name = "model_people-2015-2021.tab"
23-
end
24-
25-
const DATASETS = main_datasets( settings )
26-
27-
frshh = CSV.File( DATASETS.hhlds ) |> DataFrame
28-
frspeople = CSV.File( DATASETS.people ) |> DataFrame
16+
frshh = CSV.File( joinpath( daf, "households.tab" )) |> DataFrame
17+
frspeople = CSV.File( joinpath( daf, "households.tab" )) |> DataFrame
2918

3019
fm = innerjoin( frshh, frspeople, on=[:data_year, :hid ], makeunique=true )
3120

src/ExampleHouseholdGetter.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ using DataFrames
88
using CSV
99
using ArgCheck
1010
using Pkg.Artifacts
11+
using LazyArtifacts
1112

1213
using ScottishTaxBenefitModel
1314
using .Definitions
@@ -56,12 +57,10 @@ function initialise(
5657

5758
global KEYMAP
5859
global EXAMPLE_HOUSEHOLDS
59-
# tmpsource = settings.data_source # hack to work round datasource being wired in to settings
60-
# settings.data_source = ExampleSource
61-
# println( "DEF_MODEL_DATA_DIR=|$(Definitions.DEF_MODEL_DATA_DIR)| MODEL_DATA_DIR=|$MODEL_DATA_DIR|")
6260
# lazy load cons data if needs be
6361
tmp_data_source = settings.data_source
6462
settings.data_source = ExampleSource
63+
# tmpsource = settings.data_source # hack to work round datasource being wired in to settings
6564
if settings.indirect_method == matching
6665
ConsumptionData.init( settings )
6766
end

src/HistoricBenefits.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module HistoricBenefits
99
# with a series of complete parameter files, once we have
1010
# everything defined fully.
1111
#
12-
using CSV, DataFrames, Dates
12+
using CSV, DataFrames, Dates, Artifacts, LazyArtifacts
1313
using ScottishTaxBenefitModel
1414
using .Definitions
1515
using .ModelHousehold: Person
@@ -41,20 +41,23 @@ function load_historic( file ) :: Dict
4141
end
4242

4343
function load_pip()
44-
pip=CSV.File( "$(MODEL_DATA_DIR)/receipts/pip_2002-2023_from_stat_explore.csv",
44+
pip=CSV.File( joinpath(artifact"augdata", "pip_2002-2023_from_stat_explore.csv"),
4545
missingstring="..",
4646
types=Dict([:Date=>String]))|>DataFrame
4747
pip.Date = Date.( pip.Date, dateformat"yyyymm" )
4848
return pip
4949
end
5050

5151
function load_dla()
52-
dla=CSV.File( "$(MODEL_DATA_DIR)/receipts/dla_2002-2023_from_stat_explore.csv" )|> DataFrame
52+
dla=CSV.File( joinpath(artifact"augdata","dla_2002-2023_from_stat_explore.csv" ))|> DataFrame
5353
dla.Date = Date.( dla.Date, dateformat"u-yy" ) .+Year(2000)
5454
return dla
5555
end
5656

57-
const HISTORIC_BENEFITS = load_historic( "$(MODEL_PARAMS_DIR)/historic_benefits.csv" )
57+
const HISTORIC_BENEFITS = load_historic(
58+
joinpath(
59+
artifact"augdata", "historic_benefits.csv" ))
60+
5861
const DLA_RECEIPTS = load_dla()
5962
const PIP_RECEIPTS = load_pip()
6063

src/LocalLevelCalculations.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ module LocalLevelCalculations
99

1010
using StaticArrays
1111
using CSV,DataFrames
12+
using Pkg, Pkg.Artifacts
13+
using LazyArtifacts
1214

1315
using ScottishTaxBenefitModel
1416
using .Definitions
@@ -118,7 +120,7 @@ export
118120

119121
# FIXME hard code this in
120122
function make_la_to_brma_map()
121-
lacsv = CSV.File( "$(MODEL_DATA_DIR)/local/la_to_brma_approx_mappings.csv" ) |> DataFrame
123+
lacsv = CSV.File( joinpath( artifact"augdata", "la_to_brma_approx_mappings.csv" )) |> DataFrame
122124
out = Dict{Symbol,Symbol}()
123125
for r in eachrow( lacsv )
124126
out[Symbol(r.ccode)] = Symbol(r.bcode)

src/RunSettings.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ module RunSettings
44
#
55
using Pkg
66
using Pkg.Artifacts
7+
using LazyArtifacts
78
using Parameters
89
using Preferences
910
using UUIDs
@@ -45,7 +46,6 @@ module RunSettings
4546
# DatasetType,
4647
# actual_data,
4748
# synthetic_data,
48-
data_dir,
4949
get_skiplist,
5050

5151
get_all_uk_settings_2023,
@@ -90,7 +90,6 @@ module RunSettings
9090
scotland_full :: Bool = true
9191
weighted = @load_preference( "use_weighting", true )
9292
auto_weight = @load_preference( "auto_weight", true )
93-
data_dir :: String = MODEL_DATA_DIR # DELETE
9493
household_name = "model_households_scotland-2015-2021-w-enums-2"
9594
people_name = "model_people_scotland-2015-2021-w-enums-2"
9695
target_nation :: Nation = eval(Symbol(@load_preference("target_nation", "N_Scotland"))) # N_Scotland
@@ -178,6 +177,7 @@ module RunSettings
178177
settings.replacement_rate_hours = @load_preference( "replacement_rate_hours" )
179178
end
180179
=#
180+
181181

182182
function get_data_artifact( settings::Settings )::AbstractString
183183
return if settings.data_source == FRSSource
@@ -197,6 +197,16 @@ module RunSettings
197197
end
198198
end
199199

200+
function main_datasets( settings :: Settings ) :: NamedTuple
201+
artd = get_data_artifact( settings )
202+
return (
203+
hhlds = joinpath( artd, "households.tab" ),
204+
people = joinpath( artd, "people.tab" )
205+
)
206+
end
207+
208+
#=
209+
200210
function data_dir( settings :: Settings ) :: String
201211
ds = if settings.data_source == FRSSource
202212
"actual_data"
@@ -243,6 +253,8 @@ module RunSettings
243253
)
244254
end
245255
256+
=#
257+
246258
"""
247259
Hacky prebuilt settings for the Northumbria model.
248260
"""

0 commit comments

Comments
 (0)