diff --git a/Project.toml b/Project.toml index 3ccde18d..945e2029 100644 --- a/Project.toml +++ b/Project.toml @@ -25,6 +25,7 @@ JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36" MarkdownTables = "1862ce21-31c7-451e-824c-f20fa3f90fa2" +Measures = "442fdcdd-2543-5da2-b0f3-8c86c306513e" Observables = "510215fc-4207-5dde-b226-833fc4488ee2" Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" PovertyAndInequalityMeasures = "582645c0-90fa-497a-98b9-936b80116c29" diff --git a/src/ConsumptionData.jl b/src/ConsumptionData.jl index 32c7463f..12753825 100644 --- a/src/ConsumptionData.jl +++ b/src/ConsumptionData.jl @@ -169,7 +169,7 @@ const DEFAULT_STANDARD_RATE = default_standard_rate() Match in the lcf data using the lookup table constructed in 'matching/lcf_frs_matching.jl' 'which' best, 2nd best etc match (<=20) """ -function find_consumption_for_hh!( hh :: Household, case :: Int, dataset :: Int ) +function find_consumption_for_hh!( hh :: Household, case :: Int, datayear :: Int ) # println( "find_consumption_for_hh! matching to case $case datayear $datayear") hh.expenditure = EXPENDITURE_DATASET[(EXPENDITURE_DATASET.case .== case).&(EXPENDITURE_DATASET.datayear.==datayear),:][1,:] hh.factor_costs = FACTOR_COST_DATASET[(FACTOR_COST_DATASET.case .== case).&(FACTOR_COST_DATASET.datayear.==datayear),:][1,:] diff --git a/src/MatchingLibs.jl b/src/MatchingLibs.jl index 61be28f8..f859a340 100644 --- a/src/MatchingLibs.jl +++ b/src/MatchingLibs.jl @@ -11,6 +11,7 @@ module MatchingLibs # using ScottishTaxBenefitModel using .Definitions, + .ModelHousehold, .Uprating, .RunSettings @@ -967,7 +968,7 @@ function frs_tenuremap( tentyp2 :: Union{Int,Missing} ) :: Vector{Int} return out end -function model_tenuremap( t :: TenureType ) :: Vector{Int} +function model_tenuremap( t :: Tenure_Type ) :: Vector{Int} return frs_tenuremap( Int( t ) ) end diff --git a/src/Utils.jl b/src/Utils.jl index 479df7bf..8b3e360a 100644 --- a/src/Utils.jl +++ b/src/Utils.jl @@ -94,8 +94,8 @@ Make a new dataframe with the difference between the fields between start_col and end_col and other fields just copied diff is difference df2 - df1, Frames should have identical other cols. """ -function df_diff( df1, df2 :: DataFrame, start_col::Int, end_col :: Int ) :: DataFrame - argch@eck size( df1 ) == size( df2 ) +function df_diff( df1 :: DataFrame, df2 :: DataFrame, start_col :: Int, end_col :: Int ) :: DataFrame + @argcheck size( df1 ) == size( df2 ) ## maybe check that the non diffed fields are all the same too.. d = copy(df1) d[:,start_col:end_col] = df2[:,start_col:end_col] .- df1[:,start_col:end_col] diff --git a/test/matching_tests.jl b/test/matching_tests.jl index 0a27be6a..63401e3c 100644 --- a/test/matching_tests.jl +++ b/test/matching_tests.jl @@ -4,6 +4,7 @@ using .Utils:coarse_match using DataFrames, CSV using .ExampleHelpers +using .MatchingLibs # # Donor and Recipient each have 2 fields `a` and `b` filled with random