Browse Source
* migration wip * change field names to lowercase and fix the tests * Change national and ethnic field types and map to correct enums * change ecstat column types * Change prevten field type * Change homeless field type * Change benefit cap field type * Put db enums in one folder and add a few new field changes" * change field type for housing needs * Change illness field type * display checkbox answers * cbl, chr, cap * Change tenancy and tenancylength field types * Change landlord and rsnvac field types * Change unittype_gn field type * Reasonble preference displaying on check answers * update more field types * Fix typo in comumn name * Change more types * Test fixes * Add adr * fix some tests * run migration * Fix tests Co-authored-by: Matthew Phelan <matthew.phelan@madetech.com>pull/80/head
kosiakkatrina
3 years ago
committed by
GitHub
31 changed files with 1606 additions and 1074 deletions
@ -0,0 +1,252 @@ |
|||||||
|
module DbEnums |
||||||
|
def self.benefitcap |
||||||
|
{ |
||||||
|
"Yes - benefit cap" => 5, |
||||||
|
"Yes - removal of the spare room subsidy" => 4, |
||||||
|
"Yes - both the benefit cap and the removal of the spare room subsidy" => 6, |
||||||
|
"No" => 2, |
||||||
|
"Do not know" => 3, |
||||||
|
"Prefer not to say" => 100, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.ecstat |
||||||
|
{ |
||||||
|
"Part-time - Less than 30 hours" => 2, |
||||||
|
"Full-time - 30 hours or more" => 1, |
||||||
|
"In government training into work, such as New Deal" => 3, |
||||||
|
"Jobseeker" => 4, |
||||||
|
"Retired" => 5, |
||||||
|
"Not seeking work" => 6, |
||||||
|
"Full-time student" => 7, |
||||||
|
"Unable to work because of long term sick or disability" => 8, |
||||||
|
"Child under 16" => 100, |
||||||
|
"Other" => 0, |
||||||
|
"Prefer not to say" => 10, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.ethnic |
||||||
|
{ |
||||||
|
"White: English/Scottish/Welsh/Northern Irish/British" => 1, |
||||||
|
"White: Irish" => 2, |
||||||
|
"White: Gypsy/Irish Traveller" => 18, |
||||||
|
"White: Other" => 3, |
||||||
|
"Mixed: White & Black Caribbean" => 4, |
||||||
|
"Mixed: White & Black African" => 5, |
||||||
|
"Mixed: White & Asian" => 6, |
||||||
|
"Mixed: Other" => 7, |
||||||
|
"Asian or Asian British: Indian" => 8, |
||||||
|
"Asian or Asian British: Pakistani" => 9, |
||||||
|
"Asian or Asian British: Bangladeshi" => 10, |
||||||
|
"Asian or Asian British: Chinese" => 15, |
||||||
|
"Asian or Asian British: Other" => 11, |
||||||
|
"Black: Caribbean" => 12, |
||||||
|
"Black: African" => 13, |
||||||
|
"Black: Other" => 14, |
||||||
|
"Other Ethnic Group: Arab" => 16, |
||||||
|
"Other Ethnic Group: Other" => 19, |
||||||
|
"Prefer not to say" => 17, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.homeless |
||||||
|
{ |
||||||
|
"Yes - assessed as homeless by a local authority and owed a homelessness duty. Including if threatened with homelessness within 56 days" => 11, |
||||||
|
"Yes - other homelessness" => 7, |
||||||
|
"No" => 1, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.illness |
||||||
|
{ |
||||||
|
"Yes" => 1, |
||||||
|
"No" => 2, |
||||||
|
"Do not know" => 3, |
||||||
|
"Prefer not to say" => 100, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.leftreg |
||||||
|
{ |
||||||
|
"Yes" => 6, |
||||||
|
"No - they left up to 5 years ago" => 4, |
||||||
|
"No - they left more than 5 years ago" => 5, |
||||||
|
"Prefer not to say" => 3, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.national |
||||||
|
{ |
||||||
|
"UK national resident in UK" => 1, |
||||||
|
"A current or former reserve in the UK Armed Forces (exc. National Service)" => 100, |
||||||
|
"UK national returning from residence overseas" => 2, |
||||||
|
"Czech Republic" => 3, |
||||||
|
"Estonia" => 4, |
||||||
|
"Hungary" => 5, |
||||||
|
"Latvia" => 6, |
||||||
|
"Lithuania" => 7, |
||||||
|
"Poland" => 8, |
||||||
|
"Slovakia" => 9, |
||||||
|
"Bulgaria" => 14, |
||||||
|
"Romania" => 15, |
||||||
|
"Ireland" => 17, |
||||||
|
"Other EU Economic Area (EEA country)" => 11, |
||||||
|
"Any other country" => 12, |
||||||
|
"Prefer not to say" => 13, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.pregnancy |
||||||
|
{ |
||||||
|
"Yes" => 1, |
||||||
|
"No" => 2, |
||||||
|
"Prefer not to say" => 3, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.previous_tenancy |
||||||
|
{ |
||||||
|
"Owner occupation (private) " => 26, |
||||||
|
"Owner occupation (low cost home ownership)" => 27, |
||||||
|
"Private sector tenancy" => 3, |
||||||
|
"Tied housing or rented with job" => 4, |
||||||
|
"Supported housing" => 5, |
||||||
|
"Sheltered accomodation" => 8, |
||||||
|
"Residential care home" => 9, |
||||||
|
"Living with friends or family" => 28, |
||||||
|
"Refuge" => 21, |
||||||
|
"Hospital" => 10, |
||||||
|
"Prison / approved probation hostel" => 29, |
||||||
|
"Direct access hostel" => 7, |
||||||
|
"Bed & Breakfast" => 14, |
||||||
|
"Mobile home / caravan" => 23, |
||||||
|
"Any other temporary accommodation" => 18, |
||||||
|
"Home Office Asylum Support" => 24, |
||||||
|
"Children’s home / foster care" => 13, |
||||||
|
"Rough sleeping" => 19, |
||||||
|
"Other" => 25, |
||||||
|
"Fixed term Local Authority General Needs tenancy" => 30, |
||||||
|
"Lifetime Local Authority General Needs tenancy" => 31, |
||||||
|
"Fixed term PRP General Needs tenancy" => 32, |
||||||
|
"Lifetime PRP General Needs tenancy" => 33, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.reservist |
||||||
|
{ |
||||||
|
"Yes" => 1, |
||||||
|
"No" => 2, |
||||||
|
"Prefer not to say" => 3, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.polar |
||||||
|
{ |
||||||
|
"No" => 0, |
||||||
|
"Yes" => 1, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.polar2 |
||||||
|
{ |
||||||
|
"No" => 2, |
||||||
|
"Yes" => 1, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.tenancy |
||||||
|
{ |
||||||
|
"Fixed term – Secure" => 1, |
||||||
|
"Fixed term – Assured Shorthold Tenancy (AST)" => 4, |
||||||
|
"Lifetime – Secure" => 100, |
||||||
|
"Lifetime – Assured" => 2, |
||||||
|
"License agreement" => 5, |
||||||
|
"Other" => 3, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.landlord |
||||||
|
{ |
||||||
|
"This landlord" => 1, |
||||||
|
"Another registered provider - includes housing association or local authority" => 2, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.rsnvac |
||||||
|
{ |
||||||
|
"First let of newbuild property" => 15, |
||||||
|
"First let of conversion/rehabilitation/acquired property" => 16, |
||||||
|
"First let of leased property" => 17, |
||||||
|
"Relet - tenant evicted due to arrears" => 10, |
||||||
|
"Relet - tenant evicted due to ASB or other reason" => 11, |
||||||
|
"Relet - tenant died (no succession)" => 5, |
||||||
|
"Relet - tenant moved to other social housing provider" => 12, |
||||||
|
"Relet - tenant abandoned property" => 6, |
||||||
|
"Relet - tenant moved to private sector or other accommodation" => 8, |
||||||
|
"Relet - to tenant who occupied same property as temporary accommodation" => 9, |
||||||
|
"Relet – internal transfer (excluding renewals of a fixed-term tenancy)" => 13, |
||||||
|
"Relet – renewal of fixed-term tenancy" => 14, |
||||||
|
"Relet – tenant moved to care home" => 18, |
||||||
|
"Relet – tenant involved in a succession downsize" => 19, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.unittype_gn |
||||||
|
{ |
||||||
|
"Flat / maisonette" => 1, |
||||||
|
"Bed-sit" => 2, |
||||||
|
"House" => 7, |
||||||
|
"Bungalow" => 8, |
||||||
|
"Shared flat / maisonette" => 4, |
||||||
|
"Shared house" => 9, |
||||||
|
"Shared bungalow" => 10, |
||||||
|
"Other" => 6, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.incfreq |
||||||
|
{ |
||||||
|
"Weekly" => 1, |
||||||
|
"Monthly" => 2, |
||||||
|
"Yearly" => 3, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.benefits |
||||||
|
{ |
||||||
|
"All" => 1, |
||||||
|
"Some" => 2, |
||||||
|
"None" => 3, |
||||||
|
"Do not know" => 4, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.period |
||||||
|
{ |
||||||
|
"Weekly for 52 weeks" => 1, |
||||||
|
"Fortnightly" => 2, |
||||||
|
"Four-weekly" => 3, |
||||||
|
"Calendar monthly" => 4, |
||||||
|
"Weekly for 50 weeks" => 5, |
||||||
|
"Weekly for 49 weeks" => 6, |
||||||
|
"Weekly for 48 weeks" => 7, |
||||||
|
"Weekly for 47 weeks" => 8, |
||||||
|
"Weekly for 46 weeks" => 9, |
||||||
|
"Weekly for 53 weeks" => 10, |
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
def self.latime |
||||||
|
{ |
||||||
|
"Just moved to local authority area" => 1, |
||||||
|
"Less than 1 year" => 2, |
||||||
|
"1 to 2 years" => 7, |
||||||
|
"2 to 3 years" => 8, |
||||||
|
"3 to 4 years" => 9, |
||||||
|
"4 to 5 years" => 10, |
||||||
|
"5 years or more" => 5, |
||||||
|
"Do not know" => 6, |
||||||
|
} |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,106 @@ |
|||||||
|
class RenameFields < ActiveRecord::Migration[6.1] |
||||||
|
def change |
||||||
|
rename_column :case_logs, :person_1_age, :age1 |
||||||
|
rename_column :case_logs, :person_1_gender, :sex1 |
||||||
|
rename_column :case_logs, :tenant_ethnic_group, :ethnic |
||||||
|
rename_column :case_logs, :tenant_nationality, :national |
||||||
|
rename_column :case_logs, :person_1_economic_status, :ecstat1 |
||||||
|
rename_column :case_logs, :household_number_of_other_members, :hhmemb |
||||||
|
|
||||||
|
rename_column :case_logs, :person_2_relationship, :relat2 |
||||||
|
rename_column :case_logs, :person_2_age, :age2 |
||||||
|
rename_column :case_logs, :person_2_gender, :sex2 |
||||||
|
rename_column :case_logs, :person_2_economic_status, :ecstat2 |
||||||
|
|
||||||
|
rename_column :case_logs, :person_3_relationship, :relat3 |
||||||
|
rename_column :case_logs, :person_3_age, :age3 |
||||||
|
rename_column :case_logs, :person_3_gender, :sex3 |
||||||
|
rename_column :case_logs, :person_3_economic_status, :ecstat3 |
||||||
|
|
||||||
|
rename_column :case_logs, :person_4_relationship, :relat4 |
||||||
|
rename_column :case_logs, :person_4_age, :age4 |
||||||
|
rename_column :case_logs, :person_4_gender, :sex4 |
||||||
|
rename_column :case_logs, :person_4_economic_status, :ecstat4 |
||||||
|
|
||||||
|
rename_column :case_logs, :person_5_relationship, :relat5 |
||||||
|
rename_column :case_logs, :person_5_age, :age5 |
||||||
|
rename_column :case_logs, :person_5_gender, :sex5 |
||||||
|
rename_column :case_logs, :person_5_economic_status, :ecstat5 |
||||||
|
|
||||||
|
rename_column :case_logs, :person_6_relationship, :relat6 |
||||||
|
rename_column :case_logs, :person_6_age, :age6 |
||||||
|
rename_column :case_logs, :person_6_gender, :sex6 |
||||||
|
rename_column :case_logs, :person_6_economic_status, :ecstat6 |
||||||
|
|
||||||
|
rename_column :case_logs, :person_7_relationship, :relat7 |
||||||
|
rename_column :case_logs, :person_7_age, :age7 |
||||||
|
rename_column :case_logs, :person_7_gender, :sex7 |
||||||
|
rename_column :case_logs, :person_7_economic_status, :ecstat7 |
||||||
|
|
||||||
|
rename_column :case_logs, :person_8_relationship, :relat8 |
||||||
|
rename_column :case_logs, :person_8_age, :age8 |
||||||
|
rename_column :case_logs, :person_8_gender, :sex8 |
||||||
|
rename_column :case_logs, :person_8_economic_status, :ecstat8 |
||||||
|
|
||||||
|
rename_column :case_logs, :previous_housing_situation, :prevten |
||||||
|
rename_column :case_logs, :homelessness, :homeless |
||||||
|
rename_column :case_logs, :benefit_cap_spare_room_subsidy, :underoccupation_benefitcap |
||||||
|
rename_column :case_logs, :armed_forces_injured, :reservist |
||||||
|
rename_column :case_logs, :armed_forces_active, :leftreg |
||||||
|
rename_column :case_logs, :medical_conditions, :illness |
||||||
|
rename_column :case_logs, :pregnancy, :preg_occ |
||||||
|
|
||||||
|
rename_column :case_logs, :accessibility_requirements_fully_wheelchair_accessible_housing, :housingneeds_a |
||||||
|
rename_column :case_logs, :accessibility_requirements_wheelchair_access_to_essential_rooms, :housingneeds_b |
||||||
|
rename_column :case_logs, :accessibility_requirements_level_access_housing, :housingneeds_c |
||||||
|
rename_column :case_logs, :accessibility_requirements_other_disability_requirements, :housingneeds_f |
||||||
|
rename_column :case_logs, :accessibility_requirements_no_disability_requirements, :housingneeds_g |
||||||
|
rename_column :case_logs, :accessibility_requirements_do_not_know, :housingneeds_h |
||||||
|
|
||||||
|
rename_column :case_logs, :condition_effects_vision, :illness_type_1 |
||||||
|
rename_column :case_logs, :condition_effects_hearing, :illness_type_2 |
||||||
|
rename_column :case_logs, :condition_effects_mobility, :illness_type_3 |
||||||
|
rename_column :case_logs, :condition_effects_dexterity, :illness_type_4 |
||||||
|
rename_column :case_logs, :condition_effects_stamina, :illness_type_8 |
||||||
|
rename_column :case_logs, :condition_effects_learning, :illness_type_5 |
||||||
|
rename_column :case_logs, :condition_effects_memory, :illness_type_6 |
||||||
|
rename_column :case_logs, :condition_effects_mental_health, :illness_type_7 |
||||||
|
rename_column :case_logs, :condition_effects_social_or_behavioral, :illness_type_9 |
||||||
|
rename_column :case_logs, :condition_effects_other, :illness_type_10 |
||||||
|
|
||||||
|
rename_column :case_logs, :tenancy_start_date, :startdate |
||||||
|
rename_column :case_logs, :starter_tenancy, :startertenancy |
||||||
|
rename_column :case_logs, :fixed_term_tenancy, :tenancylength |
||||||
|
rename_column :case_logs, :tenancy_type, :tenancy |
||||||
|
rename_column :case_logs, :other_tenancy_type, :tenancyother |
||||||
|
rename_column :case_logs, :letting_type, :lettype |
||||||
|
rename_column :case_logs, :letting_provider, :landlord |
||||||
|
rename_column :case_logs, :property_vacancy_reason, :rsnvac |
||||||
|
rename_column :case_logs, :property_unit_type, :unittype_gn |
||||||
|
rename_column :case_logs, :property_number_of_bedrooms, :beds |
||||||
|
rename_column :case_logs, :property_number_of_times_relet, :offered |
||||||
|
rename_column :case_logs, :property_wheelchair_accessible, :wchair |
||||||
|
rename_column :case_logs, :net_income, :earnings |
||||||
|
rename_column :case_logs, :net_income_frequency, :incfreq |
||||||
|
rename_column :case_logs, :net_income_uc_proportion, :benefits |
||||||
|
rename_column :case_logs, :rent_frequency, :period |
||||||
|
rename_column :case_logs, :basic_rent, :brent |
||||||
|
rename_column :case_logs, :service_charge, :scharge |
||||||
|
rename_column :case_logs, :personal_service_charge, :pscharge |
||||||
|
rename_column :case_logs, :support_charge, :supcharg |
||||||
|
rename_column :case_logs, :total_charge, :tcharge |
||||||
|
rename_column :case_logs, :time_lived_in_la, :layear |
||||||
|
rename_column :case_logs, :time_on_la_waiting_list, :lawaitlist |
||||||
|
rename_column :case_logs, :reasonable_preference, :reasonpref |
||||||
|
|
||||||
|
rename_column :case_logs, :reasonable_preference_reason_homeless, :rp_homeless |
||||||
|
rename_column :case_logs, :reasonable_preference_reason_unsatisfactory_housing, :rp_insan_unsat |
||||||
|
rename_column :case_logs, :reasonable_preference_reason_medical_grounds, :rp_medwel |
||||||
|
rename_column :case_logs, :reasonable_preference_reason_avoid_hardship, :rp_hardship |
||||||
|
rename_column :case_logs, :reasonable_preference_reason_do_not_know, :rp_dontknow |
||||||
|
|
||||||
|
rename_column :case_logs, :cbl_letting, :cbl |
||||||
|
rename_column :case_logs, :chr_letting, :chr |
||||||
|
rename_column :case_logs, :cap_letting, :cap |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,131 @@ |
|||||||
|
class ChangeFieldTypes < ActiveRecord::Migration[6.1] |
||||||
|
def up |
||||||
|
change_table :case_logs, bulk: true do |t| |
||||||
|
t.change :ethnic, "integer USING ethnic::integer" |
||||||
|
t.change :national, "integer USING national::integer" |
||||||
|
t.change :ecstat1, "integer USING ecstat1::integer" |
||||||
|
t.change :ecstat2, "integer USING ecstat2::integer" |
||||||
|
t.change :ecstat3, "integer USING ecstat3::integer" |
||||||
|
t.change :ecstat4, "integer USING ecstat4::integer" |
||||||
|
t.change :ecstat5, "integer USING ecstat5::integer" |
||||||
|
t.change :ecstat6, "integer USING ecstat6::integer" |
||||||
|
t.change :ecstat7, "integer USING ecstat7::integer" |
||||||
|
t.change :ecstat8, "integer USING ecstat8::integer" |
||||||
|
t.change :prevten, "integer USING prevten::integer" |
||||||
|
t.change :homeless, "integer USING homeless::integer" |
||||||
|
t.change :underoccupation_benefitcap, "integer USING underoccupation_benefitcap::integer" |
||||||
|
t.change :reservist, "integer USING reservist::integer" |
||||||
|
t.change :leftreg, "integer USING leftreg::integer" |
||||||
|
t.change :illness, "integer USING illness::integer" |
||||||
|
t.change :preg_occ, "integer USING preg_occ::integer" |
||||||
|
t.change :housingneeds_a, "integer USING housingneeds_a::integer" |
||||||
|
t.change :housingneeds_b, "integer USING housingneeds_b::integer" |
||||||
|
t.change :housingneeds_c, "integer USING housingneeds_c::integer" |
||||||
|
t.change :housingneeds_f, "integer USING housingneeds_f::integer" |
||||||
|
t.change :housingneeds_g, "integer USING housingneeds_g::integer" |
||||||
|
t.change :housingneeds_h, "integer USING housingneeds_h::integer" |
||||||
|
t.change :illness_type_1, "integer USING illness_type_1::integer" |
||||||
|
t.change :illness_type_2, "integer USING illness_type_2::integer" |
||||||
|
t.change :illness_type_3, "integer USING illness_type_3::integer" |
||||||
|
t.change :illness_type_4, "integer USING illness_type_4::integer" |
||||||
|
t.change :illness_type_5, "integer USING illness_type_5::integer" |
||||||
|
t.change :illness_type_6, "integer USING illness_type_6::integer" |
||||||
|
t.change :illness_type_7, "integer USING illness_type_7::integer" |
||||||
|
t.change :illness_type_8, "integer USING illness_type_8::integer" |
||||||
|
t.change :illness_type_9, "integer USING illness_type_9::integer" |
||||||
|
t.change :illness_type_10, "integer USING illness_type_10::integer" |
||||||
|
t.change :rp_homeless, "integer USING rp_homeless::integer" |
||||||
|
t.change :rp_insan_unsat, "integer USING rp_insan_unsat::integer" |
||||||
|
t.change :rp_medwel, "integer USING rp_medwel::integer" |
||||||
|
t.change :rp_hardship, "integer USING rp_hardship::integer" |
||||||
|
t.change :rp_dontknow, "integer USING rp_dontknow::integer" |
||||||
|
t.change :cbl, "integer USING cbl::integer" |
||||||
|
t.change :chr, "integer USING chr::integer" |
||||||
|
t.change :cap, "integer USING cap::integer" |
||||||
|
t.change :startertenancy, "integer USING startertenancy::integer" |
||||||
|
t.change :tenancylength, "integer USING tenancylength::integer" |
||||||
|
t.change :tenancy, "integer USING tenancy::integer" |
||||||
|
t.change :landlord, "integer USING landlord::integer" |
||||||
|
t.change :rsnvac, "integer USING rsnvac::integer" |
||||||
|
t.change :unittype_gn, "integer USING unittype_gn::integer" |
||||||
|
t.change :beds, "integer USING beds::integer" |
||||||
|
t.change :wchair, "integer USING wchair::integer" |
||||||
|
t.change :incfreq, "integer USING incfreq::integer" |
||||||
|
t.change :benefits, "integer USING benefits::integer" |
||||||
|
t.change :period, "integer USING period::integer" |
||||||
|
t.change :brent, "integer USING brent::integer" |
||||||
|
t.change :scharge, "integer USING scharge::integer" |
||||||
|
t.change :pscharge, "integer USING pscharge::integer" |
||||||
|
t.change :supcharg, "integer USING supcharg::integer" |
||||||
|
t.change :tcharge, "integer USING tcharge::integer" |
||||||
|
t.change :layear, "integer USING layear::integer" |
||||||
|
t.change :lawaitlist, "integer USING lawaitlist::integer" |
||||||
|
t.change :reasonpref, "integer USING reasonpref::integer" |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
def down |
||||||
|
change_table :case_logs, bulk: true do |t| |
||||||
|
t.change :ethnic, :string |
||||||
|
t.change :national, :string |
||||||
|
t.change :ecstat1, :string |
||||||
|
t.change :ecstat2, :string |
||||||
|
t.change :ecstat3, :string |
||||||
|
t.change :ecstat4, :string |
||||||
|
t.change :ecstat5, :string |
||||||
|
t.change :ecstat6, :string |
||||||
|
t.change :ecstat7, :string |
||||||
|
t.change :ecstat8, :string |
||||||
|
t.change :prevten, :string |
||||||
|
t.change :homeless, :string |
||||||
|
t.change :underoccupation_benefitcap, :string |
||||||
|
t.change :reservist, :string |
||||||
|
t.change :leftreg, :string |
||||||
|
t.change :illness, :string |
||||||
|
t.change :preg_occ, :string |
||||||
|
t.change :housingneeds_a, "boolean USING housingneeds_a::boolean" |
||||||
|
t.change :housingneeds_b, "boolean USING housingneeds_b::boolean" |
||||||
|
t.change :housingneeds_c, "boolean USING housingneeds_c::boolean" |
||||||
|
t.change :housingneeds_f, "boolean USING housingneeds_f::boolean" |
||||||
|
t.change :housingneeds_g, "boolean USING housingneeds_g::boolean" |
||||||
|
t.change :housingneeds_h, "boolean USING housingneeds_h::boolean" |
||||||
|
t.change :illness_type_1, "boolean USING illness_type_1::boolean" |
||||||
|
t.change :illness_type_2, "boolean USING illness_type_2::boolean" |
||||||
|
t.change :illness_type_3, "boolean USING illness_type_3::boolean" |
||||||
|
t.change :illness_type_4, "boolean USING illness_type_4::boolean" |
||||||
|
t.change :illness_type_5, "boolean USING illness_type_5::boolean" |
||||||
|
t.change :illness_type_6, "boolean USING illness_type_6::boolean" |
||||||
|
t.change :illness_type_7, "boolean USING illness_type_7::boolean" |
||||||
|
t.change :illness_type_8, "boolean USING illness_type_8::boolean" |
||||||
|
t.change :illness_type_9, "boolean USING illness_type_9::boolean" |
||||||
|
t.change :illness_type_10, "boolean USING illness_type_10::boolean" |
||||||
|
t.change :rp_homeless, :boolean |
||||||
|
t.change :rp_insan_unsat, :boolean |
||||||
|
t.change :rp_medwel, :boolean |
||||||
|
t.change :rp_hardship, :boolean |
||||||
|
t.change :rp_dontknow, :boolean |
||||||
|
t.change :cbl_letting, :string |
||||||
|
t.change :chr_letting, :string |
||||||
|
t.change :cap_letting, :string |
||||||
|
t.change :startertenancy, :string |
||||||
|
t.change :tenancylength, :string |
||||||
|
t.change :tenancy, :string |
||||||
|
t.change :landlord, :string |
||||||
|
t.change :rsnvac, :string |
||||||
|
t.change :unittype_gn, :string |
||||||
|
t.change :beds, :string |
||||||
|
t.change :wchair, :string |
||||||
|
t.change :incfreq, :string |
||||||
|
t.change :benefits, :string |
||||||
|
t.change :period, :string |
||||||
|
t.change :brent, :string |
||||||
|
t.change :scharge, :string |
||||||
|
t.change :pscharge, :string |
||||||
|
t.change :supcharg, :string |
||||||
|
t.change :tcharge, :string |
||||||
|
t.change :layear, :string |
||||||
|
t.change :lawaitlist, :string |
||||||
|
t.change :reasonpref, :string |
||||||
|
end |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,11 @@ |
|||||||
|
### ADR - 008: Field Names |
||||||
|
|
||||||
|
We are changing the schema to reflect the way the data is stored in CORE. |
||||||
|
This is due to the SPSS queries that are being performed by ADD and the complexity that would come with changing them. |
||||||
|
|
||||||
|
The field names are saved lowercase as opposed to the uppercase versions we see in CORE. |
||||||
|
This is due to Ruby expecting the uppercase parameters to be constants and database fields are expected to be lower case. |
||||||
|
These fields could be mapped to their uppercase versions during the replication if needed. |
||||||
|
|
||||||
|
A lot of the values are now also being stored as enums. |
||||||
|
This gives as some validation by default as the values not defined in the enums will fail to save. |
File diff suppressed because it is too large
Load Diff
@ -1,130 +1,130 @@ |
|||||||
{ |
{ |
||||||
"case_log": |
"case_log": { |
||||||
{ |
"tenant_code": "T657", |
||||||
"tenant_code": "T657", |
"age1": 35, |
||||||
"person_1_age": 35, |
"sex1": "Female", |
||||||
"person_1_gender": "Female", |
"ethnic": "White: English/Scottish/Welsh/Northern Irish/British", |
||||||
"tenant_ethnic_group": "White: English/Scottish/Welsh/Northern Irish/British", |
"national": "UK national resident in UK", |
||||||
"tenant_nationality": "UK national resident in UK", |
"prevten": "Private sector tenancy", |
||||||
"previous_housing_situation": "Private sector tenancy", |
"armed_forces": "Yes - a regular", |
||||||
"armed_forces": "Yes - a regular", |
"ecstat1": "Full-time - 30 hours or more", |
||||||
"person_1_economic_status": "Full-time - 30 hours or more", |
"hhmemb": 7, |
||||||
"household_number_of_other_members": 7, |
"relat2": "Partner", |
||||||
"person_2_relationship": "Partner", |
"age2": 32, |
||||||
"person_2_age": 32, |
"sex2": "Male", |
||||||
"person_2_gender": "Male", |
"ecstat2": "Not seeking work", |
||||||
"person_2_economic_status": "Not seeking work", |
"relat3": "Child - includes young adult and grown-up", |
||||||
"person_3_relationship": "Child - includes young adult and grown-up", |
"age3": 12, |
||||||
"person_3_age": 12, |
"sex3": "Male", |
||||||
"person_3_gender": "Male", |
"ecstat3": "Child under 16", |
||||||
"person_3_economic_status": "Child under 16", |
"relat4": "Child - includes young adult and grown-up", |
||||||
"person_4_relationship": "Child - includes young adult and grown-up", |
"age4": 12, |
||||||
"person_4_age": 12, |
"sex4": "Female", |
||||||
"person_4_gender": "Female", |
"ecstat4": "Child under 16", |
||||||
"person_4_economic_status": "Child under 16", |
"relat5": "Child - includes young adult and grown-up", |
||||||
"person_5_relationship": "Child - includes young adult and grown-up", |
"age5": 10, |
||||||
"person_5_age": 10, |
"sex5": "Non-binary", |
||||||
"person_5_gender": "Non-binary", |
"ecstat5": "Child under 16", |
||||||
"person_5_economic_status": "Child under 16", |
"relat6": "Child - includes young adult and grown-up", |
||||||
"person_6_relationship": "Child - includes young adult and grown-up", |
"age6": 5, |
||||||
"person_6_age": 5, |
"sex6": "Prefer not to say", |
||||||
"person_6_gender": "Prefer not to say", |
"ecstat6": "Child under 16", |
||||||
"person_6_economic_status": "Child under 16", |
"relat7": "Child - includes young adult and grown-up", |
||||||
"person_7_relationship": "Child - includes young adult and grown-up", |
"age7": 5, |
||||||
"person_7_age": 5, |
"sex7": "Prefer not to say", |
||||||
"person_7_gender": "Prefer not to say", |
"ecstat7": "Child under 16", |
||||||
"person_7_economic_status": "Child under 16", |
"relat8": "Child - includes young adult and grown-up", |
||||||
"person_8_relationship": "Child - includes young adult and grown-up", |
"age8": 2, |
||||||
"person_8_age": 2, |
"sex8": "Prefer not to say", |
||||||
"person_8_gender": "Prefer not to say", |
"ecstat8": "Child under 16", |
||||||
"person_8_economic_status": "Child under 16", |
"homeless": "Yes - other homelessness", |
||||||
"homelessness": "Yes - other homelessness", |
"reason_for_leaving_last_settled_home": "Other problems with neighbours", |
||||||
"reason_for_leaving_last_settled_home": "Other problems with neighbours", |
"underoccupation_benefitcap": "No", |
||||||
"benefit_cap_spare_room_subsidy": "No", |
"leftreg": "No - they left up to 5 years ago", |
||||||
"armed_forces_active": "No", |
"reservist": "No", |
||||||
"armed_forces_injured": "No", |
"armed_forces_partner": "No", |
||||||
"armed_forces_partner": "No", |
"illness": "Yes", |
||||||
"medical_conditions": "Yes", |
"preg_occ": "No", |
||||||
"pregnancy": "No", |
"accessibility_requirements": "No", |
||||||
"accessibility_requirements": "No", |
"condition_effects": "dummy", |
||||||
"condition_effects": "dummy", |
"tenancy_code": "BZ757", |
||||||
"tenancy_code": "BZ757", |
"startdate": "12/03/2019", |
||||||
"tenancy_start_date": "12/03/2019", |
"startertenancy": "No", |
||||||
"starter_tenancy": "No", |
"tenancylength": "5", |
||||||
"fixed_term_tenancy": "5", |
"tenancy": "Fixed term – Secure", |
||||||
"tenancy_type": "Fixed term – Secure", |
"lettype": "Affordable Rent - General Needs", |
||||||
"letting_type": "Affordable Rent - General Needs", |
"landlord": "This landlord", |
||||||
"letting_provider": "This landlord", |
"property_location": "Barnet", |
||||||
"property_location": "Barnet", |
"previous_postcode": "NW1 5TY", |
||||||
"previous_postcode": "NW1 5TY", |
"property_relet": "No", |
||||||
"property_relet": "No", |
"rsnvac": "Relet - tenant abandoned property", |
||||||
"property_vacancy_reason": "Relet - tenant abandoned property", |
"property_reference": "P9876", |
||||||
"property_reference": "P9876", |
"unittype_gn": "House", |
||||||
"property_unit_type": "House", |
"property_building_type": "dummy", |
||||||
"property_building_type": "dummy", |
"beds": 3, |
||||||
"property_number_of_bedrooms": 3, |
"property_void_date": "03/11/2019", |
||||||
"property_void_date": "03/11/2019", |
"property_major_repairs": "Yes", |
||||||
"property_major_repairs": "Yes", |
"property_major_repairs_date": "05/05/2020", |
||||||
"property_major_repairs_date": "05/05/2020", |
"offered": 2, |
||||||
"property_number_of_times_relet": 2, |
"wchair": "Yes", |
||||||
"property_wheelchair_accessible": true, |
"net_income_known": "Yes", |
||||||
"net_income_known": "Yes", |
"earnings": 0, |
||||||
"net_income": 0, |
"incfreq": null, |
||||||
"net_income_frequency": null, |
"benefits": "Some", |
||||||
"net_income_uc_proportion": "Some", |
"housing_benefit": "Universal Credit with housing element, but not Housing Benefit", |
||||||
"housing_benefit": "Universal Credit with housing element, but not Housing Benefit", |
"period": "Fortnightly", |
||||||
"rent_frequency": "Weekly", |
"brent": 200, |
||||||
"basic_rent": 200, |
"scharge": 50, |
||||||
"service_charge": 50, |
"pscharge": 40, |
||||||
"personal_service_charge": 40, |
"supcharg": 35, |
||||||
"support_charge": 35, |
"tcharge": 325, |
||||||
"total_charge": 325, |
"outstanding_amount": "Yes", |
||||||
"outstanding_amount": "Yes", |
"layear": "1 to 2 years", |
||||||
"time_lived_in_la": "1 to 2 years", |
"lawaitlist": "Less than 1 year", |
||||||
"time_on_la_waiting_list": "Less than 1 year", |
"previous_la": "Ashford", |
||||||
"previous_la": "Ashford", |
"property_postcode": "SE2 6RT", |
||||||
"property_postcode": "SE2 6RT", |
"reasonpref": "Yes", |
||||||
"reasonable_preference": "Yes", |
"reasonable_preference_reason": "dummy", |
||||||
"reasonable_preference_reason": "dummy", |
"cbl": "Yes", |
||||||
"cbl_letting": true, |
"chr": "Yes", |
||||||
"chr_letting": false, |
"cap": "No", |
||||||
"cap_letting": false, |
"outstanding_rent_or_charges": 25, |
||||||
"outstanding_rent_or_charges": 25, |
"other_reason_for_leaving_last_settled_home": null, |
||||||
"other_reason_for_leaving_last_settled_home": null, |
"housingneeds_a": "Yes", |
||||||
"accessibility_requirements_fully_wheelchair_accessible_housing": true, |
"housingneeds_b": "No", |
||||||
"accessibility_requirements_wheelchair_access_to_essential_rooms": false, |
"housingneeds_c": "No", |
||||||
"accessibility_requirements_level_access_housing": false, |
"housingneeds_f": "No", |
||||||
"accessibility_requirements_other_disability_requirements": false, |
"housingneeds_g": "No", |
||||||
"accessibility_requirements_no_disability_requirements": false, |
"housingneeds_h": "No", |
||||||
"accessibility_requirements_do_not_know": false, |
"accessibility_requirements_prefer_not_to_say": "No", |
||||||
"accessibility_requirements_prefer_not_to_say": false, |
"illness_type_1": "No", |
||||||
"condition_effects_vision": false, |
"illness_type_2": "Yes", |
||||||
"condition_effects_hearing": true, |
"illness_type_3": "No", |
||||||
"condition_effects_mobility": false, |
"illness_type_4": "No", |
||||||
"condition_effects_dexterity": false, |
"illness_type_8": "No", |
||||||
"condition_effects_stamina": false, |
"illness_type_5": "No", |
||||||
"condition_effects_learning": false, |
"illness_type_6": "No", |
||||||
"condition_effects_memory": false, |
"illness_type_7": "No", |
||||||
"condition_effects_mental_health": false, |
"illness_type_9": "No", |
||||||
"condition_effects_social_or_behavioral": false, |
"illness_type_10": "No", |
||||||
"condition_effects_other": false, |
"condition_effects_prefer_not_to_say": "Yes", |
||||||
"condition_effects_prefer_not_to_say": true, |
"rp_homeless": "Yes", |
||||||
"reasonable_preference_reason_homeless": false, |
"rp_insan_unsat": "No", |
||||||
"reasonable_preference_reason_unsatisfactory_housing": false, |
"rp_medwel": "No", |
||||||
"reasonable_preference_reason_medical_grounds": false, |
"rp_hardship": "No", |
||||||
"reasonable_preference_reason_avoid_hardship": false, |
"rp_dontknow": "No", |
||||||
"reasonable_preference_reason_do_not_know": true, |
"discarded_at": "05/05/2020", |
||||||
"other_tenancy_type": "", |
"override_net_income_validation": "", |
||||||
"gdpr_acceptance": "", |
"gdpr_acceptance": "", |
||||||
"gdpr_declined": "", |
"gdpr_declined": "", |
||||||
"property_owner_organisation": "", |
"property_owner_organisation": "", |
||||||
"property_manager_organisation": "", |
"property_manager_organisation": "", |
||||||
"sale_or_letting": "", |
"sale_or_letting": "", |
||||||
"tenant_same_property_renewal": "", |
"tenant_same_property_renewal": "", |
||||||
"rent_type": "", |
"rent_type": "", |
||||||
"intermediate_rent_product_name": "", |
"intermediate_rent_product_name": "", |
||||||
"needs_type": "", |
"needs_type": "", |
||||||
"sale_completion_date" : "", |
"sale_completion_date": "", |
||||||
"purchaser_code": "" |
"purchaser_code": "" |
||||||
} |
|
||||||
} |
} |
||||||
|
} |
||||||
|
Loading…
Reference in new issue