Skip to content

Commit

Permalink
artifacts for FRS
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamstark committed Nov 8, 2024
1 parent 8f96e66 commit 16c3528
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 13 deletions.
16 changes: 16 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,26 @@ 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

[[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"
11 changes: 11 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 3 additions & 1 deletion src/ExampleHouseholdGetter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/ModelHousehold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 34 additions & 12 deletions src/RunSettings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -65,33 +67,35 @@ 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
run_name = @load_preference( "default_run_name")
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.
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 16c3528

Please sign in to comment.