diff --git a/Artifacts.toml b/Artifacts.toml index 0912ca41..7c05905b 100644 --- a/Artifacts.toml +++ b/Artifacts.toml @@ -21,6 +21,14 @@ lazy = true sha256 = "5bc1607882203127bd0c13ddeeb22deb0f51156cd65aa9f4c14af3c1df175ef2" url = "https://virtual-worlds.biz/artifacts//model-data-scotland-2015-2021-v2.tar.gz" +[scottish-synthetic-data] +git-tree-sha1 = "2bcdf3e7a62bb4bcd282f05008adbe6b63228ab9" +lazy = true + + [[scottish-synthetic-data.download]] + sha256 = "701ac0c44fe997b7d4e252dc2bee65e2c8ae2cdb2b6975cf5ae8134c0188e2d5" + url = "https://virtual-worlds.biz/artifacts//not-created-yet.tar.gz" + [uk-frs-data] git-tree-sha1 = "8891ef02ea5dada4ec097ce0a183502cfafb995f" lazy = true @@ -28,3 +36,11 @@ lazy = true [[uk-frs-data.download]] sha256 = "8e3efc98a687441085be9ef5e53b663c2bd9abf6e300efa2dd6edb29993d8777" url = "https://virtual-worlds.biz/artifacts//model-data-2021-2021-v2.tar.gz" + +[uk-synthetic-data] +git-tree-sha1 = "2bcdf3e7a62bb4bcd282f05008adbe6b63228ab9" +lazy = true + + [[uk-synthetic-data.download]] + sha256 = "701ac0c44fe997b7d4e252dc2bee65e2c8ae2cdb2b6975cf5ae8134c0188e2d5" + url = "https://virtual-worlds.biz/artifacts//not-created-yet.tar.gz" diff --git a/Project.toml b/Project.toml index 9119d14f..f01e9ac4 100644 --- a/Project.toml +++ b/Project.toml @@ -116,6 +116,17 @@ artifact_server_url = "https://virtual-worlds.biz/artifacts/" auto_weight = true default_run_name = "default_run" use_weighting = true +target_nation = "N_Scotland" +dump_frames = false +to_y = 2024 +to_q = 3 +means_tested_routing = "modelled_phase_in" +poverty_line_source = "pl_first_sys" +ineq_income_measure = "eq_bhc_net_income" +do_marginal_rates = false +do_replacement_rates = false +replacement_rate_hours = 30 + [targets] test = ["Test"] diff --git a/src/ExampleHouseholdGetter.jl b/src/ExampleHouseholdGetter.jl index f0a56f5a..4b340182 100644 --- a/src/ExampleHouseholdGetter.jl +++ b/src/ExampleHouseholdGetter.jl @@ -60,6 +60,8 @@ function initialise( # settings.data_source = ExampleSource # println( "DEF_MODEL_DATA_DIR=|$(Definitions.DEF_MODEL_DATA_DIR)| MODEL_DATA_DIR=|$MODEL_DATA_DIR|") # lazy load cons data if needs be + tmp_data_source = settings.data_source + settings.data_source = ExampleSource if settings.indirect_method == matching ConsumptionData.init( settings ) end @@ -95,7 +97,7 @@ function initialise( EXAMPLE_HOUSEHOLDS[hhf.name] = hh println( EXAMPLE_HOUSEHOLDS[hhf.name].council ) end - # settings.data_source = tmpsource + settings.data_source = tmp_data_source return KEYMAP end diff --git a/src/ModelHousehold.jl b/src/ModelHousehold.jl index 27a2b58f..a8e156f2 100644 --- a/src/ModelHousehold.jl +++ b/src/ModelHousehold.jl @@ -492,6 +492,7 @@ function allocate_to_bus( T::Type, hh_head_pid :: BigInt, bua :: BUAllocation ) # println( "on bu $i person $p relationships $(person.relationships)") @assert head_pid > 0 "head pid must be allocated; buno=$buno person $(person.pid) relationships $(person.relationships)" hp = (buno == 1) ? hh_head_pid : head_pid + println( "hp = $(hp) person.relationships $(person.relationships)" ) reltohead = person.relationships[hp] if reltohead in [Spouse,Cohabitee,Civil_Partner] spouse_pid = person.pid diff --git a/src/RunSettings.jl b/src/RunSettings.jl index a48c1bf2..b3f50965 100644 --- a/src/RunSettings.jl +++ b/src/RunSettings.jl @@ -2,6 +2,8 @@ module RunSettings # # This module contains things needed to control one run e.g. the output destination, number of households to use andd so on. # + using Pkg + using Pkg.Artifacts using Parameters using Preferences using UUIDs @@ -65,6 +67,8 @@ module RunSettings # @enum DatasetType actual_data synthetic_data # FIXME this duplicates `DataSource` in `.Definitions`` + # settings loaded automatically from the Project.toml section 'preferences.ScottishTaxBenefitModel' + # and maybe overwritten in LocalPreferences.toml @with_kw mutable struct Settings uuid :: UUID = UUID("c2ae9c83-d24a-431c-b04f-74662d2ba07e") uid :: Int = 1 # placeholder for maybe a user somewhere @@ -72,26 +76,26 @@ module RunSettings scotland_full :: Bool = true weighted = @load_preference( "use_weighting") auto_weight = @load_preference( "auto_weight") - data_dir :: String = MODEL_DATA_DIR + data_dir :: String = MODEL_DATA_DIR # DELETE household_name = "model_households_scotland-2015-2021-w-enums-2" people_name = "model_people_scotland-2015-2021-w-enums-2" - target_nation :: Nation = N_Scotland - dump_frames :: Bool = false + target_nation :: Nation = eval(Symbol(@load_preference("target_nation"))) # N_Scotland + dump_frames :: Bool = @load_preference( "dump_frames") num_households :: Int = 0 num_people :: Int = 0 prices_file = "indexes.tab" - to_y :: Int = 2024 - to_q :: Int = 3 + to_y :: Int = @load_preference( "to_y" ) + to_q :: Int = @load_preference( "to_q" ) output_dir :: String = joinpath(tempdir(),"output") - means_tested_routing :: MT_Routing = modelled_phase_in + means_tested_routing :: MT_Routing = eval( Symbol(@load_preference( "means_tested_routing" ))) poverty_line :: Real = -1.0 - poverty_line_source :: PovertyLineSource = pl_first_sys - ineq_income_measure :: IneqIncomeMeasure = eq_bhc_net_income + poverty_line_source :: PovertyLineSource = eval( Symbol(@load_preference( "poverty_line_source"))) + ineq_income_measure :: IneqIncomeMeasure = eval( Symbol(@load_preference( "ineq_income_measure" ))) growth :: Real = 0.02 # for time to exit poverty - income_data_source :: DataIncomeSource = ds_frs # ds_hbai - do_marginal_rates :: Bool = false - do_replacement_rates :: Bool = false - replacement_rate_hours :: Int = 30 + income_data_source :: DataIncomeSource = ds_frs # ds_hbai !! not used + do_marginal_rates :: Bool = @load_preference( "do_marginal_rates" ) + do_replacement_rates :: Bool = @load_preference( "do_replacement_rates" ) + replacement_rate_hours :: Int = @load_preference( "replacement_rate_hours" ) # We jam on age 68 here since we don't want changes to pension age # in the parameters to affect the numbers of people in # mr/rr calculations. @@ -136,6 +140,24 @@ module RunSettings skiplist = "" end + function artifact_name( settings::Settings )::AbstractString + return if settings.data_source == FRSSource + if settings.target_nation == N_Scotland + artifact"scottish-frs-data" + elseif settings.target_nation == N_UK + artifact"uk-frs-data" + end + elseif settings.data_source == ExampleSource + artifact"exampledata" + elseif settings.data_source == SyntheticSource + if settings.target_nation == N_Scotland + artifact"scottish-synthetic-data" + elseif settings.target_nation == N_UK + artifact"uk-synthetic-data" + end + end + end + function data_dir( settings :: Settings ) :: String ds = if settings.data_source == FRSSource "actual_data"