From 7821742b5c02a4450df339c02aa7fceb1a995aa0 Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Thu, 19 Feb 2026 13:53:12 +0000 Subject: [PATCH] CLDC-4151: Split Referral into three questions (#3150) * CLDC-4151: Note deprecations of existing referral questions * CLDC-4151: Add new cols to lettings log model * CLDC-4151: Add new referrals questions * CLDC-4151: Remove referral value check * CLDC-4151: Add new fields to bulk upload use new fields as presented in bulk upload * CLDC-4151: Update tests also add bulk upload file to test with * CLDC-4151: Ignore tests failing for later tickets * fixup! CLDC-4151: Add new referrals questions start q nums from 2026 * CLDC-4151: Add model tests for new questions * fixup! CLDC-4151: Add new fields to bulk upload export old_visible_id set MAX_COLUMNS correctly check .prp? for prp cols * fixup! CLDC-4151: Update tests clarify tests that may update * fixup! CLDC-4151: Add new fields to bulk upload handle the old_visible_id not existing use override org ID only for the output owning ID. it's only passed as eg ORG1 * CLDC-4151: Add new questions to log factory * fixup! CLDC-4151: Add new fields to bulk upload leave field_131 validations till later * CLDC-4188: Add LA flow splits the referral_register question and pages into two, as its not easy to have the answers be dependent if the owning organisation changes type, reset the referral register question. the other questions do not need to be reset as they are no longer routed to * CLDC-4188: Infer referral_register for renewals needs a new dependencies array for 2026 this handles inferring as well as clearing inferred answers if the prior answer changes * CLDC-4188: Add validation between prevten and referral_register block two other validations from previous years * CLDC-4188: Update tests * CLDC-4188: Ignore tests failing for future tickets * CLDC-4188: Update existing tests needed as should_reset_referral_register? calls a .find() * fixup! CLDC-4188: Add validation between prevten and referral_register use .prp? improve grammar * fixup! CLDC-4188: Infer referral_register for renewals extract dependencies to common list * fixup! CLDC-4188: Update tests use before and context blocks better * fixup! CLDC-4188: Update tests lint * fixup! CLDC-4188: Update tests remove unneeded referral_type set * CLDC-4189: Add PRP flow * CLDC-4189: Update validation between prevten and referral_register * CLDC-4189: Add tests * fixup! CLDC-4189: Add PRP flow fix typo Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com> * fixup! CLDC-4189: Add tests fix typo * fixup! CLDC-4189: Add tests fix missing cases in page specs use a loop and before blocks for household validation tests * CLDC-4189: Ensure log is not classed as generan needs if prevten isnt answered * fixup! CLDC-4189: Add tests add cases for other internal transfer flow * CLDC-4151: Add final question numbers * fixup! CLDC-4189: Update validation between prevten and referral_register include new code 40 from CLDC-4149 * fixup! CLDC-4151: Add final question numbers reinstate fallback * CLDC-4190: Q84 Referral BU validations (#3155) * CLDC-4151: Note deprecations of existing referral questions * CLDC-4151: Add new cols to lettings log model * CLDC-4151: Add new referrals questions * CLDC-4151: Remove referral value check * CLDC-4151: Add new fields to bulk upload use new fields as presented in bulk upload * CLDC-4151: Update tests also add bulk upload file to test with * CLDC-4151: Ignore tests failing for later tickets * fixup! CLDC-4151: Add new referrals questions start q nums from 2026 * CLDC-4151: Add model tests for new questions * fixup! CLDC-4151: Add new fields to bulk upload export old_visible_id set MAX_COLUMNS correctly check .prp? for prp cols * fixup! CLDC-4151: Update tests clarify tests that may update * fixup! CLDC-4151: Add new fields to bulk upload handle the old_visible_id not existing use override org ID only for the output owning ID. it's only passed as eg ORG1 * CLDC-4151: Add new questions to log factory * fixup! CLDC-4151: Add new fields to bulk upload leave field_131 validations till later * CLDC-4188: Add LA flow splits the referral_register question and pages into two, as its not easy to have the answers be dependent if the owning organisation changes type, reset the referral register question. the other questions do not need to be reset as they are no longer routed to * CLDC-4188: Infer referral_register for renewals needs a new dependencies array for 2026 this handles inferring as well as clearing inferred answers if the prior answer changes * CLDC-4188: Add validation between prevten and referral_register block two other validations from previous years * CLDC-4188: Update tests * CLDC-4188: Ignore tests failing for future tickets * CLDC-4188: Update existing tests needed as should_reset_referral_register? calls a .find() * fixup! CLDC-4188: Add validation between prevten and referral_register use .prp? improve grammar * fixup! CLDC-4188: Infer referral_register for renewals extract dependencies to common list * fixup! CLDC-4188: Update tests use before and context blocks better * fixup! CLDC-4188: Update tests lint * fixup! CLDC-4188: Update tests remove unneeded referral_type set * CLDC-4189: Add PRP flow * CLDC-4189: Update validation between prevten and referral_register * CLDC-4189: Add tests * fixup! CLDC-4189: Add PRP flow fix typo Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com> * fixup! CLDC-4189: Add tests fix typo * fixup! CLDC-4189: Add tests fix missing cases in page specs use a loop and before blocks for household validation tests * CLDC-4189: Ensure log is not classed as generan needs if prevten isnt answered * fixup! CLDC-4189: Add tests add cases for other internal transfer flow * CLDC-4190: Invalidate all referral fields if any are wrong * CLDC-4190: Remove other validations on referral fields * CLDC-4190: Ignore referral validation if BU is renewal * CLDC-4190: Add tests * fixup! CLDC-4190: Invalidate all referral fields if any are wrong add punctuation to comment name validation fields better * fixup! CLDC-4190: Add tests make test names clearer * CLDC-4190: Final field fixes --------- Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com> * CLDC-4191: Q84 Referral CSV and XML export (#3157) * CLDC-4151: Note deprecations of existing referral questions * CLDC-4151: Add new cols to lettings log model * CLDC-4151: Add new referrals questions * CLDC-4151: Remove referral value check * CLDC-4151: Add new fields to bulk upload use new fields as presented in bulk upload * CLDC-4151: Update tests also add bulk upload file to test with * CLDC-4151: Ignore tests failing for later tickets * fixup! CLDC-4151: Add new referrals questions start q nums from 2026 * CLDC-4151: Add model tests for new questions * fixup! CLDC-4151: Add new fields to bulk upload export old_visible_id set MAX_COLUMNS correctly check .prp? for prp cols * fixup! CLDC-4151: Update tests clarify tests that may update * fixup! CLDC-4151: Add new fields to bulk upload handle the old_visible_id not existing use override org ID only for the output owning ID. it's only passed as eg ORG1 * CLDC-4151: Add new questions to log factory * fixup! CLDC-4151: Add new fields to bulk upload leave field_131 validations till later * CLDC-4188: Add LA flow splits the referral_register question and pages into two, as its not easy to have the answers be dependent if the owning organisation changes type, reset the referral register question. the other questions do not need to be reset as they are no longer routed to * CLDC-4188: Infer referral_register for renewals needs a new dependencies array for 2026 this handles inferring as well as clearing inferred answers if the prior answer changes * CLDC-4188: Add validation between prevten and referral_register block two other validations from previous years * CLDC-4188: Update tests * CLDC-4188: Ignore tests failing for future tickets * CLDC-4188: Update existing tests needed as should_reset_referral_register? calls a .find() * fixup! CLDC-4188: Add validation between prevten and referral_register use .prp? improve grammar * fixup! CLDC-4188: Infer referral_register for renewals extract dependencies to common list * fixup! CLDC-4188: Update tests use before and context blocks better * fixup! CLDC-4188: Update tests lint * fixup! CLDC-4188: Update tests remove unneeded referral_type set * CLDC-4189: Add PRP flow * CLDC-4189: Update validation between prevten and referral_register * CLDC-4189: Add tests * fixup! CLDC-4189: Add PRP flow fix typo Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com> * fixup! CLDC-4189: Add tests fix typo * fixup! CLDC-4189: Add tests fix missing cases in page specs use a loop and before blocks for household validation tests * CLDC-4189: Ensure log is not classed as generan needs if prevten isnt answered * fixup! CLDC-4189: Add tests add cases for other internal transfer flow * CLDC-4190: Invalidate all referral fields if any are wrong * CLDC-4190: Remove other validations on referral fields * CLDC-4190: Ignore referral validation if BU is renewal * CLDC-4190: Add tests * fixup! CLDC-4190: Invalidate all referral fields if any are wrong add punctuation to comment name validation fields better * fixup! CLDC-4190: Add tests make test names clearer * CLDC-4191: Update CSV export tests the export happens by default, no changes needed here * CLDC-4191: Add new referral fields to 2026 exports remove old referral fields from 2026 exports ensure new referral fields don't show in pre 2026 exports * CLDC-4190: Final field fixes --------- Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com> --------- Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com> --- .../bulk_upload/lettings_log_to_csv.rb | 7 +- .../lettings_log_variables.rb | 60 +++-- .../form/lettings/pages/referral_direct.rb | 2 + .../lettings/pages/referral_general_needs.rb | 1 + .../pages/referral_general_needs_prp.rb | 1 + .../form/lettings/pages/referral_hsc.rb | 2 + .../form/lettings/pages/referral_justice.rb | 2 + app/models/form/lettings/pages/referral_la.rb | 2 + .../form/lettings/pages/referral_noms_hr.rb | 15 ++ .../lettings/pages/referral_noms_la_hr.rb | 15 ++ .../pages/referral_org_directly_referred.rb | 15 ++ .../lettings/pages/referral_org_nominated.rb | 15 ++ .../form/lettings/pages/referral_prp.rb | 2 + .../lettings/pages/referral_register_la.rb | 15 ++ .../lettings/pages/referral_register_prp.rb | 15 ++ .../pages/referral_supported_housing.rb | 1 + .../pages/referral_supported_housing_prp.rb | 1 + .../form/lettings/pages/referral_type.rb | 2 + .../lettings/pages/referral_value_check.rb | 1 + .../lettings/questions/referral_direct.rb | 2 + .../questions/referral_general_needs.rb | 1 + .../questions/referral_general_needs_prp.rb | 1 + .../form/lettings/questions/referral_hsc.rb | 2 + .../lettings/questions/referral_justice.rb | 2 + .../form/lettings/questions/referral_la.rb | 2 + .../form/lettings/questions/referral_noms.rb | 49 ++++ .../form/lettings/questions/referral_org.rb | 85 ++++++ .../form/lettings/questions/referral_prp.rb | 2 + .../lettings/questions/referral_register.rb | 56 ++++ .../questions/referral_supported_housing.rb | 1 + .../referral_supported_housing_prp.rb | 1 + .../form/lettings/questions/referral_type.rb | 2 + .../subsections/household_situation.rb | 14 +- app/models/form/question.rb | 7 + app/models/lettings_log.rb | 43 ++- app/models/organisation.rb | 1 + .../validations/household_validations.rb | 11 +- .../lettings/year2026/csv_parser.rb | 4 +- .../lettings/year2026/row_parser.rb | 131 ++++++--- .../exports/lettings_log_export_constants.rb | 9 +- .../2026/lettings/household_situation.en.yml | 24 +- .../2026/lettings/soft_validations.en.yml | 9 - .../lettings/2026/bulk_upload.en.yml | 3 +- .../validations/lettings/household.en.yml | 4 + .../20260123150201_add2026_referral_fields.rb | 9 + db/schema.rb | 3 + spec/factories/lettings_log.rb | 3 + .../exports/general_needs_log_26_27.xml | 4 +- .../files/2026_27_lettings_bulk_upload.csv | 18 +- .../lettings_log_csv_export_codes_26.csv | 6 +- .../lettings_log_csv_export_labels_26.csv | 6 +- ...gs_log_csv_export_non_support_codes_26.csv | 6 +- ...s_log_csv_export_non_support_labels_26.csv | 6 +- .../lettings_download_26_27.csv | 3 + .../tasks/log_variable_definitions_spec.rb | 2 +- .../lettings/pages/referral_noms_hr_spec.rb | 79 ++++++ .../pages/referral_noms_la_hr_spec.rb | 79 ++++++ .../referral_org_directly_referred_spec.rb | 79 ++++++ .../pages/referral_org_nominated_spec.rb | 79 ++++++ .../pages/referral_register_la_spec.rb | 78 ++++++ .../pages/referral_register_prp_spec.rb | 78 ++++++ .../lettings/questions/referral_noms_spec.rb | 83 ++++++ .../lettings/questions/referral_org_spec.rb | 119 +++++++++ .../questions/referral_register_spec.rb | 104 ++++++++ .../subsections/household_situation_spec.rb | 37 +-- .../validations/household_validations_spec.rb | 204 +++++++++++++- .../bulk_upload/lettings/validator_spec.rb | 8 +- .../lettings/year2026/csv_parser_spec.rb | 6 +- .../lettings/year2026/row_parser_spec.rb | 249 ++++++++++++++++-- .../csv/lettings_log_csv_service_spec.rb | 4 +- .../merge/merge_organisations_service_spec.rb | 20 ++ 71 files changed, 1833 insertions(+), 179 deletions(-) create mode 100644 app/models/form/lettings/pages/referral_noms_hr.rb create mode 100644 app/models/form/lettings/pages/referral_noms_la_hr.rb create mode 100644 app/models/form/lettings/pages/referral_org_directly_referred.rb create mode 100644 app/models/form/lettings/pages/referral_org_nominated.rb create mode 100644 app/models/form/lettings/pages/referral_register_la.rb create mode 100644 app/models/form/lettings/pages/referral_register_prp.rb create mode 100644 app/models/form/lettings/questions/referral_noms.rb create mode 100644 app/models/form/lettings/questions/referral_org.rb create mode 100644 app/models/form/lettings/questions/referral_register.rb create mode 100644 db/migrate/20260123150201_add2026_referral_fields.rb create mode 100644 spec/models/form/lettings/pages/referral_noms_hr_spec.rb create mode 100644 spec/models/form/lettings/pages/referral_noms_la_hr_spec.rb create mode 100644 spec/models/form/lettings/pages/referral_org_directly_referred_spec.rb create mode 100644 spec/models/form/lettings/pages/referral_org_nominated_spec.rb create mode 100644 spec/models/form/lettings/pages/referral_register_la_spec.rb create mode 100644 spec/models/form/lettings/pages/referral_register_prp_spec.rb create mode 100644 spec/models/form/lettings/questions/referral_noms_spec.rb create mode 100644 spec/models/form/lettings/questions/referral_org_spec.rb create mode 100644 spec/models/form/lettings/questions/referral_register_spec.rb diff --git a/app/helpers/bulk_upload/lettings_log_to_csv.rb b/app/helpers/bulk_upload/lettings_log_to_csv.rb index c483f4754..ec36d1911 100644 --- a/app/helpers/bulk_upload/lettings_log_to_csv.rb +++ b/app/helpers/bulk_upload/lettings_log_to_csv.rb @@ -224,7 +224,7 @@ class BulkUpload::LettingsLogToCsv chr, cap, accessible_register, - log.referral, + log.owning_organisation.la? ? log.referral_register : nil, net_income_known, log.incfreq, log.earnings, @@ -263,7 +263,10 @@ class BulkUpload::LettingsLogToCsv log.gender_same_as_sex7, # 150 log.gender_description7, log.gender_same_as_sex8, - log.gender_description8, # 153 + log.gender_description8, + log.owning_organisation.prp? ? log.referral_register : nil, + log.referral_noms, + log.referral_org, # 156 ] end diff --git a/app/models/derived_variables/lettings_log_variables.rb b/app/models/derived_variables/lettings_log_variables.rb index eb01e459a..1533c6400 100644 --- a/app/models/derived_variables/lettings_log_variables.rb +++ b/app/models/derived_variables/lettings_log_variables.rb @@ -33,7 +33,7 @@ module DerivedVariables::LettingsLogVariables def set_derived_fields! clear_inapplicable_derived_values! - set_encoded_derived_values!(DEPENDENCIES) + set_encoded_derived_values!(dependencies) if rsnvac.present? self.newprop = has_first_let_vacancy_reason? ? 1 : 2 @@ -184,20 +184,15 @@ module DerivedVariables::LettingsLogVariables private - DEPENDENCIES = [ - { - conditions: { - renewal: 1, - }, - derived_values: { - referral: 1, - referral_type: 3, - waityear: 2, - offered: 0, - rsnvac: 14, - first_time_property_let_as_social_housing: 0, - }, - }, + def dependencies + if form.start_year_2026_or_later? + DEPENDENCIES_2026 + else + DEPENDENCIES_2025_2024 + end + end + + COMMON_DEPENDENCIES = [ { conditions: { net_income_known: 2, @@ -224,8 +219,41 @@ private }, ].freeze + DEPENDENCIES_2026 = [ + { + conditions: { + renewal: 1, + }, + derived_values: { + referral_register: 1, + waityear: 2, + offered: 0, + rsnvac: 14, + first_time_property_let_as_social_housing: 0, + }, + }, + *COMMON_DEPENDENCIES, + ].freeze + + DEPENDENCIES_2025_2024 = [ + { + conditions: { + renewal: 1, + }, + derived_values: { + referral: 1, + referral_type: 3, + waityear: 2, + offered: 0, + rsnvac: 14, + first_time_property_let_as_social_housing: 0, + }, + }, + *COMMON_DEPENDENCIES, + ].freeze + def clear_inapplicable_derived_values! - reset_invalidated_derived_values!(DEPENDENCIES) + reset_invalidated_derived_values!(dependencies) if (startdate_changed? || renewal_changed?) && (renewal_was == 1 && startdate_was&.between?(Time.zone.local(2021, 4, 1), Time.zone.local(2022, 3, 31))) self.underoccupation_benefitcap = nil end diff --git a/app/models/form/lettings/pages/referral_direct.rb b/app/models/form/lettings/pages/referral_direct.rb index df05aa997..79a8d4044 100644 --- a/app/models/form/lettings/pages/referral_direct.rb +++ b/app/models/form/lettings/pages/referral_direct.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Pages::ReferralDirect < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_general_needs.rb b/app/models/form/lettings/pages/referral_general_needs.rb index 5522d1f23..a55ed5553 100644 --- a/app/models/form/lettings/pages/referral_general_needs.rb +++ b/app/models/form/lettings/pages/referral_general_needs.rb @@ -1,3 +1,4 @@ +# removed in 2025 class Form::Lettings::Pages::ReferralGeneralNeeds < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_general_needs_prp.rb b/app/models/form/lettings/pages/referral_general_needs_prp.rb index e3206ebdb..99e033ab6 100644 --- a/app/models/form/lettings/pages/referral_general_needs_prp.rb +++ b/app/models/form/lettings/pages/referral_general_needs_prp.rb @@ -1,3 +1,4 @@ +# removed in 2025 class Form::Lettings::Pages::ReferralGeneralNeedsPrp < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_hsc.rb b/app/models/form/lettings/pages/referral_hsc.rb index 596852947..c7c16ba58 100644 --- a/app/models/form/lettings/pages/referral_hsc.rb +++ b/app/models/form/lettings/pages/referral_hsc.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Pages::ReferralHsc < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_justice.rb b/app/models/form/lettings/pages/referral_justice.rb index fa10bb727..564f9f98c 100644 --- a/app/models/form/lettings/pages/referral_justice.rb +++ b/app/models/form/lettings/pages/referral_justice.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Pages::ReferralJustice < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_la.rb b/app/models/form/lettings/pages/referral_la.rb index 3f04f3aaf..5e3adbf62 100644 --- a/app/models/form/lettings/pages/referral_la.rb +++ b/app/models/form/lettings/pages/referral_la.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Pages::ReferralLa < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_noms_hr.rb b/app/models/form/lettings/pages/referral_noms_hr.rb new file mode 100644 index 000000000..d1120bffd --- /dev/null +++ b/app/models/form/lettings/pages/referral_noms_hr.rb @@ -0,0 +1,15 @@ +# added in 2026 +class Form::Lettings::Pages::ReferralNomsHr < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "referral_noms_hr" + end + + def questions + @questions ||= [Form::Lettings::Questions::ReferralNoms.new(nil, nil, self, 7)] + end + + def routed_to?(log, _current_user) + log.owning_organisation&.prp? && !log.is_renewal? && log.referral_is_from_housing_register? + end +end diff --git a/app/models/form/lettings/pages/referral_noms_la_hr.rb b/app/models/form/lettings/pages/referral_noms_la_hr.rb new file mode 100644 index 000000000..cc0e27371 --- /dev/null +++ b/app/models/form/lettings/pages/referral_noms_la_hr.rb @@ -0,0 +1,15 @@ +# added in 2026 +class Form::Lettings::Pages::ReferralNomsLaHr < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "referral_noms_la_hr" + end + + def questions + @questions ||= [Form::Lettings::Questions::ReferralNoms.new(nil, nil, self, 6)] + end + + def routed_to?(log, _current_user) + log.owning_organisation&.prp? && !log.is_renewal? && log.referral_is_from_local_authority_housing_register? + end +end diff --git a/app/models/form/lettings/pages/referral_org_directly_referred.rb b/app/models/form/lettings/pages/referral_org_directly_referred.rb new file mode 100644 index 000000000..baf4c2747 --- /dev/null +++ b/app/models/form/lettings/pages/referral_org_directly_referred.rb @@ -0,0 +1,15 @@ +# added in 2026 +class Form::Lettings::Pages::ReferralOrgDirectlyReferred < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "referral_org_directly_referred" + end + + def questions + @questions ||= [Form::Lettings::Questions::ReferralOrg.new(nil, nil, self, 7)] + end + + def routed_to?(log, _current_user) + log.owning_organisation&.prp? && !log.is_renewal? && log.referral_is_directly_referred? + end +end diff --git a/app/models/form/lettings/pages/referral_org_nominated.rb b/app/models/form/lettings/pages/referral_org_nominated.rb new file mode 100644 index 000000000..8be5f8edc --- /dev/null +++ b/app/models/form/lettings/pages/referral_org_nominated.rb @@ -0,0 +1,15 @@ +# added in 2026 +class Form::Lettings::Pages::ReferralOrgNominated < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "referral_org_nominated" + end + + def questions + @questions ||= [Form::Lettings::Questions::ReferralOrg.new(nil, nil, self, 1)] + end + + def routed_to?(log, _current_user) + log.owning_organisation&.prp? && !log.is_renewal? && log.referral_is_nominated_by_local_authority? + end +end diff --git a/app/models/form/lettings/pages/referral_prp.rb b/app/models/form/lettings/pages/referral_prp.rb index 8d25edc44..492941e52 100644 --- a/app/models/form/lettings/pages/referral_prp.rb +++ b/app/models/form/lettings/pages/referral_prp.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Pages::ReferralPrp < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_register_la.rb b/app/models/form/lettings/pages/referral_register_la.rb new file mode 100644 index 000000000..ee570f1cb --- /dev/null +++ b/app/models/form/lettings/pages/referral_register_la.rb @@ -0,0 +1,15 @@ +# added in 2026 +class Form::Lettings::Pages::ReferralRegisterLa < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "referral_register_la" + end + + def questions + @questions ||= [Form::Lettings::Questions::ReferralRegister.new(nil, nil, self, :la)] + end + + def routed_to?(log, _current_user) + log.owning_organisation&.la? && !log.is_renewal? + end +end diff --git a/app/models/form/lettings/pages/referral_register_prp.rb b/app/models/form/lettings/pages/referral_register_prp.rb new file mode 100644 index 000000000..d0c5cdaf1 --- /dev/null +++ b/app/models/form/lettings/pages/referral_register_prp.rb @@ -0,0 +1,15 @@ +# added in 2026 +class Form::Lettings::Pages::ReferralRegisterPrp < ::Form::Page + def initialize(id, hsh, subsection) + super + @id = "referral_register_prp" + end + + def questions + @questions ||= [Form::Lettings::Questions::ReferralRegister.new(nil, nil, self, :prp)] + end + + def routed_to?(log, _current_user) + log.owning_organisation&.prp? && !log.is_renewal? + end +end diff --git a/app/models/form/lettings/pages/referral_supported_housing.rb b/app/models/form/lettings/pages/referral_supported_housing.rb index a3e915e26..b20a0a825 100644 --- a/app/models/form/lettings/pages/referral_supported_housing.rb +++ b/app/models/form/lettings/pages/referral_supported_housing.rb @@ -1,3 +1,4 @@ +# removed in 2025 class Form::Lettings::Pages::ReferralSupportedHousing < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_supported_housing_prp.rb b/app/models/form/lettings/pages/referral_supported_housing_prp.rb index 66b6f370e..0f546b400 100644 --- a/app/models/form/lettings/pages/referral_supported_housing_prp.rb +++ b/app/models/form/lettings/pages/referral_supported_housing_prp.rb @@ -1,3 +1,4 @@ +# removed in 2025 class Form::Lettings::Pages::ReferralSupportedHousingPrp < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_type.rb b/app/models/form/lettings/pages/referral_type.rb index 3cca2ca2b..08b19d14c 100644 --- a/app/models/form/lettings/pages/referral_type.rb +++ b/app/models/form/lettings/pages/referral_type.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Pages::ReferralType < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/pages/referral_value_check.rb b/app/models/form/lettings/pages/referral_value_check.rb index aa3a34200..265ba5312 100644 --- a/app/models/form/lettings/pages/referral_value_check.rb +++ b/app/models/form/lettings/pages/referral_value_check.rb @@ -1,3 +1,4 @@ +# removed in 2026 class Form::Lettings::Pages::ReferralValueCheck < ::Form::Page def initialize(id, hsh, subsection) super diff --git a/app/models/form/lettings/questions/referral_direct.rb b/app/models/form/lettings/questions/referral_direct.rb index ddadcc8b7..d79065df7 100644 --- a/app/models/form/lettings/questions/referral_direct.rb +++ b/app/models/form/lettings/questions/referral_direct.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Questions::ReferralDirect < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_general_needs.rb b/app/models/form/lettings/questions/referral_general_needs.rb index 6efdfc1f0..6c9f159e4 100644 --- a/app/models/form/lettings/questions/referral_general_needs.rb +++ b/app/models/form/lettings/questions/referral_general_needs.rb @@ -1,3 +1,4 @@ +# removed in 2025 class Form::Lettings::Questions::ReferralGeneralNeeds < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_general_needs_prp.rb b/app/models/form/lettings/questions/referral_general_needs_prp.rb index afd26117b..492f32c8f 100644 --- a/app/models/form/lettings/questions/referral_general_needs_prp.rb +++ b/app/models/form/lettings/questions/referral_general_needs_prp.rb @@ -1,3 +1,4 @@ +# removed in 2025 class Form::Lettings::Questions::ReferralGeneralNeedsPrp < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_hsc.rb b/app/models/form/lettings/questions/referral_hsc.rb index a5b9c32f0..f049b6359 100644 --- a/app/models/form/lettings/questions/referral_hsc.rb +++ b/app/models/form/lettings/questions/referral_hsc.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Questions::ReferralHsc < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_justice.rb b/app/models/form/lettings/questions/referral_justice.rb index 0e02e0c42..f222f5fe8 100644 --- a/app/models/form/lettings/questions/referral_justice.rb +++ b/app/models/form/lettings/questions/referral_justice.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Questions::ReferralJustice < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_la.rb b/app/models/form/lettings/questions/referral_la.rb index 7a654df88..352457964 100644 --- a/app/models/form/lettings/questions/referral_la.rb +++ b/app/models/form/lettings/questions/referral_la.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Questions::ReferralLa < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_noms.rb b/app/models/form/lettings/questions/referral_noms.rb new file mode 100644 index 000000000..4d1390fdd --- /dev/null +++ b/app/models/form/lettings/questions/referral_noms.rb @@ -0,0 +1,49 @@ +# added in 2026 +class Form::Lettings::Questions::ReferralNoms < ::Form::Question + def initialize(id, hsh, page, referral_register) + super(id, hsh, page) + @id = "referral_noms" + @copy_key = "lettings.household_situation.referral.noms" + @type = "radio" + @check_answers_card_number = 0 + @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) + @referral_register = referral_register + end + + def answer_options + case @referral_register + when 6 + { + "1" => { + "value" => "Nominated by a local authority to a PRP", + }, + "2" => { + "value" => "Supported housing only - referred by a local authority to a PRP", + }, + "3" => { + "value" => "Internal transfer from another property owned by the same PRP landlord - for existing social tenants only", + }, + "4" => { + "value" => "Other", + }, + }.freeze + when 7 + { + "5" => { + "value" => "Internal transfer from another property owned by the same PRP landlord - for existing social tenants only", + }, + "6" => { + "value" => " A different PRP landlord - for existing social tenants only", + }, + "7" => { + "value" => "Directly referred by a third party", + }, + "8" => { + "value" => "Other", + }, + }.freeze + end + end + + QUESTION_NUMBER_FROM_YEAR = { 2026 => 92 }.freeze +end diff --git a/app/models/form/lettings/questions/referral_org.rb b/app/models/form/lettings/questions/referral_org.rb new file mode 100644 index 000000000..797e30074 --- /dev/null +++ b/app/models/form/lettings/questions/referral_org.rb @@ -0,0 +1,85 @@ +# added in 2026 +class Form::Lettings::Questions::ReferralOrg < ::Form::Question + def initialize(id, hsh, page, referral_noms) + super(id, hsh, page) + @id = "referral_org" + @copy_key = "lettings.household_situation.referral.org" + @type = "radio" + @check_answers_card_number = 0 + @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) + @referral_noms = referral_noms + end + + def answer_options + case @referral_noms + when 1 + { + "1" => { + "value" => "Referred to LA by health service", + }, + "2" => { + "value" => "Referred to LA by community learning disability team", + }, + "3" => { + "value" => "Referred to LA by community mental health team", + }, + "4" => { + "value" => "Referred to LA by adult social services", + }, + "5" => { + "value" => "Referred to LA by children's social care", + }, + "6" => { + "value" => "Referred to LA by police, probation, prison or youth offending team following a custodial sentence", + }, + "7" => { + "value" => "Referred to LA by police, probation, prison or youth offending team without a custodial sentence", + }, + "8" => { + "value" => "Referred to LA by a voluntary agency", + }, + "9" => { + "value" => "Other referral", + }, + "10" => { + "value" => "Don't know", + }, + }.freeze + when 7 + { + "11" => { + "value" => "Health service", + }, + "12" => { + "value" => "Community learning disability team", + }, + "13" => { + "value" => "Community mental health team", + }, + "14" => { + "value" => "Adult social services", + }, + "15" => { + "value" => "Children's social care", + }, + "16" => { + "value" => "Police, probation, prison or youth offending team following a custodial sentence", + }, + "17" => { + "value" => "Police, probation, prison or youth offending team without a custodial sentence", + }, + "18" => { + "value" => "Voluntary agency", + }, + "19" => { + "value" => "Other third party", + }, + "20" => { + "value" => "Don't know", + }, + }.freeze + end + end + + QUESTION_NUMBER_FROM_YEAR = { 2026 => 92 }.freeze +end diff --git a/app/models/form/lettings/questions/referral_prp.rb b/app/models/form/lettings/questions/referral_prp.rb index 44799bb8c..825967a3f 100644 --- a/app/models/form/lettings/questions/referral_prp.rb +++ b/app/models/form/lettings/questions/referral_prp.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Questions::ReferralPrp < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_register.rb b/app/models/form/lettings/questions/referral_register.rb new file mode 100644 index 000000000..cc3c25e74 --- /dev/null +++ b/app/models/form/lettings/questions/referral_register.rb @@ -0,0 +1,56 @@ +# added in 2026 +class Form::Lettings::Questions::ReferralRegister < ::Form::Question + def initialize(id, hsh, page, provider_type) + super(id, hsh, page) + @id = "referral_register" + @copy_key = "lettings.household_situation.referral.register" + @type = "radio" + @check_answers_card_number = 0 + @provider_type = provider_type + @question_number = get_question_number_from_hash(QUESTION_NUMBER_FROM_YEAR) + @question_number += 1 if @provider_type == :prp + end + + def answer_options + if @provider_type == :la + { + "1" => { + "value" => "Renewal to the same tenant in the same property", + }, + "2" => { + "value" => "Internal transfer from another property owned by the same local authority - for existing social tenants only", + }, + "3" => { + "value" => "From a housing register (waiting list)", + }, + "4" => { + "value" => "Tenant applied directly (not via a nomination or housing register)", + }, + }.freeze + else + { + "5" => { + "value" => "Renewal to the same tenant in the same property", + }, + "6" => { + "value" => "From a local authority housing register (waiting list) or a register with local authority involvement", + }, + "7" => { + "value" => "From a housing register (waiting list) with no local authority involvement", + }, + "8" => { + "value" => "Tenant applied directly (not via a nomination or waiting list)", + }, + "9" => { + "value" => "Don't know", + }, + }.freeze + end + end + + def derived?(log) + log.is_renewal? + end + + QUESTION_NUMBER_FROM_YEAR = { 2026 => 91 }.freeze +end diff --git a/app/models/form/lettings/questions/referral_supported_housing.rb b/app/models/form/lettings/questions/referral_supported_housing.rb index d8d05fade..3a7ba04ac 100644 --- a/app/models/form/lettings/questions/referral_supported_housing.rb +++ b/app/models/form/lettings/questions/referral_supported_housing.rb @@ -1,3 +1,4 @@ +# removed in 2025 class Form::Lettings::Questions::ReferralSupportedHousing < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_supported_housing_prp.rb b/app/models/form/lettings/questions/referral_supported_housing_prp.rb index 75cc218fe..d0236f4af 100644 --- a/app/models/form/lettings/questions/referral_supported_housing_prp.rb +++ b/app/models/form/lettings/questions/referral_supported_housing_prp.rb @@ -1,3 +1,4 @@ +# removed in 2025 class Form::Lettings::Questions::ReferralSupportedHousingPrp < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/questions/referral_type.rb b/app/models/form/lettings/questions/referral_type.rb index 5ff0f411e..b4bb87515 100644 --- a/app/models/form/lettings/questions/referral_type.rb +++ b/app/models/form/lettings/questions/referral_type.rb @@ -1,3 +1,5 @@ +# added in 2025 +# removed in 2026 class Form::Lettings::Questions::ReferralType < ::Form::Question def initialize(id, hsh, page) super diff --git a/app/models/form/lettings/subsections/household_situation.rb b/app/models/form/lettings/subsections/household_situation.rb index 8bf747f01..cc6ec59de 100644 --- a/app/models/form/lettings/subsections/household_situation.rb +++ b/app/models/form/lettings/subsections/household_situation.rb @@ -22,12 +22,20 @@ class Form::Lettings::Subsections::HouseholdSituation < ::Form::Subsection Form::Lettings::Pages::ReasonablePreferenceReason.new(nil, nil, self), Form::Lettings::Pages::AllocationSystem.new("allocation_system", nil, self), referral_questions, - Form::Lettings::Pages::ReferralValueCheck.new(nil, nil, self), ].flatten.compact end def referral_questions - if form.start_year_2025_or_later? + if form.start_year_2026_or_later? + [ + Form::Lettings::Pages::ReferralRegisterLa.new(nil, nil, self), + Form::Lettings::Pages::ReferralRegisterPrp.new(nil, nil, self), + Form::Lettings::Pages::ReferralNomsLaHr.new(nil, nil, self), + Form::Lettings::Pages::ReferralNomsHr.new(nil, nil, self), + Form::Lettings::Pages::ReferralOrgNominated.new(nil, nil, self), + Form::Lettings::Pages::ReferralOrgDirectlyReferred.new(nil, nil, self), + ] + elsif form.start_year_2025_or_later? [ Form::Lettings::Pages::ReferralType.new(nil, nil, self), Form::Lettings::Pages::ReferralDirect.new(nil, nil, self), @@ -35,6 +43,7 @@ class Form::Lettings::Subsections::HouseholdSituation < ::Form::Subsection Form::Lettings::Pages::ReferralPrp.new(nil, nil, self), Form::Lettings::Pages::ReferralHsc.new(nil, nil, self), Form::Lettings::Pages::ReferralJustice.new(nil, nil, self), + Form::Lettings::Pages::ReferralValueCheck.new(nil, nil, self), ] else [ @@ -42,6 +51,7 @@ class Form::Lettings::Subsections::HouseholdSituation < ::Form::Subsection Form::Lettings::Pages::ReferralGeneralNeedsPrp.new(nil, nil, self), Form::Lettings::Pages::ReferralSupportedHousing.new(nil, nil, self), Form::Lettings::Pages::ReferralSupportedHousingPrp.new(nil, nil, self), + Form::Lettings::Pages::ReferralValueCheck.new(nil, nil, self), ] end end diff --git a/app/models/form/question.rb b/app/models/form/question.rb index b6f3b8b2f..3a3cc6a34 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -362,6 +362,13 @@ private inferred_answer["value"] if inferred_answer.present? end + # every year currently visible should be specified. + # however, form_handler.rb will still initialise the next form even if its not visible. + # so we have a fallback to the latest year for these future years so all question have a question number. + def get_question_number_from_hash(hash) + hash[form.start_date.year] || hash[hash.keys.max] + end + RADIO_YES_VALUE = { renewal: [1], postcode_known: [1], diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index f2230c4e5..7f1586f88 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -35,6 +35,7 @@ class LettingsLog < Log before_validation :set_derived_fields! before_validation :process_uprn_change!, if: :should_process_uprn_change? before_validation :process_address_change!, if: :should_process_address_change? + before_validation :reset_referral_register!, if: :should_reset_referral_register? belongs_to :scheme, optional: true belongs_to :location, optional: true @@ -376,8 +377,12 @@ class LettingsLog < Log end def is_internal_transfer? - # 1: Internal Transfer - referral == 1 + if form.start_year_2026_or_later? + referral_register == 2 || (referral_register == 6 && referral_noms == 3) || (referral_register == 7 && referral_noms == 5) + else + # 1: Internal Transfer + referral == 1 + end end def is_from_prp_only_housing_register_or_waiting_list? @@ -544,6 +549,12 @@ class LettingsLog < Log [30, 31].any?(prevten) end + def is_prevten_general_needs? + return false unless prevten + + ![30, 31, 32, 33, 35, 38, 40, 6].include?(prevten) + end + def owning_organisation_name owning_organisation&.name end @@ -776,6 +787,22 @@ class LettingsLog < Log form.start_year_2026_or_later? || !is_supported_housing? end + def referral_is_from_local_authority_housing_register? + referral_register == 6 + end + + def referral_is_from_housing_register? + referral_register == 7 + end + + def referral_is_nominated_by_local_authority? + referral_is_from_local_authority_housing_register? && referral_noms == 1 + end + + def referral_is_directly_referred? + referral_is_from_housing_register? && referral_noms == 7 + end + private def reset_invalid_unresolved_log_fields! @@ -947,4 +974,16 @@ private uprn_selection_changed? || startdate_changed? end end + + def reset_referral_register! + self.referral_register = nil + end + + def should_reset_referral_register? + return unless owning_organisation_id_changed? && owning_organisation_id && owning_organisation_id_was + + old_owning_organisation = Organisation.find(owning_organisation_id_was) + + old_owning_organisation.provider_type != owning_organisation.provider_type + end end diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 94390c3f9..b33d896c4 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -74,6 +74,7 @@ class Organisation < ApplicationRecord before_save :clear_group_member_fields_if_not_group_member alias_method :la?, :LA? + alias_method :prp?, :PRP? validates :name, presence: { message: I18n.t("validations.organisation.name_missing") } validates :name, uniqueness: { case_sensitive: false, message: I18n.t("validations.organisation.name_not_unique") } diff --git a/app/models/validations/household_validations.rb b/app/models/validations/household_validations.rb index 8ba58ba2b..cf1962be0 100644 --- a/app/models/validations/household_validations.rb +++ b/app/models/validations/household_validations.rb @@ -162,7 +162,7 @@ module Validations::HouseholdValidations # 27 Owner occupation (low-cost home ownership) # 28 Living with Friends or Family # 29 Prison / Approved Probation Hostel - if record.is_internal_transfer? && [3, 4, 7, 10, 13, 14, 19, 23, 24, 25, 26, 27, 28, 29].include?(record.prevten) + if record.is_internal_transfer? && [3, 4, 7, 10, 13, 14, 19, 23, 24, 25, 26, 27, 28, 29].include?(record.prevten) && !record.form.start_year_2026_or_later? label = record.form.get_question("prevten", record).present? ? record.form.get_question("prevten", record).label_from_value(record.prevten) : "" record.errors.add :prevten, :internal_transfer_non_social_housing, message: I18n.t("validations.lettings.household.prevten.internal_transfer", prevten: label) record.errors.add :referral, :internal_transfer_non_social_housing, message: I18n.t("validations.lettings.household.referral.prevten_invalid", prevten: label) @@ -172,7 +172,14 @@ module Validations::HouseholdValidations def validate_referral(record) return unless record.owning_organisation - if record.is_internal_transfer? && record.owning_organisation.provider_type == "PRP" && record.is_prevten_la_general_needs? + if record.form.start_year_2026_or_later? + if record.is_internal_transfer? && record.is_prevten_general_needs? + label = record.form.get_question("prevten", record).present? ? record.form.get_question("prevten", record).label_from_value(record.prevten) : "" + record.errors.add :prevten, message: I18n.t("validations.lettings.household.prevten.general_needs.internal_transfer", prevten: label) + record.errors.add :referral_register, message: I18n.t("validations.lettings.household.referral.general_needs.internal_transfer", prevten: label) + record.errors.add :referral_noms, message: I18n.t("validations.lettings.household.referral.general_needs.internal_transfer", prevten: label) + end + elsif record.is_internal_transfer? && record.owning_organisation.prp? && record.is_prevten_la_general_needs? record.errors.add :prevten, :internal_transfer_fixed_or_lifetime, message: I18n.t("validations.lettings.household.prevten.la_general_needs.internal_transfer") record.errors.add :referral, :internal_transfer_fixed_or_lifetime, message: I18n.t("validations.lettings.household.referral.la_general_needs.internal_transfer") end diff --git a/app/services/bulk_upload/lettings/year2026/csv_parser.rb b/app/services/bulk_upload/lettings/year2026/csv_parser.rb index 3e5933219..e8e91a6ca 100644 --- a/app/services/bulk_upload/lettings/year2026/csv_parser.rb +++ b/app/services/bulk_upload/lettings/year2026/csv_parser.rb @@ -4,7 +4,7 @@ class BulkUpload::Lettings::Year2026::CsvParser include CollectionTimeHelper # TODO: CLDC-4162: Update when 2026 format is known - FIELDS = 153 + FIELDS = 156 FORM_YEAR = 2026 attr_reader :path @@ -27,7 +27,7 @@ class BulkUpload::Lettings::Year2026::CsvParser def cols # TODO: CLDC-4162: Update when 2026 format is known - @cols ||= ("A".."EX").to_a + @cols ||= ("A".."FA").to_a end def row_parsers diff --git a/app/services/bulk_upload/lettings/year2026/row_parser.rb b/app/services/bulk_upload/lettings/year2026/row_parser.rb index 02484aafd..80f31e0f7 100644 --- a/app/services/bulk_upload/lettings/year2026/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2026/row_parser.rb @@ -120,7 +120,7 @@ class BulkUpload::Lettings::Year2026::RowParser field_113: "Was the letting made under the Common Allocation Policy (CAP)?", field_114: "Was the letting made under the Common Housing Register (CHR)?", field_115: "Was the letting made under the Accessible Register?", - field_116: "What was the source of referral for this letting?", + field_116: "What was the source of referral for this letting? - LA properties", field_117: "Do you know the household’s combined total income after tax?", field_118: "How often does the household receive income?", field_119: "How much income does the household have in total?", @@ -159,6 +159,10 @@ class BulkUpload::Lettings::Year2026::RowParser field_151: "If 'No', enter person 7's gender identity", field_152: "Is the gender person 8 identifies with the same as their sex registered at birth?", field_153: "If 'No', enter person 8's gender identity", + + field_154: "What was the source of referral for this letting? - PRP properties part 1", + field_155: "What was the source of referral for this letting? - PRP properties part 2", + field_156: "What was the source of referral for this letting? - PRP properties part 3", }.freeze RENT_TYPE_BU_MAPPING = { @@ -333,6 +337,10 @@ class BulkUpload::Lettings::Year2026::RowParser attribute :field_152, :integer attribute :field_153, :string + attribute :field_154, :integer + attribute :field_155, :integer + attribute :field_156, :integer + validate :validate_valid_radio_option, on: :before_log validates :field_11, @@ -458,8 +466,6 @@ class BulkUpload::Lettings::Year2026::RowParser validate :validate_needs_type_present, on: :after_log validate :validate_data_types, on: :after_log validate :validate_relevant_collection_window, on: :after_log - validate :validate_la_with_local_housing_referral, on: :after_log - validate :validate_cannot_be_la_referral_if_general_needs_and_la, on: :after_log validate :validate_leaving_reason_for_renewal, on: :after_log validate :validate_only_one_housing_needs_type, on: :after_log validate :validate_no_disabled_needs_conjunction, on: :after_log @@ -470,6 +476,7 @@ class BulkUpload::Lettings::Year2026::RowParser validate :validate_reasonable_preference_dont_know, on: :after_log validate :validate_condition_effects, on: :after_log validate :validate_if_log_already_exists, on: :after_log, if: -> { FeatureToggle.bulk_upload_duplicate_log_check_enabled? } + validate :validate_referral_fields, on: :after_log validate :validate_owning_org_data_given, on: :after_log validate :validate_owning_org_exists, on: :after_log @@ -730,7 +737,7 @@ private end def validate_prevten_value_when_renewal - return unless field_7 == 1 + return unless renewal? return if field_100.blank? || [6, 30, 31, 32, 33, 34, 35, 38].include?(field_100) errors.add(:field_100, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid")) @@ -837,7 +844,7 @@ private end def validate_leaving_reason_for_renewal - if field_7 == 1 && ![50, 51, 52, 53].include?(field_98) + if renewal? && ![50, 51, 52, 53].include?(field_98) errors.add(:field_98, I18n.t("#{ERROR_BASE_KEY}.reason.renewal_reason_needed")) end end @@ -850,16 +857,8 @@ private field_4 == 2 end - def validate_cannot_be_la_referral_if_general_needs_and_la - if field_116 == 4 && general_needs? && owning_organisation && owning_organisation.la? - errors.add :field_116, I18n.t("#{ERROR_BASE_KEY}.referral.general_needs_prp_referred_by_la") - end - end - - def validate_la_with_local_housing_referral - if field_116 == 3 && owning_organisation && owning_organisation.la? - errors.add(:field_116, I18n.t("#{ERROR_BASE_KEY}.referral.nominated_by_local_ha_but_la")) - end + def renewal? + field_7 == 1 end def validate_relevant_collection_window @@ -1042,6 +1041,57 @@ private end end + def field_referral_register_la_valid? + if owning_organisation&.la? + [1, 2, 3, 4].include?(field_116) + else + field_116.blank? + end + end + + def field_referral_register_prp_valid? + if owning_organisation&.prp? + [5, 6, 7, 8, 9].include?(field_154) + else + field_154.blank? + end + end + + def field_referral_noms_valid? + case field_154 + when 6 + [1, 2, 3, 4].include?(field_155) + when 7 + [5, 6, 7, 8].include?(field_155) + else + field_155.blank? + end + end + + def field_referral_org_valid? + case field_155 + when 1 + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].include?(field_156) + when 7 + [11, 12, 13, 14, 15, 16, 17, 18, 19, 20].include?(field_156) + else + field_156.blank? + end + end + + def referral_fields_valid? + field_referral_register_la_valid? && field_referral_register_prp_valid? && field_referral_noms_valid? && field_referral_org_valid? + end + + def validate_referral_fields + return if renewal? + return if referral_fields_valid? + + %i[field_116 field_154 field_155 field_156].each do |field| + errors.add(field, I18n.t("#{ERROR_BASE_KEY}.referral.invalid_option")) + end + end + def field_mapping_for_errors { lettype: [:field_11], @@ -1154,8 +1204,9 @@ private accessible_register: %i[field_115], letting_allocation: %i[field_112 field_113 field_114 field_115], - referral_type: %i[field_116], - referral: %i[field_116], + referral_register: %i[field_116 field_154], + referral_noms: %i[field_155], + referral_org: %i[field_156], net_income_known: %i[field_117], incfreq: %i[field_118], @@ -1349,8 +1400,9 @@ private attributes["accessible_register"] = accessible_register attributes["letting_allocation_unknown"] = letting_allocation_unknown - attributes["referral_type"] = referral_type - attributes["referral"] = field_116 + attributes["referral_register"] = referral_register + attributes["referral_noms"] = referral_noms + attributes["referral_org"] = referral_org attributes["net_income_known"] = net_income_known attributes["earnings"] = earnings @@ -1768,21 +1820,36 @@ private false end - def referral_type - mapping = { - 1 => [20, 2, 8], - 2 => [21, 3, 4, 22], - 3 => [1, 10, 23], - 4 => [15, 9, 14, 24, 17], - 5 => [18, 19], - 6 => [7], - 7 => [16], - } + def referral_register + return unless owning_organisation + # by default CORE will ingest all these fields and nil questions that aren't asked. + # here, we specifically want the log to be invalid if any of the referral fields are wrong. + # BU will only consider a log invalid if its incomplete. + # so, nil these fields if any are invalid. + return unless referral_fields_valid? + + if owning_organisation.la? + field_116 + else + field_154 + end + end + + def referral_noms + return unless owning_organisation + return unless referral_fields_valid? - mapping.each do |key, values| - return key if values.include?(field_116) + if owning_organisation.prp? + field_155 end + end - 0 + def referral_org + return unless owning_organisation + return unless referral_fields_valid? + + if owning_organisation.prp? + field_156 + end end end diff --git a/app/services/exports/lettings_log_export_constants.rb b/app/services/exports/lettings_log_export_constants.rb index b954a5afd..99f73d143 100644 --- a/app/services/exports/lettings_log_export_constants.rb +++ b/app/services/exports/lettings_log_export_constants.rb @@ -77,7 +77,6 @@ module Exports::LettingsLogExportConstants "reason", "reasonother", "reasonpref", - "referral", "refused", "reghome", "renttype", @@ -158,6 +157,7 @@ module Exports::LettingsLogExportConstants "chcharge", "national", "offered", + "referral", ] YEAR_2022_EXPORT_FIELDS = Set[ @@ -165,6 +165,7 @@ module Exports::LettingsLogExportConstants "chcharge", "national", "offered", + "referral", ] YEAR_2023_EXPORT_FIELDS = Set[ @@ -172,6 +173,7 @@ module Exports::LettingsLogExportConstants "chcharge", "national", "offered", + "referral", ] YEAR_2024_EXPORT_FIELDS = Set[ @@ -192,6 +194,7 @@ module Exports::LettingsLogExportConstants "pscharge_value_check", "supcharg_value_check", "carehome_charges_value_check", + "referral", ] YEAR_2025_EXPORT_FIELDS = Set[ @@ -210,6 +213,7 @@ module Exports::LettingsLogExportConstants "scharge_value_check", "pscharge_value_check", "supcharg_value_check", + "referral", ] YEAR_2026_EXPORT_FIELDS = Set[ @@ -227,6 +231,9 @@ module Exports::LettingsLogExportConstants "scharge_value_check", "pscharge_value_check", "supcharg_value_check", + "referral_register", + "referral_noms", + "referral_org", ] (1..8).each do |index| diff --git a/config/locales/forms/2026/lettings/household_situation.en.yml b/config/locales/forms/2026/lettings/household_situation.en.yml index 02438edcc..133bcf6c3 100644 --- a/config/locales/forms/2026/lettings/household_situation.en.yml +++ b/config/locales/forms/2026/lettings/household_situation.en.yml @@ -112,37 +112,19 @@ en: question_text: "How was this letting allocated?" referral: - type: + register: page_header: "" check_answer_label: "Source of referral for letting" check_answer_prompt: "Select source of referral" hint_text: "" question_text: "What was the source of referral for this letting?" - direct: + noms: page_header: "" check_answer_label: "Source of referral for letting" check_answer_prompt: "Select source of referral" hint_text: "" question_text: "What was the source of referral for this letting?" - la: - page_header: "" - check_answer_label: "Source of referral for letting" - check_answer_prompt: "Select source of referral" - hint_text: "" - question_text: "What was the source of referral for this letting?" - prp: - page_header: "" - check_answer_label: "Source of referral for letting" - check_answer_prompt: "Select source of referral" - hint_text: "" - question_text: "What was the source of referral for this letting?" - hsc: - page_header: "" - check_answer_label: "Source of referral for letting" - check_answer_prompt: "Select source of referral" - hint_text: "" - question_text: "What was the source of referral for this letting?" - justice: + org: page_header: "" check_answer_label: "Source of referral for letting" check_answer_prompt: "Select source of referral" diff --git a/config/locales/forms/2026/lettings/soft_validations.en.yml b/config/locales/forms/2026/lettings/soft_validations.en.yml index a2fe12a1f..5a1d7d1a3 100644 --- a/config/locales/forms/2026/lettings/soft_validations.en.yml +++ b/config/locales/forms/2026/lettings/soft_validations.en.yml @@ -57,15 +57,6 @@ en: title_text: "You told us that the tenant’s main reason for leaving their last settled home was %{reasonother}." informative_text: "The reason you have entered looks very similar to one of the existing response categories. Please check the categories and select the appropriate one. If the existing categories are not suitable, please confirm here to move onto the next question." - referral_value_check: - page_header: "" - check_answer_label: "Referral confirmation" - check_answer_prompt: "Confirm referral type" - hint_text: "" - question_text: "Are you sure?" - title_text: "Are you sure?" - informative_text: "This is a general needs log, and this referral type is for supported housing." - net_income_value_check: page_header: "" check_answer_label: "Net income confirmation" diff --git a/config/locales/validations/lettings/2026/bulk_upload.en.yml b/config/locales/validations/lettings/2026/bulk_upload.en.yml index 8ac7fc378..bf65ae6bd 100644 --- a/config/locales/validations/lettings/2026/bulk_upload.en.yml +++ b/config/locales/validations/lettings/2026/bulk_upload.en.yml @@ -40,8 +40,7 @@ en: reason: renewal_reason_needed: "The reason for leaving must be \"End of social or private sector tenancy - no fault\", \"End of social or private sector tenancy - evicted due to anti-social behaviour (ASB)\", \"End of social or private sector tenancy - evicted due to rent arrears\" or \"End of social or private sector tenancy - evicted for any other reason\"." referral: - general_needs_prp_referred_by_la: "The source of the referral cannot be referred by local authority housing department for a general needs log." - nominated_by_local_ha_but_la: "The source of the referral cannot be Nominated by local housing authority as your organisation is a local authority." + invalid_option: "Your answers for each part of \"What is the source of referral for this letting?\" are incompatible with each other. Use the bulk upload specification or paper form to see which combinations are valid (available from ‘Collection resources’ on the homepage)." scheme: must_relate_to_org: "This scheme code does not belong to the owning organisation or managing organisation." location: diff --git a/config/locales/validations/lettings/household.en.yml b/config/locales/validations/lettings/household.en.yml index 297cbed02..3fe1d244f 100644 --- a/config/locales/validations/lettings/household.en.yml +++ b/config/locales/validations/lettings/household.en.yml @@ -98,8 +98,12 @@ en: internal_transfer: "Answer cannot be %{prevten} as this tenancy is an internal transfer." la_general_needs: internal_transfer: "Answer cannot be a fixed-term or lifetime local authority general needs tenancy as it’s an internal transfer and a private registered provider is on the tenancy agreement." + general_needs: + internal_transfer: "Answer cannot be %{prevten} as this tenancy is an internal transfer. Internal transfers are for existing social tenants only; your answer to where the household was immediately before this letting shows the tenant was not in the social sector immediately prior to this letting." referral: prevten_invalid: "Answer cannot be internal transfer as the household situation immediately before this letting was %{prevten}." la_general_needs: internal_transfer: "Answer cannot be internal transfer as it’s the same landlord on the tenancy agreement and the household had either a fixed-term or lifetime local authority general needs tenancy immediately before this letting." + general_needs: + internal_transfer: "Answer cannot be internal transfer as the household situation immediately before this letting was %{prevten}. Internal transfers are for existing social tenants only; your answer to where the household was immediately before this letting shows the tenant was not in the social sector immediately prior to this letting." diff --git a/db/migrate/20260123150201_add2026_referral_fields.rb b/db/migrate/20260123150201_add2026_referral_fields.rb new file mode 100644 index 000000000..32279fad5 --- /dev/null +++ b/db/migrate/20260123150201_add2026_referral_fields.rb @@ -0,0 +1,9 @@ +class Add2026ReferralFields < ActiveRecord::Migration[7.2] + def change + change_table :lettings_logs, bulk: true do |t| + t.integer :referral_register + t.integer :referral_noms + t.integer :referral_org + end + end +end diff --git a/db/schema.rb b/db/schema.rb index e314e201d..19faeed2a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -400,6 +400,9 @@ ActiveRecord::Schema[7.2].define(version: 2026_02_04_100051) do t.string "gender_description6" t.string "gender_description7" t.string "gender_description8" + t.integer "referral_register" + t.integer "referral_noms" + t.integer "referral_org" t.index ["assigned_to_id"], name: "index_lettings_logs_on_assigned_to_id" t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id" t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id" diff --git a/spec/factories/lettings_log.rb b/spec/factories/lettings_log.rb index 02744e87c..2c1aff71a 100644 --- a/spec/factories/lettings_log.rb +++ b/spec/factories/lettings_log.rb @@ -168,6 +168,9 @@ FactoryBot.define do first_time_property_let_as_social_housing { 0 } referral_type { 1 } referral { 2 } + referral_register { 1 } + referral_noms { 1 } + referral_org { 1 } uprn_known { 0 } joint { 3 } address_line1 { "Address line 1" } diff --git a/spec/fixtures/exports/general_needs_log_26_27.xml b/spec/fixtures/exports/general_needs_log_26_27.xml index 745497f0c..d92f74f10 100644 --- a/spec/fixtures/exports/general_needs_log_26_27.xml +++ b/spec/fixtures/exports/general_needs_log_26_27.xml @@ -123,7 +123,9 @@ 0 2 - 2 + 1 + + 200.0 50.0 40.0 diff --git a/spec/fixtures/files/2026_27_lettings_bulk_upload.csv b/spec/fixtures/files/2026_27_lettings_bulk_upload.csv index 547826f5b..4b66a7c71 100644 --- a/spec/fixtures/files/2026_27_lettings_bulk_upload.csv +++ b/spec/fixtures/files/2026_27_lettings_bulk_upload.csv @@ -1,4 +1,4 @@ -Section,Setting up this lettings log,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,,,,,,,,Tenancy information,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household needs,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,,,,,,,,,,,"Income, benefits and outgoings",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Section,Setting up this lettings log,,,,,,,,,,,,,,,Property information,,,,,,,,,,,,,,,,,,,,,Tenancy information,,,,,Household characteristics,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Household needs,,,,,,,,,,,,,,,,,,,,,Household situation,,,,,,,,,,,,,,,,,,,,,"Income, benefits and outgoings",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Question,Which organisation owns this property?,Which organisation manages this letting?,What is the CORE username of the account this letting log should be assigned to? ,What is the needs type?,What scheme does this letting belong to?,Which location is this letting for?,Is this letting a renewal of social housing to the same tenant in the same property?,What is the tenancy start date? - day DD,What is the tenancy start date? - month MM,What is the tenancy start date? - year YY,What is the rent type?,Which 'Other' type of Intermediate Rent is this letting?,What is the tenant code?,What is the property reference?,Has the tenant seen or been given access to the MHCLG privacy notice?,What is the reason for the property being vacant?,What type was the property most recently let as?,"If known, provide this property’s UPRN",Address Line 1,Address Line 2,Town or city,County,Part 1 of the property's postcode,Part 2 of the property's postcode,What is the property's local authority?,What type of unit is the property?,Which type of building is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date? - day DD,What is the void date? - month MM,What is the void date? - year YY,What date were any major repairs completed on? - day DD,What date were any major repairs completed on? - month MM,What date were any major repairs completed on? - year YY,Is this property older people's housing?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,What is the lead tenant’s age?,Which of these best describes the lead tenant’s gender identity? ,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant’s nationality?,Which of these best describes the lead tenant’s working situation?,Is person 2 the partner of the lead tenant?,What is person 2's age?,Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Is person 3 the partner of the lead tenant?,What is person 3's age?,Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Is person 4 the partner of the lead tenant?,What is person 4's age?,Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Is person 5 the partner of the lead tenant?,What is person 5's age?,Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Is person 6 the partner of the lead tenant?,What is person 6's age?,Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Is person 7 the partner of the lead tenant?,What is person 7's age?,Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Is person 8 the partner of the lead tenant?,What is person 8's age?,Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,"Disabled access needs a) Fully wheelchair-accessible housing","Disabled access needs @@ -29,7 +29,7 @@ Common Allocations Policy (CAP)","How was this letting allocated? Common Housing Register (CHR)","How was this letting allocated? -Accessible Housing Register",What was the source of referral for this letting?,Do you know the household's combined total income after tax?,How often does the household receive income?,How much income does the household have in total?,Is the tenant likely to be receiving any of these housing-related benefits?,"How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,How often does the household pay rent and other charges?,What is the basic rent?,What is the service charge?,What is the personal service charge?,What is the support charge?,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",What do you expect the outstanding amount to be?,What was the lead tenant's sex at birth?,What was person 2's sex registered at birth?,What was person 3's sex registered at birth?,What was person 4's sex registered at birth?,What was person 5's sex registered at birth?,What was person 6's sex registered at birth?,What was person 7's sex registered at birth?,What was person 8's sex registered at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter lead tenant's gender identity",Is the gender the person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Is the gender the person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Is the gender the person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Is the gender the person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Is the gender the person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Is the gender the person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Is the gender the person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity" +Accessible Housing Register",What was the source of referral for this letting? - LA properties,Do you know the household's combined total income after tax?,How often does the household receive income?,How much income does the household have in total?,Is the tenant likely to be receiving any of these housing-related benefits?,"How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,How often does the household pay rent and other charges?,What is the basic rent?,What is the service charge?,What is the personal service charge?,What is the support charge?,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",What do you expect the outstanding amount to be?,What was the lead tenant's sex at birth?,What was person 2's sex registered at birth?,What was person 3's sex registered at birth?,What was person 4's sex registered at birth?,What was person 5's sex registered at birth?,What was person 6's sex registered at birth?,What was person 7's sex registered at birth?,What was person 8's sex registered at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter lead tenant's gender identity",Is the gender the person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Is the gender the person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Is the gender the person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Is the gender the person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Is the gender the person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Is the gender the person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Is the gender the person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",What was the source of referral for this letting? - PRP properties part 1,What was the source of referral for this letting? - PRP properties part 2,What was the source of referral for this letting? - PRP properties part 3 Additional info,"You can find the org ID on the CORE service under 'Stock owners' or, if your organisation is the stock owner, under 'About your organisation'","You can find the org ID on the CORE service under 'Managing agents' or, if your organisation is the managing agent, under 'About your organisation'","If left empty, the letting log will be assigned to the account used to upload the log.","General needs housing includes both self-contained and shared housing without support or specific adaptations. Supported housing includes direct access hostels, group homes, residential care and nursing homes.","Scheme code. Include the 'S' at the beginning if it has one. You can find the scheme code on the CORE service under 'Schemes', either by searching for the specific scheme or downloading a csv.","Location code. @@ -45,7 +45,7 @@ The UPRN may not be the same as the property reference assigned by your organisa Extra care housing is for tenants with medium to high care and support needs, often with 24 hour access to support staff provided by an agency registered with the Care Quality Commission.",This is where two or more people are named on the tenancy agreement.,"If the tenancy has an ‘introductory period’ answer ‘yes’. You should submit a CORE log at the beginning of the starter tenancy or introductory period, with the best information you have at the time. You do not need to submit a log when a tenant later rolls onto the main tenancy.",This is about the main tenancy after any starter or introductory period. See specification for definitions.,,Do not include the starter or introductory period. The minimum period is 2 years for social or affordable rent general needs logs. You do not need to submit CORE logs for these types of tenancies if they are shorter than 2 years.,"This is the household member who does the most paid work. If several people do the same amount of paid work, it's the oldest household member.",This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,"If the lead tenant is a dual national of the United Kingdom and another country, enter United Kingdom. If they are a dual national of two other countries, the tenant should decide which country to enter.","This is the household member who does the most paid work. If several people do the same amount of paid work, it's the oldest household member.",,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,,Answer 1 for children aged under 1 year old,This should be however they personally choose to identify from the options below. This may or may not be the same as their biological sex or the sex they were assigned at birth.,,"This excludes national service. -If several household members have these links, answer for regular first. If no regular, answer for reserve. If no reserve, answer for spouses or civil partners.",,,,,,,,,,,"For example, lifting and carrying objects, or using a keyboard",,"For example, deafness or partial hearing",,"For example, depression or anxiety","For example, walking short distances or climbing stairs","For example, anything associated with autism spectrum disorder (ASD), including Asperger’s or attention deficit hyperactivity disorder (ADHD)",,"For example, blindness or partial sight",,,,"The tenant's ‘last settled home' is their last long-standing home. For tenants who had temporary accommodation, sleeping rough or otherwise homeless, their last settled home is where they were living previously.",,,,"This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless.","Combined with field 104, it should be a postcode which lies within the local authority given in field 105.","Combined with field 103, it should be a postcode which lies within the local authority given in field 105.","This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless.",Households may be given ‘reasonable preference’ for social housing under one or more specific category by the local authority. This is also known as ‘priority need’.,,,,,,Where available vacant properties are advertised and applicants are able to bid for specific properties.,Where a common system agreed between a group of housing providers is used to determine applicants' priority for housing.,Where a single waiting list is used by a group of housing providers to receive and process housing applications. Providers may use different approaches to determine priority.,Where the 'access category' or another descriptor of whether an available vacant property meets a range of access needs is displayed to applicants during the allocations process.,,,,"Include any income after tax from employment, pensions, and Universal Credit. Don't include National Insurance (NI) contributions and tax, housing benefit, child benefit, or council tax support.","This is about when the tenant is in their new let. If they are unsure about the situation for their new let and their financial and working situation hasn’t changed significantly, answer based on what housing-related benefits they currently receive.",,"If rent is charged on the property then answer Yes, even if tenants do not pay it themselves.",,"This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent.","For example, cleaning. Households may get household benefits towards the service charge.",For example heating or hot water. This doesn’t include housing benefit or Universal Credit.,Any charges made to fund support services included in the tenancy agreement.,Also known as the 'outstanding amount',You only need to give an approximate figure.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,,,,,,,,,,,,,,,, +If several household members have these links, answer for regular first. If no regular, answer for reserve. If no reserve, answer for spouses or civil partners.",,,,,,,,,,,"For example, lifting and carrying objects, or using a keyboard",,"For example, deafness or partial hearing",,"For example, depression or anxiety","For example, walking short distances or climbing stairs","For example, anything associated with autism spectrum disorder (ASD), including Asperger’s or attention deficit hyperactivity disorder (ADHD)",,"For example, blindness or partial sight",,,,"The tenant's ‘last settled home' is their last long-standing home. For tenants who had temporary accommodation, sleeping rough or otherwise homeless, their last settled home is where they were living previously.",,,,"This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless.","Combined with field 104, it should be a postcode which lies within the local authority given in field 105.","Combined with field 103, it should be a postcode which lies within the local authority given in field 105.","This is the tenant’s last long-standing home. It is where the tenant was living before any period in temporary accommodation, sleeping rough or otherwise homeless.",Households may be given ‘reasonable preference’ for social housing under one or more specific category by the local authority. This is also known as ‘priority need’.,,,,,,Where available vacant properties are advertised and applicants are able to bid for specific properties.,Where a common system agreed between a group of housing providers is used to determine applicants' priority for housing.,Where a single waiting list is used by a group of housing providers to receive and process housing applications. Providers may use different approaches to determine priority.,Where the 'access category' or another descriptor of whether an available vacant property meets a range of access needs is displayed to applicants during the allocations process.,,,,"Include any income after tax from employment, pensions, and Universal Credit. Don't include National Insurance (NI) contributions and tax, housing benefit, child benefit, or council tax support.","This is about when the tenant is in their new let. If they are unsure about the situation for their new let and their financial and working situation hasn’t changed significantly, answer based on what housing-related benefits they currently receive.",,"If rent is charged on the property then answer Yes, even if tenants do not pay it themselves.",,"This is the amount paid before any charges are added for services (for example, hot water or cleaning). Households may receive housing benefit or Universal Credit towards basic rent.","For example, cleaning. Households may get household benefits towards the service charge.",For example heating or hot water. This doesn’t include housing benefit or Universal Credit.,Any charges made to fund support services included in the tenancy agreement.,Also known as the 'outstanding amount',You only need to give an approximate figure.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,This is the sex that was registered at birth.,,,,,,,,,,,,,,,,,,, Values,Alphanumeric,,Email format,01-Feb,Alphanumeric,Numeric,01-Feb,Jan-31,01-Dec,25 - 26,01-Jul,Text,"Alphanumeric, max 13 characters","Alphanumeric, max 12 characters",1,"5 - 6, or 8 - 22",1 - 3 or 5 - 9,Numeric,Alphanumeric,,Text,,"Alphanumeric, 2 - 4 characters","Alphanumeric, 3 characters","9 character ONS code, beginning with 'E' (https://www.get-information-schools.service.gov.uk/Guidance/LaNameCodes) ","1 - 2, 4 or 6 - 10",01-Feb,01-Feb,01-Jul,Jan-31,01-Dec,Jun-26,Jan-31,01-Dec,Jun-26,"2 - 4, 7 - 8",01-Mar,01-Feb,02-Aug,Text,"1 - 99, see specification for more detail",16 - 120 or R,"F, M, X or R",Jan-20,"3 digit ISO country code, see specification",0 - 10,01-Mar,"Numeric, range 1 - 120 or text (upper case 'R') @@ -77,11 +77,11 @@ Must be >= 16 if working situation = 1 - 8 or 0 Must be <16 if working situation = 9","F, M, X or R","0 - 10 Must be 9 if age <16",01-Jun,03-Jun,01-Mar,,1 or empty,,,,,,01-Mar,1 or empty,,,,,,,,,,1 - 2 or 6 - 12,2 or 6 - 13,"1 - 2, 4, 8 - 14, 16 - 20, 28 - 31, 34 or 44 - 55",Text,"3 - 4, 6 - 7, 9 - 10, 13 - 14, 18 - 19, 21, 23 - 33, 35, 37 - 39 ",1 or 11,01-Feb,"Alphanumeric, 2 - 4 characters","Alphanumeric, -3 characters","9 character ONS code, beginning with 'E' (https://www.get-information-schools.service.gov.uk/Guidance/LaNameCodes) ",01-Mar,1 or empty,,,,,01-Feb,,,,"1 - 4, 7 - 10, 14 - 24",01-Mar,01-Mar,0 - 99999,"1, 3, 6, 9 or 10",01-Apr,0 - 1,01-Oct,xxxx.xx,,,,01-Mar,xxxx.xx,"F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R",1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text +3 characters","9 character ONS code, beginning with 'E' (https://www.get-information-schools.service.gov.uk/Guidance/LaNameCodes) ",01-Mar,1 or empty,,,,,01-Feb,,,,,01-Mar,01-Mar,0 - 99999,"1, 3, 6, 9 or 10",01-Apr,0 - 1,01-Oct,xxxx.xx,,,,01-Mar,xxxx.xx,"F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R","F, M or R",1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,1 - 3,Text,,, Can be empty?,No,,Yes,No,"Yes, if letting is general needs (if field 4 = 1)","Yes, if letting is general needs (if field 4 = 1)",No,,,,,"Yes, if letting is not 'Other intermediate rent product' (if field 11 is not 6)",Yes,,No,"Yes, if letting is a renewal (if field 7 = 1)","Yes, if letting is a renewal (if field 7 = 1) or a first-time let (if field 16 = 15 - 17)","Yes, if letting is supported housing (if field 4 = 2) or if the property's postcode is not empty (if fields 23 and 24 contain full and valid entries)","Yes, if letting is supported housing (if field 4 = 2) or if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",Yes,"Yes, if letting is supported housing (if field 4 = 2) or if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",Yes,"Yes, if letting is supported housing (if field 4 = 2) or if property's UPRN and local authority are known (if fields 18 and 25 are not empty)",,"Yes, if letting is supported housing (if field 4 = 2)",,,,,"Yes, if letting is a renewal (if field 7 = 1)",,,Yes,,,"Yes, if letting is general needs (if field 4 = 1)",No,,,"Yes, if 'Other' is not selected for tenancy type (if field 39 is not 3)","Yes, if letting is not a fixed-term tenancy (if field 39 is not 4 or 6)",No,,,,,"Yes, if all fields about person 2 are empty (fields 47 - 50)",,,,"Yes, if all fields about person 3 are empty (fields 51 - 54)",,,,"Yes, if all fields about person 4 are empty (fields 55 - 58)",,,,"Yes, if all fields about person 5 are empty (fields 59 - 62)",,,,"Yes, if all fields about person 6 are empty (fields 63 - 66)",,,,"Yes, if all fields about person 7 are empty (fields 67 - 70)",,,,"Yes, if all fields about person 8 are empty (fields 71 - 74)",,,,No,"Yes, if no one in the household is a current or former regular (if field 75 is not 1)","Yes, if no one in the household is a current or former regular or reserve (if field 75 is not 1 or 4)",No,"Yes, if no household members have access needs or if it is unknown (if field 83 or 84 = 1)",,,,"Yes, if a household member has an access need (if at least one of fields 79 to 82 = 1)",,No,"Yes, if a household member has an access need (if at least one of fields 79 to 82 = 1) If someone in the household does have such a condition (if field 89 = 1), then at least 1 of these fields must be 1.",,,,,,,,,,No,"Yes, if letting is a renewal (if field 7 = 1)",No,"Yes, if 'Other' is not selected for reason for leaving last settled home (if field 98 is not 20)",No,No,,"Yes, if postcode of household's last settled home is not known (if 102 = 2)",,Yes,No,"If household was given 'reasonable preference' (if field 107 = 1), at least one of these fields must be 1 -If household was not given 'reasonable preference' (if field 106 = 2 or 3), these fields will be ignored.",,,,,No,,,,"Yes, if letting is a renewal (if field 7 = 1)",No,"Yes, if household's income is unknown (if field 117 = 2 or 3)",,No,,"Yes, if letting is supported housing (if field 4 = 2)",No,"Yes, if the household does not pay rent (if field 122 = 1)",,,,"Yes, if the household doesn't receive housing benefits, or if it is unknown (if field 120 = 3, 9 or 10)","Yes, if the household does not need to pay rent or charges after receiving housing benefits (if field 128 is not 1)",,,,,,,,,,,,,,,,,,,,,,,, -Type of letting the question applies to,,,,,Supported housing only,,,,,,,Other Intermediate Rent only,,,,,,General needs only,,,,,,,,,,,,,,,,,,Supported housing only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Supported housing only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Duplicate check field?,Yes,,,,Yes,,,Yes,,,,,Yes,,,,,,,,,,Yes,,,,,,,,,,,,,,,,,,,Yes,,,,Yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -Field number,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153 -,ORG1,ORG1,support@example.com,1,,,2,1,4,26,1,,1,1,1,5,1,,a,a,a,a,a1,1aa,E09000001,1,1,1,1,1,4,25,,,,,3,1,2,,,20,F,1,GBR,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,6,3,1,1,,,,,,1,1,,,,,,,,,,1,2,50,,30,1,2,,,,1,1,,,,,1,1,1,1,7,2,,,1,2,1,1,50,0,0,0,3,,F,,,,,,,,1,,,,,,,,,,,,,,, +If household was not given 'reasonable preference' (if field 106 = 2 or 3), these fields will be ignored.",,,,,No,,,,,No,"Yes, if household's income is unknown (if field 117 = 2 or 3)",,No,,"Yes, if letting is supported housing (if field 4 = 2)",No,"Yes, if the household does not pay rent (if field 122 = 1)",,,,"Yes, if the household doesn't receive housing benefits, or if it is unknown (if field 120 = 3, 9 or 10)","Yes, if the household does not need to pay rent or charges after receiving housing benefits (if field 128 is not 1)",,,,,,,,,,,,,,,,,,,,,,,,,,, +Type of letting the question applies to,,,,,Supported housing only,,,,,,,Other Intermediate Rent only,,,,,,General needs only,,,,,,,,,,,,,,,,,,Supported housing only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Supported housing only,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Duplicate check field?,Yes,,,,Yes,,,Yes,,,,,Yes,,,,,,,,,,Yes,,,,,,,,,,,,,,,,,,,Yes,,,,Yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Field number,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156 +,ORG1,ORG1,support@example.com,1,,,2,1,4,26,1,,1,1,1,5,1,,a,a,a,a,a1,1aa,E09000001,1,1,1,1,1,4,25,,,,,3,1,2,,,20,F,1,GBR,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,6,3,1,1,,,,,,1,1,,,,,,,,,,1,2,50,,30,1,2,,,,1,1,,,,,1,1,1,1,1,2,,,1,2,1,1,50,0,0,0,3,,F,,,,,,,,1,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_codes_26.csv b/spec/fixtures/files/lettings_log_csv_export_codes_26.csv index a22448a5b..3634e6978 100644 --- a/spec/fixtures/files/lettings_log_csv_export_codes_26.csv +++ b/spec/fixtures/files/lettings_log_csv_export_codes_26.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,User the log is created by,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,What is the property's local authority?,Local authority code,Is the UPRN known?,UPRN of the address selected,Was the 'No address found' page seen?,Address line 1 input from address matching feature,Postcode input from address matching feature,Address line 1 entered in bulk upload file,Address line 2 entered in bulk upload file,Town or city entered in bulk upload file,County entered in bulk upload file,Postcode entered in bulk upload file,Local authority entered in bulk upload file,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,The following soft validation was confirmed: You told us that the property has been vacant for more than 2 years. This is higher than we would expect.,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,The following soft validation was confirmed: You told us the property has been vacant for 2 years. This is higher than we would expect.,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,The following soft validation was confirmed: You told us somebody in the household is pregnant. You also told us there are no female tenants living at the property.,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8","Type of household 1 = 1 elder; 2 = 2 adults, including elder(s); 3 = 1 adult; 4 = 2 adults; 5 = 1 adult & 1+ children; 6 = 2+ adults & 1+ children; 9 = Other",Total number of dependent children in the household (Sum of when RELAT2-8 = C),Total number of elders in household (Sum of when AGE1-8 >= 60),Total number of adults in household,What is the lead tenant's age?,The following soft validation was confirmed: You told us this person is aged %{age} years and retired. The minimum expected retirement age for %{gender} in England is %{age}.,What was the lead tenant's sex at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter the lead tenant's gender identity",Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,The following soft validation was confirmed: You have said that at least one person's situation is 'Unable to work because of long-term sickness or disability'.,Are the details of tenant 2 known?,What is person 2's age?,What is person 2's relationship to the lead tenant?,The following soft validation was confirmed: You said that more than one person in the household is the partner of the lead tenant. Are you sure this is correct?,What was person 2's sex at birth?,Is the gender person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Are the details of tenant 3 known?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Is the gender person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Are the details of tenant 4 known?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Is the gender person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Are the details of tenant 5 known?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Is the gender person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Are the details of tenant 6 known?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Is the gender person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Are the details of tenant 7 known?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Is the gender person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Are the details of tenant 8 known?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Is the gender person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",The soft validation was confirmed,Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Was the local authority of the household's last settled home known?,The internal value to indicate if the previous LA was inferred from the postcode,Previous location LA name,Previous location's ONS LA Code,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",,What was the source of referral for this letting?,"The following soft validation was confirmed: Are you sure? This is a general needs log, and this referral type is for supported housing.",Do you know the household's combined income after tax?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Populated when someone hits the soft validation and confirmed in the service,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,Weekly rent,Populated when the soft validation and confirmed in the service,What is the service charge?,Weekly service charge,What is the personal service charge?,Weekly personal service charge,What is the support charge?,Weekly support charge,Total charge to the tenant,Weekly total charge to the tenant,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Can you estimate the outstanding amount?,Estimated outstanding amount,Weekly total rent shortfall charge for tenant receiving housing benefit,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? -id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,unittype_gn,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sexrab1,gender_same_as_sex1,gender_description1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,working_situation_illness_check,details_known_2,age2,relat2,multiple_partners_value_check,sexrab2,gender_same_as_sex2,gender_description2,sex2,ecstat2,details_known_3,age3,relat3,sexrab3,gender_same_as_sex3,gender_description3,sex3,ecstat3,details_known_4,age4,relat4,sexrab4,gender_same_as_sex4,gender_description4,sex4,ecstat4,details_known_5,age5,relat5,sexrab5,gender_same_as_sex5,gender_description5,sex5,ecstat5,details_known_6,age6,relat6,sexrab6,gender_same_as_sex6,gender_description6,sex6,ecstat6,details_known_7,age7,relat7,sexrab7,gender_same_as_sex7,gender_description7,sex7,ecstat7,details_known_8,age8,relat8,sexrab8,gender_same_as_sex8,gender_description8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_type,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,1,2026,,MHCLG,MHCLG,1,7,0,2026-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,0,2,6,2,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,7,1,3,2026-03-30,1,,1,2026-03-31,,,3,1,4,,2,4,,1,4,0,0,2,35,,F,1,,F,0,2,36,0,,0,32,P,,M,2,Non-binary,M,6,1,-9,R,R,3,,R,10,0,-9,R,R,3,,R,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,0,,,,0,0,1,268,,6,1,1,,,2,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, +Log ID,Status of log,ID of a set of duplicate logs,User the log is created by,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,What is the property's local authority?,Local authority code,Is the UPRN known?,UPRN of the address selected,Was the 'No address found' page seen?,Address line 1 input from address matching feature,Postcode input from address matching feature,Address line 1 entered in bulk upload file,Address line 2 entered in bulk upload file,Town or city entered in bulk upload file,County entered in bulk upload file,Postcode entered in bulk upload file,Local authority entered in bulk upload file,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,The following soft validation was confirmed: You told us that the property has been vacant for more than 2 years. This is higher than we would expect.,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,The following soft validation was confirmed: You told us the property has been vacant for 2 years. This is higher than we would expect.,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,The following soft validation was confirmed: You told us somebody in the household is pregnant. You also told us there are no female tenants living at the property.,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8","Type of household 1 = 1 elder; 2 = 2 adults, including elder(s); 3 = 1 adult; 4 = 2 adults; 5 = 1 adult & 1+ children; 6 = 2+ adults & 1+ children; 9 = Other",Total number of dependent children in the household (Sum of when RELAT2-8 = C),Total number of elders in household (Sum of when AGE1-8 >= 60),Total number of adults in household,What is the lead tenant's age?,The following soft validation was confirmed: You told us this person is aged %{age} years and retired. The minimum expected retirement age for %{gender} in England is %{age}.,What was the lead tenant's sex at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter the lead tenant's gender identity",Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,The following soft validation was confirmed: You have said that at least one person's situation is 'Unable to work because of long-term sickness or disability'.,Are the details of tenant 2 known?,What is person 2's age?,What is person 2's relationship to the lead tenant?,The following soft validation was confirmed: You said that more than one person in the household is the partner of the lead tenant. Are you sure this is correct?,What was person 2's sex at birth?,Is the gender person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Are the details of tenant 3 known?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Is the gender person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Are the details of tenant 4 known?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Is the gender person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Are the details of tenant 5 known?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Is the gender person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Are the details of tenant 6 known?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Is the gender person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Are the details of tenant 7 known?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Is the gender person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Are the details of tenant 8 known?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Is the gender person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",The soft validation was confirmed,Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Was the local authority of the household's last settled home known?,The internal value to indicate if the previous LA was inferred from the postcode,Previous location LA name,Previous location's ONS LA Code,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",What was the source of referral for this letting?,What was the source of referral for this letting?,What was the source of referral for this letting?,Do you know the household's combined income after tax?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Populated when someone hits the soft validation and confirmed in the service,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,Weekly rent,Populated when the soft validation and confirmed in the service,What is the service charge?,Weekly service charge,What is the personal service charge?,Weekly personal service charge,What is the support charge?,Weekly support charge,Total charge to the tenant,Weekly total charge to the tenant,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Can you estimate the outstanding amount?,Estimated outstanding amount,Weekly total rent shortfall charge for tenant receiving housing benefit,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? +id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,unittype_gn,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sexrab1,gender_same_as_sex1,gender_description1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,working_situation_illness_check,details_known_2,age2,relat2,multiple_partners_value_check,sexrab2,gender_same_as_sex2,gender_description2,sex2,ecstat2,details_known_3,age3,relat3,sexrab3,gender_same_as_sex3,gender_description3,sex3,ecstat3,details_known_4,age4,relat4,sexrab4,gender_same_as_sex4,gender_description4,sex4,ecstat4,details_known_5,age5,relat5,sexrab5,gender_same_as_sex5,gender_description5,sex5,ecstat5,details_known_6,age6,relat6,sexrab6,gender_same_as_sex6,gender_description6,sex6,ecstat6,details_known_7,age7,relat7,sexrab7,gender_same_as_sex7,gender_description7,sex7,ecstat7,details_known_8,age8,relat8,sexrab8,gender_same_as_sex8,gender_description8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_register,referral_noms,referral_org,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate +,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,1,2026,,MHCLG,MHCLG,1,7,0,2026-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,0,2,6,2,,Address line 1,,London,,NW9 5LL,false,Barnet,E09000003,0,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,7,1,3,2026-03-30,1,,1,2026-03-31,,,3,1,4,,2,4,,1,4,0,0,2,35,,F,1,,F,0,2,36,0,,0,32,P,,M,2,Non-binary,M,6,1,-9,R,R,3,,R,10,0,-9,R,R,3,,R,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,,6,1,0,TN23 6LZ,1,false,Ashford,E07000105,1,0,1,0,0,0,0,0,1,0,0,1,,,0,0,1,268,,6,1,1,,,2,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,1,0,12.0,6.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_labels_26.csv b/spec/fixtures/files/lettings_log_csv_export_labels_26.csv index f4d1d1240..7e8c7ec08 100644 --- a/spec/fixtures/files/lettings_log_csv_export_labels_26.csv +++ b/spec/fixtures/files/lettings_log_csv_export_labels_26.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,User the log is created by,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,What is the property's local authority?,Local authority code,Is the UPRN known?,UPRN of the address selected,Was the 'No address found' page seen?,Address line 1 input from address matching feature,Postcode input from address matching feature,Address line 1 entered in bulk upload file,Address line 2 entered in bulk upload file,Town or city entered in bulk upload file,County entered in bulk upload file,Postcode entered in bulk upload file,Local authority entered in bulk upload file,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,The following soft validation was confirmed: You told us that the property has been vacant for more than 2 years. This is higher than we would expect.,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,The following soft validation was confirmed: You told us the property has been vacant for 2 years. This is higher than we would expect.,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,The following soft validation was confirmed: You told us somebody in the household is pregnant. You also told us there are no female tenants living at the property.,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8","Type of household 1 = 1 elder; 2 = 2 adults, including elder(s); 3 = 1 adult; 4 = 2 adults; 5 = 1 adult & 1+ children; 6 = 2+ adults & 1+ children; 9 = Other",Total number of dependent children in the household (Sum of when RELAT2-8 = C),Total number of elders in household (Sum of when AGE1-8 >= 60),Total number of adults in household,What is the lead tenant's age?,The following soft validation was confirmed: You told us this person is aged %{age} years and retired. The minimum expected retirement age for %{gender} in England is %{age}.,What was the lead tenant's sex at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter the lead tenant's gender identity",Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,The following soft validation was confirmed: You have said that at least one person's situation is 'Unable to work because of long-term sickness or disability'.,Are the details of tenant 2 known?,What is person 2's age?,What is person 2's relationship to the lead tenant?,The following soft validation was confirmed: You said that more than one person in the household is the partner of the lead tenant. Are you sure this is correct?,What was person 2's sex at birth?,Is the gender person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Are the details of tenant 3 known?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Is the gender person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Are the details of tenant 4 known?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Is the gender person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Are the details of tenant 5 known?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Is the gender person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Are the details of tenant 6 known?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Is the gender person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Are the details of tenant 7 known?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Is the gender person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Are the details of tenant 8 known?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Is the gender person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",The soft validation was confirmed,Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Was the local authority of the household's last settled home known?,The internal value to indicate if the previous LA was inferred from the postcode,Previous location LA name,Previous location's ONS LA Code,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",,What was the source of referral for this letting?,"The following soft validation was confirmed: Are you sure? This is a general needs log, and this referral type is for supported housing.",Do you know the household's combined income after tax?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Populated when someone hits the soft validation and confirmed in the service,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,Weekly rent,Populated when the soft validation and confirmed in the service,What is the service charge?,Weekly service charge,What is the personal service charge?,Weekly personal service charge,What is the support charge?,Weekly support charge,Total charge to the tenant,Weekly total charge to the tenant,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Can you estimate the outstanding amount?,Estimated outstanding amount,Weekly total rent shortfall charge for tenant receiving housing benefit,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? -id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,unittype_gn,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sexrab1,gender_same_as_sex1,gender_description1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,working_situation_illness_check,details_known_2,age2,relat2,multiple_partners_value_check,sexrab2,gender_same_as_sex2,gender_description2,sex2,ecstat2,details_known_3,age3,relat3,sexrab3,gender_same_as_sex3,gender_description3,sex3,ecstat3,details_known_4,age4,relat4,sexrab4,gender_same_as_sex4,gender_description4,sex4,ecstat4,details_known_5,age5,relat5,sexrab5,gender_same_as_sex5,gender_description5,sex5,ecstat5,details_known_6,age6,relat6,sexrab6,gender_same_as_sex6,gender_description6,sex6,ecstat6,details_known_7,age7,relat7,sexrab7,gender_same_as_sex7,gender_description7,sex7,ecstat7,details_known_8,age8,relat8,sexrab8,gender_same_as_sex8,gender_description8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_type,referral,referral_value_check,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,single log,2026,,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2026-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,No,Affordable rent basis,Tenant abandoned property,No,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,House,Yes,3,2026-03-30,1,,Yes,2026-03-31,,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,4,,Yes,4,0,0,2,35,,Female,Yes,,Female,White,Irish,Australia,Other,,Yes,32,Yes,,Male,"No, enter gender identity",Non-binary,Male,Not seeking work,No,Not known,Prefers not to say,Prefers not to say,Prefers not to say,,Prefers not to say,Prefers not to say,Yes,Not known,Tenant prefers not to say,Prefers not to say,Prefers not to say,,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,No,,,,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,,Every 2 weeks,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,, +Log ID,Status of log,ID of a set of duplicate logs,User the log is created by,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,The internal value to indicate if the LA was inferred from the postcode,What is the property's local authority?,Local authority code,Is the UPRN known?,UPRN of the address selected,Was the 'No address found' page seen?,Address line 1 input from address matching feature,Postcode input from address matching feature,Address line 1 entered in bulk upload file,Address line 2 entered in bulk upload file,Town or city entered in bulk upload file,County entered in bulk upload file,Postcode entered in bulk upload file,Local authority entered in bulk upload file,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,The following soft validation was confirmed: You told us that the property has been vacant for more than 2 years. This is higher than we would expect.,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,The following soft validation was confirmed: You told us the property has been vacant for 2 years. This is higher than we would expect.,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,The following soft validation was confirmed: You told us somebody in the household is pregnant. You also told us there are no female tenants living at the property.,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8","Type of household 1 = 1 elder; 2 = 2 adults, including elder(s); 3 = 1 adult; 4 = 2 adults; 5 = 1 adult & 1+ children; 6 = 2+ adults & 1+ children; 9 = Other",Total number of dependent children in the household (Sum of when RELAT2-8 = C),Total number of elders in household (Sum of when AGE1-8 >= 60),Total number of adults in household,What is the lead tenant's age?,The following soft validation was confirmed: You told us this person is aged %{age} years and retired. The minimum expected retirement age for %{gender} in England is %{age}.,What was the lead tenant's sex at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter the lead tenant's gender identity",Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,The following soft validation was confirmed: You have said that at least one person's situation is 'Unable to work because of long-term sickness or disability'.,Are the details of tenant 2 known?,What is person 2's age?,What is person 2's relationship to the lead tenant?,The following soft validation was confirmed: You said that more than one person in the household is the partner of the lead tenant. Are you sure this is correct?,What was person 2's sex at birth?,Is the gender person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,Are the details of tenant 3 known?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Is the gender person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,Are the details of tenant 4 known?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Is the gender person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,Are the details of tenant 5 known?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Is the gender person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,Are the details of tenant 6 known?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Is the gender person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,Are the details of tenant 7 known?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Is the gender person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,Are the details of tenant 8 known?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Is the gender person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",The soft validation was confirmed,Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Was the local authority of the household's last settled home known?,The internal value to indicate if the previous LA was inferred from the postcode,Previous location LA name,Previous location's ONS LA Code,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",What was the source of referral for this letting?,What was the source of referral for this letting?,What was the source of referral for this letting?,Do you know the household's combined income after tax?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Populated when someone hits the soft validation and confirmed in the service,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,Weekly rent,Populated when the soft validation and confirmed in the service,What is the service charge?,Weekly service charge,What is the personal service charge?,Weekly personal service charge,What is the support charge?,Weekly support charge,Total charge to the tenant,Weekly total charge to the tenant,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,Populated when the soft validation and confirmed in the service,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Can you estimate the outstanding amount?,Estimated outstanding amount,Weekly total rent shortfall charge for tenant receiving housing benefit,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? +id,status,duplicate_set_id,created_by,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn,address_line1,address_line2,town_or_city,county,postcode_full,is_la_inferred,la_label,la,uprn_known,uprn_selection,address_search_value_check,address_line1_input,postcode_full_input,address_line1_as_entered,address_line2_as_entered,town_or_city_as_entered,county_as_entered,postcode_full_as_entered,la_as_entered,unittype_gn,wchair,beds,voiddate,vacdays,void_date_value_check,majorrepairs,mrcdate,major_repairs_date_value_check,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,pregnancy_value_check,refused,hhtype,totchild,totelder,totadult,age1,retirement_value_check,sexrab1,gender_same_as_sex1,gender_description1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,working_situation_illness_check,details_known_2,age2,relat2,multiple_partners_value_check,sexrab2,gender_same_as_sex2,gender_description2,sex2,ecstat2,details_known_3,age3,relat3,sexrab3,gender_same_as_sex3,gender_description3,sex3,ecstat3,details_known_4,age4,relat4,sexrab4,gender_same_as_sex4,gender_description4,sex4,ecstat4,details_known_5,age5,relat5,sexrab5,gender_same_as_sex5,gender_description5,sex5,ecstat5,details_known_6,age6,relat6,sexrab6,gender_same_as_sex6,gender_description6,sex6,ecstat6,details_known_7,age7,relat7,sexrab7,gender_same_as_sex7,gender_description7,sex7,ecstat7,details_known_8,age8,relat8,sexrab8,gender_same_as_sex8,gender_description8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,reasonother_value_check,prevten,homeless,ppcodenk,ppostcode_full,previous_la_known,is_previous_la_inferred,prevloc_label,prevloc,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_register,referral_noms,referral_org,net_income_known,incref,incfreq,earnings,net_income_value_check,hb,has_benefits,benefits,household_charge,nocharge,period,brent,wrent,rent_value_check,scharge,wscharge,pscharge,wpschrge,supcharg,wsupchrg,tcharge,wtcharge,scharge_value_check,pscharge_value_check,supcharg_value_check,hbrentshortfall,tshortfall_known,tshortfall,wtshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate +,in_progress,,s.port@jeemayle.com,s.port@jeemayle.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,single log,2026,,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2026-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,No,Affordable rent basis,Tenant abandoned property,No,,Address line 1,,London,,NW9 5LL,No,Barnet,E09000003,No,,,,,address line 1 as entered,address line 2 as entered,town or city as entered,county as entered,AB1 2CD,la as entered,House,Yes,3,2026-03-30,1,,Yes,2026-03-31,,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,4,,Yes,4,0,0,2,35,,Female,Yes,,Female,White,Irish,Australia,Other,,Yes,32,Yes,,Male,"No, enter gender identity",Non-binary,Male,Not seeking work,No,Not known,Prefers not to say,Prefers not to say,Prefers not to say,,Prefers not to say,Prefers not to say,Yes,Not known,Tenant prefers not to say,Prefers not to say,Prefers not to say,,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,,Other supported housing,No,Yes,TN23 6LZ,Yes,No,Ashford,E07000105,Yes,,Yes,,,,No,No,Yes,No,No,Renewal to the same tenant in the same property,,,Yes,No,Weekly,268,,Universal Credit housing element,Yes,All,,,Every 2 weeks,200.0,100.0,,50.0,25.0,40.0,20.0,35.0,17.5,325.0,162.5,,,,Yes,Yes,12.0,6.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_non_support_codes_26.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_codes_26.csv index ae4d47331..53263b201 100644 --- a/spec/fixtures/files/lettings_log_csv_export_non_support_codes_26.csv +++ b/spec/fixtures/files/lettings_log_csv_export_non_support_codes_26.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,Is the UPRN known?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,What is the property's local authority?,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8",What is the lead tenant's age?,What was the lead tenant's sex at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter the lead tenant's gender identity",Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,What is person 2's age?,What is person 2's relationship to the lead tenant?,What was person 2's sex at birth?,Is the gender person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Is the gender person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Is the gender person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Is the gender person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Is the gender person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Is the gender person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Is the gender person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Previous location LA name,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",,What was the source of referral for this letting?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,What is the service charge?,What is the personal service charge?,What is the support charge?,Total charge to the tenant,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Estimated outstanding amount,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? -id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unittype_gn,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,refused,age1,sexrab1,gender_same_as_sex1,gender_description1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,age2,relat2,sexrab2,gender_same_as_sex2,gender_description2,sex2,ecstat2,age3,relat3,sexrab3,gender_same_as_sex3,gender_description3,sex3,ecstat3,age4,relat4,sexrab4,gender_same_as_sex4,gender_description4,sex4,ecstat4,age5,relat5,sexrab5,gender_same_as_sex5,gender_description5,sex5,ecstat5,age6,relat6,sexrab6,gender_same_as_sex6,gender_description6,sex6,ecstat6,age7,relat7,sexrab7,gender_same_as_sex7,gender_description7,sex7,ecstat7,age8,relat8,sexrab8,gender_same_as_sex8,gender_description8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_type,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,choreographer@owtluk.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,1,2026,,MHCLG,MHCLG,1,7,0,2026-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,0,2,6,2,0,,Address line 1,,London,,NW9 5LL,Barnet,7,1,3,2026-03-30,1,1,2026-03-31,,3,1,4,,2,4,1,35,F,1,,F,0,2,36,0,32,P,M,2,Non-binary,M,6,-9,R,R,3,,R,10,-9,R,R,3,,R,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,0,0,,,0,1,268,6,1,1,,,2,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,, +Log ID,Status of log,ID of a set of duplicate logs,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,Is the UPRN known?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,What is the property's local authority?,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8",What is the lead tenant's age?,What was the lead tenant's sex at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter the lead tenant's gender identity",Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,What is person 2's age?,What is person 2's relationship to the lead tenant?,What was person 2's sex at birth?,Is the gender person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Is the gender person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Is the gender person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Is the gender person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Is the gender person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Is the gender person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Is the gender person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Previous location LA name,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",What was the source of referral for this letting?,What was the source of referral for this letting?,What was the source of referral for this letting?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,What is the service charge?,What is the personal service charge?,What is the support charge?,Total charge to the tenant,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Estimated outstanding amount,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? +id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unittype_gn,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,refused,age1,sexrab1,gender_same_as_sex1,gender_description1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,age2,relat2,sexrab2,gender_same_as_sex2,gender_description2,sex2,ecstat2,age3,relat3,sexrab3,gender_same_as_sex3,gender_description3,sex3,ecstat3,age4,relat4,sexrab4,gender_same_as_sex4,gender_description4,sex4,ecstat4,age5,relat5,sexrab5,gender_same_as_sex5,gender_description5,sex5,ecstat5,age6,relat6,sexrab6,gender_same_as_sex6,gender_description6,sex6,ecstat6,age7,relat7,sexrab7,gender_same_as_sex7,gender_description7,sex7,ecstat7,age8,relat8,sexrab8,gender_same_as_sex8,gender_description8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_register,referral_noms,referral_org,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate +,in_progress,,choreographer@owtluk.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,1,2026,,MHCLG,MHCLG,1,7,0,2026-04-01,2,2,,,2,HIJKLMN,ABCDEFG,1,0,2,6,2,0,,Address line 1,,London,,NW9 5LL,Barnet,7,1,3,2026-03-30,1,1,2026-03-31,,3,1,4,,2,4,1,35,F,1,,F,0,2,36,0,32,P,M,2,Non-binary,M,6,-9,R,R,3,,R,10,-9,R,R,3,,R,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,4,1,2,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,2,7,4,,6,1,0,TN23 6LZ,Ashford,1,0,1,0,0,0,0,0,1,0,0,1,,,0,1,268,6,1,1,,,2,200.0,50.0,40.0,35.0,325.0,1,12.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/files/lettings_log_csv_export_non_support_labels_26.csv b/spec/fixtures/files/lettings_log_csv_export_non_support_labels_26.csv index cd7736634..b012865a3 100644 --- a/spec/fixtures/files/lettings_log_csv_export_non_support_labels_26.csv +++ b/spec/fixtures/files/lettings_log_csv_export_non_support_labels_26.csv @@ -1,3 +1,3 @@ -Log ID,Status of log,ID of a set of duplicate logs,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,Is the UPRN known?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,What is the property's local authority?,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8",What is the lead tenant's age?,What was the lead tenant's sex at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter the lead tenant's gender identity",Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,What is person 2's age?,What is person 2's relationship to the lead tenant?,What was person 2's sex at birth?,Is the gender person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Is the gender person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Is the gender person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Is the gender person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Is the gender person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Is the gender person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Is the gender person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Previous location LA name,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",,What was the source of referral for this letting?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,What is the service charge?,What is the personal service charge?,What is the support charge?,Total charge to the tenant,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Estimated outstanding amount,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? -id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unittype_gn,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,refused,age1,sexrab1,gender_same_as_sex1,gender_description1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,age2,relat2,sexrab2,gender_same_as_sex2,gender_description2,sex2,ecstat2,age3,relat3,sexrab3,gender_same_as_sex3,gender_description3,sex3,ecstat3,age4,relat4,sexrab4,gender_same_as_sex4,gender_description4,sex4,ecstat4,age5,relat5,sexrab5,gender_same_as_sex5,gender_description5,sex5,ecstat5,age6,relat6,sexrab6,gender_same_as_sex6,gender_description6,sex6,ecstat6,age7,relat7,sexrab7,gender_same_as_sex7,gender_description7,sex7,ecstat7,age8,relat8,sexrab8,gender_same_as_sex8,gender_description8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_type,referral,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate -,in_progress,,choreographer@owtluk.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,single log,2026,,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2026-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,No,Affordable rent basis,Tenant abandoned property,No,No,,Address line 1,,London,,NW9 5LL,Barnet,House,Yes,3,2026-03-30,1,Yes,2026-03-31,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,4,Yes,35,Female,Yes,,Female,White,Irish,Australia,Other,32,Yes,Male,"No, enter gender identity",Non-binary,Male,Not seeking work,Not known,Prefers not to say,Prefers not to say,Prefers not to say,,Prefers not to say,Prefers not to say,Not known,Tenant prefers not to say,Prefers not to say,Prefers not to say,,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,No,No,,,No,Weekly,268,Universal Credit housing element,Yes,All,,,Every 2 weeks,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,, +Log ID,Status of log,ID of a set of duplicate logs,User the log is assigned to,Is the user in the assigned_to column the data protection officer?,Time and date the log was created,User who last updated the log,Time and date the log was last updated,Was the log submitted in-service or via bulk upload?,Year collection period opened,ID of a set of bulk uploaded logs,Which organisation owns this property?,Which organisation manages this letting?,What is the needs type?,What is the letting type?,Is this letting a renewal?,What is the tenancy start date?,"What is the rent type? (grouped into SR, IR or AR)",What is the rent type?,Which type of Intermediate Rent is this letting?,Which 'Other' type of Intermediate Rent is this letting?,Is this a London Affordable Rent letting?,What is the tenant code?,What is the property reference?,Has the tenant seen the MHCLG privacy notice?,Is this the first time the property has been let as social housing?,What rent product was the property most recently let as?,What is the reason for the property being vacant?,Is this property new to the social rented sector?,Is the UPRN known?,"If known, property's UPRN",Address line 1,Address line 2,Town or City,County,Postcode,What is the property's local authority?,What type of unit is the property?,Is the property built or adapted to wheelchair-user standards?,How many bedrooms does the property have?,What is the void date?,Number of days the property was vacant,Were any major repairs carried out during the void period?,What date were any major repairs completed on?,Is this letting in sheltered accommodation?,Is this a joint tenancy?,Is this a starter tenancy?,What is the type of tenancy?,"If 'Other', what is the type of tenancy?",What is the length of the fixed-term tenancy to the nearest year?,How many people live in the household at this letting?,"Where household characteristics have a 'Refused' option for some or all of: AGE1-AGE8, SEX1-SEX8, RELAT2-RELAT8, ECSTAT1-ECSTAT8",What is the lead tenant's age?,What was the lead tenant's sex at birth?,Is the gender the lead tenant identifies with the same as their sex registered at birth?,"If 'No', enter the lead tenant's gender identity",Which of these best describes the lead tenant's gender identity?,What is the lead tenant's ethnic group?,Which of these best describes the lead tenant's ethnic background?,What is the lead tenant's nationality?,Which of these best describes the lead tenant's working situation?,What is person 2's age?,What is person 2's relationship to the lead tenant?,What was person 2's sex at birth?,Is the gender person 2 identifies with the same as their sex registered at birth?,"If 'No', enter person 2's gender identity",Which of these best describes person 2's gender identity?,Which of these best describes person 2's working situation?,What is person 3's age?,What is person 3's relationship to the lead tenant?,What was person 3's sex at birth?,Is the gender person 3 identifies with the same as their sex registered at birth?,"If 'No', enter person 3's gender identity",Which of these best describes person 3's gender identity?,Which of these best describes person 3's working situation?,What is person 4's age?,What is person 4's relationship to the lead tenant?,What was person 4's sex at birth?,Is the gender person 4 identifies with the same as their sex registered at birth?,"If 'No', enter person 4's gender identity",Which of these best describes person 4's gender identity?,Which of these best describes person 4's working situation?,What is person 5's age?,What is person 5's relationship to the lead tenant?,What was person 5's sex at birth?,Is the gender person 5 identifies with the same as their sex registered at birth?,"If 'No', enter person 5's gender identity",Which of these best describes person 5's gender identity?,Which of these best describes person 5's working situation?,What is person 6's age?,What is person 6's relationship to the lead tenant?,What was person 6's sex at birth?,Is the gender person 6 identifies with the same as their sex registered at birth?,"If 'No', enter person 6's gender identity",Which of these best describes person 6's gender identity?,Which of these best describes person 6's working situation?,What is person 7's age?,What is person 7's relationship to the lead tenant?,What was person 7's sex at birth?,Is the gender person 7 identifies with the same as their sex registered at birth?,"If 'No', enter person 7's gender identity",Which of these best describes person 7's gender identity?,Which of these best describes person 7's working situation?,What is person 8's age?,What is person 8's relationship to the lead tenant?,What was person 8's sex at birth?,Is the gender person 8 identifies with the same as their sex registered at birth?,"If 'No', enter person 8's gender identity",Which of these best describes person 8's gender identity?,Which of these best describes person 8's working situation?,Does anybody in the household have links to the UK armed forces?,Is this person still serving in the UK armed forces?,Was this person seriously injured or ill as a result of serving in the UK armed forces?,Is anybody in the household pregnant?,Does anybody in the household have any disabled access needs?,"What access needs do they have? (Fully wheelchair-accessible housing, Level access housing or Wheelchair access to essential rooms)",Disabled access needs a) Fully wheelchair-accessible housing,Disabled access needs b) Wheelchair access to essential rooms,Disabled access needs c) Level access housing,Disabled access needs f) Other disabled access needs,Disabled access needs g) No disabled access needs,Disabled access needs h) Don't know,Do they have any other disabled access needs?,Does anybody in the household have a physical or mental health condition (or other illness) expected to last 12 months or more?,Does this person's condition affect their dexterity?,Does this person's condition affect their learning or understanding or concentrating?,Does this person's condition affect their hearing?,Does this person's condition affect their memory?,Does this person's condition affect their mental health?,Does this person's condition affect their mobility?,Does this person's condition affect them socially or behaviourally?,Does this person's condition affect their stamina or breathing or fatigue?,Does this person's condition affect their vision?,Does this person's condition affect them in another way?,How long has the household continuously lived in the local authority area of the new letting?,How long has the household been on the local authority waiting list for the new letting?,What is the tenant's main reason for the household leaving their last settled home?,"If 'Other', what was the main reason for leaving their last settled home?",Where was the household immediately before this letting?,Did the household experience homelessness immediately before this letting?,Previous postcode unknown or previous accommodation was temporary,What is the postcode of the household's last settled home?,Previous location LA name,Was the household given reasonable preference by the local authority?,Reasonable preference reason - They were homeless or about to lose their home (within 56 days),"Reasonable preference reason - They were living in insanitary, overcrowded or unisatisfactory housing",Reasonable preference reason - They needed to move on medical and welfare reasons (including disability),Reasonable preference reason - They needed to move to avoid hardship to themselves or others,Reasonable preference reason - Don't Know,Was the letting made under Choice-Based Lettings (CBL)?,Was the letting made under the Common Allocation Policy (CAP)?,Was the letting made under the Common Housing Register (CHR)?,Was the letting made under the Accessible Register?,"The letting was not allocated under CBL, CAP, CHR or Accessible Register.",What was the source of referral for this letting?,What was the source of referral for this letting?,What was the source of referral for this letting?,Was the household income refused?,How often does the household receive income?,How much income does the household have in total?,Is the tenant likely to be receiving any of these housing-related benefits?,"Does the tenant receive housing-related benefits? Yes if hb = Universal Credit housing element or Housing benefit, No if hb = Don't Know, Neither, Tenant prefers not to say or blank","How much of the household's income is from Universal Credit, state pensions or benefits?",Does the household pay rent or other charges for the accommodation?,Does the household pay rent or other charges for the accommodation? - flag for when household_charge is answered no,How often does the household pay rent and other charges?,What is the basic rent?,What is the service charge?,What is the personal service charge?,What is the support charge?,Total charge to the tenant,"After the household has received any housing-related benefits, will they still need to pay for rent and charges?",Estimated outstanding amount,What scheme does this letting belong to?,"From scheme code, we map to the scheme name",Does the scheme contain confidential information?,"What is this type of scheme? (Direct access hostel), Foyer, Housing for older people or Other supported housing",Is this scheme registered under the Care Standards Act 2000?,Which organisation owns the housing stock for this scheme?,What client group is this scheme intended for?,Does this scheme provide for another client group?,What is the other client group?,What support does this scheme provide?,Intended length of stay,Date scheme was created,Which location is this letting for?,What is the postcode for this location?,What is the name of this location?,How many units are at this location?,What is the most common type of unit at this location?,What are the mobility standards for the majority of the units in this location?,What is the local authority of this postcode?,When did the first property in this location become available under this scheme? +id,status,duplicate_set_id,assigned_to,is_dpo,created_at,updated_by,updated_at,creation_method,collection_start_year,bulk_upload_id,owning_organisation_name,managing_organisation_name,needstype,lettype,renewal,startdate,renttype,renttype_detail,irproduct,irproduct_other,lar,tenancycode,propcode,declaration,first_time_property_let_as_social_housing,unitletas,rsnvac,newprop,uprn_known,uprn,address_line1,address_line2,town_or_city,county,postcode_full,la_label,unittype_gn,wchair,beds,voiddate,vacdays,majorrepairs,mrcdate,sheltered,joint,startertenancy,tenancy,tenancyother,tenancylength,hhmemb,refused,age1,sexrab1,gender_same_as_sex1,gender_description1,sex1,ethnic_group,ethnic,nationality_all,ecstat1,age2,relat2,sexrab2,gender_same_as_sex2,gender_description2,sex2,ecstat2,age3,relat3,sexrab3,gender_same_as_sex3,gender_description3,sex3,ecstat3,age4,relat4,sexrab4,gender_same_as_sex4,gender_description4,sex4,ecstat4,age5,relat5,sexrab5,gender_same_as_sex5,gender_description5,sex5,ecstat5,age6,relat6,sexrab6,gender_same_as_sex6,gender_description6,sex6,ecstat6,age7,relat7,sexrab7,gender_same_as_sex7,gender_description7,sex7,ecstat7,age8,relat8,sexrab8,gender_same_as_sex8,gender_description8,sex8,ecstat8,armedforces,leftreg,reservist,preg_occ,housingneeds,housingneeds_type,housingneeds_a,housingneeds_b,housingneeds_c,housingneeds_f,housingneeds_g,housingneeds_h,housingneeds_other,illness,illness_type_4,illness_type_5,illness_type_2,illness_type_6,illness_type_7,illness_type_3,illness_type_9,illness_type_8,illness_type_1,illness_type_10,layear,waityear,reason,reasonother,prevten,homeless,ppcodenk,ppostcode_full,prevloc_label,reasonpref,rp_homeless,rp_insan_unsat,rp_medwel,rp_hardship,rp_dontknow,cbl,cap,chr,accessible_register,letting_allocation_none,referral_register,referral_noms,referral_org,incref,incfreq,earnings,hb,has_benefits,benefits,household_charge,nocharge,period,brent,scharge,pscharge,supcharg,tcharge,hbrentshortfall,tshortfall,scheme_code,scheme_service_name,scheme_confidential,SCHTYPE,scheme_registered_under_care_act,scheme_owning_organisation_name,scheme_primary_client_group,scheme_has_other_client_group,scheme_secondary_client_group,scheme_support_type,scheme_intended_stay,scheme_created_at,location_code,location_postcode,location_name,location_units,location_type_of_unit,location_mobility_type,location_local_authority,location_startdate +,in_progress,,choreographer@owtluk.com,false,2026-04-01T00:00:00+01:00,,2026-04-01T00:00:00+01:00,single log,2026,,MHCLG,MHCLG,General needs,Affordable rent general needs local authority,No,2026-04-01,Affordable Rent,Affordable Rent,,,No,HIJKLMN,ABCDEFG,Yes,No,Affordable rent basis,Tenant abandoned property,No,No,,Address line 1,,London,,NW9 5LL,Barnet,House,Yes,3,2026-03-30,1,Yes,2026-03-31,,Don’t know,Yes,Assured Shorthold Tenancy (AST) – Fixed term,,2,4,Yes,35,Female,Yes,,Female,White,Irish,Australia,Other,32,Yes,Male,"No, enter gender identity",Non-binary,Male,Not seeking work,Not known,Prefers not to say,Prefers not to say,Prefers not to say,,Prefers not to say,Prefers not to say,Not known,Tenant prefers not to say,Prefers not to say,Prefers not to say,,Person prefers not to say,Person prefers not to say,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Yes – the person is a current or former regular,No – they left up to and including 5 years ago,Yes,No,Yes,Fully wheelchair accessible housing,Yes,No,No,No,No,No,No,Yes,No,No,Yes,No,No,No,No,No,No,No,Less than 1 year,1 year but under 2 years,Loss of tied accommodation,,Other supported housing,No,Yes,TN23 6LZ,Ashford,Yes,,Yes,,,,No,No,Yes,No,No,Renewal to the same tenant in the same property,,,No,Weekly,268,Universal Credit housing element,Yes,All,,,Every 2 weeks,200.0,50.0,40.0,35.0,325.0,Yes,12.0,,,,,,,,,,,,,,,,,,,, diff --git a/spec/fixtures/variable_definitions/lettings_download_26_27.csv b/spec/fixtures/variable_definitions/lettings_download_26_27.csv index 609c3bd28..60153282c 100644 --- a/spec/fixtures/variable_definitions/lettings_download_26_27.csv +++ b/spec/fixtures/variable_definitions/lettings_download_26_27.csv @@ -23,3 +23,6 @@ gender_description5,If 'No', enter person 5's gender identity gender_description6,If 'No', enter person 6's gender identity gender_description7,If 'No', enter person 7's gender identity gender_description8,If 'No', enter person 8's gender identity +referral_register,What was the source of referral for this letting? +referral_noms,What was the source of referral for this letting? +referral_org,What was the source of referral for this letting? diff --git a/spec/lib/tasks/log_variable_definitions_spec.rb b/spec/lib/tasks/log_variable_definitions_spec.rb index 2c5894d88..73ec882c2 100644 --- a/spec/lib/tasks/log_variable_definitions_spec.rb +++ b/spec/lib/tasks/log_variable_definitions_spec.rb @@ -6,7 +6,7 @@ RSpec.describe "log_variable_definitions" do subject(:task) { Rake::Task["data_import:add_variable_definitions"] } let(:path) { "spec/fixtures/variable_definitions" } - let(:total_variable_definitions_count) { 447 } + let(:total_variable_definitions_count) { 450 } before do Rake.application.rake_require("tasks/log_variable_definitions") diff --git a/spec/models/form/lettings/pages/referral_noms_hr_spec.rb b/spec/models/form/lettings/pages/referral_noms_hr_spec.rb new file mode 100644 index 000000000..b3cd1e113 --- /dev/null +++ b/spec/models/form/lettings/pages/referral_noms_hr_spec.rb @@ -0,0 +1,79 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Pages::ReferralNomsHr, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection, form:) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + let(:prp?) { nil } + let(:organisation) { instance_double(Organisation, prp?: prp?) } + let(:is_renewal?) { nil } + let(:referral_is_from_housing_register?) { nil } + let(:log) { instance_double(LettingsLog, is_renewal?: is_renewal?, owning_organisation: organisation, referral_is_from_housing_register?: referral_is_from_housing_register?) } + + before do + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[referral_noms]) + end + + it "has the correct id" do + expect(page.id).to eq("referral_noms_hr") + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + context "and log owning organisation is not prp" do + let(:prp?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log owning organisation is prp" do + let(:prp?) { true } + + context "when log is a renewal" do + let(:is_renewal?) { true } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log is not a renewal" do + let(:is_renewal?) { false } + + context "and log referral is not from housing register" do + let(:referral_is_from_housing_register?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log referral is from housing register" do + let(:referral_is_from_housing_register?) { true } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + end + end +end diff --git a/spec/models/form/lettings/pages/referral_noms_la_hr_spec.rb b/spec/models/form/lettings/pages/referral_noms_la_hr_spec.rb new file mode 100644 index 000000000..91fb8cadb --- /dev/null +++ b/spec/models/form/lettings/pages/referral_noms_la_hr_spec.rb @@ -0,0 +1,79 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Pages::ReferralNomsLaHr, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection, form:) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + let(:prp?) { nil } + let(:organisation) { instance_double(Organisation, prp?: prp?) } + let(:is_renewal?) { nil } + let(:referral_is_from_local_authority_housing_register?) { nil } + let(:log) { instance_double(LettingsLog, is_renewal?: is_renewal?, owning_organisation: organisation, referral_is_from_local_authority_housing_register?: referral_is_from_local_authority_housing_register?) } + + before do + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[referral_noms]) + end + + it "has the correct id" do + expect(page.id).to eq("referral_noms_la_hr") + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + context "and log owning organisation is not prp" do + let(:prp?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log owning organisation is prp" do + let(:prp?) { true } + + context "when log is a renewal" do + let(:is_renewal?) { true } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log is not a renewal" do + let(:is_renewal?) { false } + + context "and log referral is not from local authority housing register" do + let(:referral_is_from_local_authority_housing_register?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log referral is from local authority housing register" do + let(:referral_is_from_local_authority_housing_register?) { true } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + end + end +end diff --git a/spec/models/form/lettings/pages/referral_org_directly_referred_spec.rb b/spec/models/form/lettings/pages/referral_org_directly_referred_spec.rb new file mode 100644 index 000000000..27e1cfa50 --- /dev/null +++ b/spec/models/form/lettings/pages/referral_org_directly_referred_spec.rb @@ -0,0 +1,79 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Pages::ReferralOrgDirectlyReferred, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection, form:) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + let(:prp?) { nil } + let(:organisation) { instance_double(Organisation, prp?: prp?) } + let(:is_renewal?) { nil } + let(:referral_is_directly_referred?) { nil } + let(:log) { instance_double(LettingsLog, is_renewal?: is_renewal?, owning_organisation: organisation, referral_is_directly_referred?: referral_is_directly_referred?) } + + before do + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[referral_org]) + end + + it "has the correct id" do + expect(page.id).to eq("referral_org_directly_referred") + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + context "and log owning organisation is not prp" do + let(:prp?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log owning organisation is prp" do + let(:prp?) { true } + + context "when log is a renewal" do + let(:is_renewal?) { true } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log is not a renewal" do + let(:is_renewal?) { false } + + context "and log referral is not nominated by local authority" do + let(:referral_is_directly_referred?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log referral is nominated by local authority" do + let(:referral_is_directly_referred?) { true } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + end + end +end diff --git a/spec/models/form/lettings/pages/referral_org_nominated_spec.rb b/spec/models/form/lettings/pages/referral_org_nominated_spec.rb new file mode 100644 index 000000000..68a0a17f1 --- /dev/null +++ b/spec/models/form/lettings/pages/referral_org_nominated_spec.rb @@ -0,0 +1,79 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Pages::ReferralOrgNominated, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection, form:) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + let(:prp?) { nil } + let(:organisation) { instance_double(Organisation, prp?: prp?) } + let(:is_renewal?) { nil } + let(:referral_is_nominated_by_local_authority?) { nil } + let(:log) { instance_double(LettingsLog, is_renewal?: is_renewal?, owning_organisation: organisation, referral_is_nominated_by_local_authority?: referral_is_nominated_by_local_authority?) } + + before do + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[referral_org]) + end + + it "has the correct id" do + expect(page.id).to eq("referral_org_nominated") + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + context "and log owning organisation is not prp" do + let(:prp?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log owning organisation is prp" do + let(:prp?) { true } + + context "when log is a renewal" do + let(:is_renewal?) { true } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log is not a renewal" do + let(:is_renewal?) { false } + + context "and log referral is not nominated by local authority" do + let(:referral_is_nominated_by_local_authority?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log referral is nominated by local authority" do + let(:referral_is_nominated_by_local_authority?) { true } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + end + end +end diff --git a/spec/models/form/lettings/pages/referral_register_la_spec.rb b/spec/models/form/lettings/pages/referral_register_la_spec.rb new file mode 100644 index 000000000..1f2459cbd --- /dev/null +++ b/spec/models/form/lettings/pages/referral_register_la_spec.rb @@ -0,0 +1,78 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Pages::ReferralRegisterLa, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection, form:) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + let(:la?) { nil } + let(:organisation) { instance_double(Organisation, la?: la?) } + let(:is_renewal?) { nil } + let(:log) { instance_double(LettingsLog, is_renewal?: is_renewal?, owning_organisation: organisation) } + + before do + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[referral_register]) + end + + it "has the correct id" do + expect(page.id).to eq("referral_register_la") + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + context "when log is a renewal" do + let(:is_renewal?) { true } + + context "and log owning organisation is la" do + let(:la?) { true } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log owning organisation is not an la" do + let(:la?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + end + + context "when log is not a renewal" do + let(:is_renewal?) { false } + + context "and log owning organisation is la" do + let(:la?) { true } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + + context "and log owning organisation is not an la" do + let(:la?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + end +end diff --git a/spec/models/form/lettings/pages/referral_register_prp_spec.rb b/spec/models/form/lettings/pages/referral_register_prp_spec.rb new file mode 100644 index 000000000..bcb48562a --- /dev/null +++ b/spec/models/form/lettings/pages/referral_register_prp_spec.rb @@ -0,0 +1,78 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Pages::ReferralRegisterPrp, type: :model do + subject(:page) { described_class.new(page_id, page_definition, subsection) } + + let(:page_id) { nil } + let(:page_definition) { nil } + let(:subsection) { instance_double(Form::Subsection, form:) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + let(:prp?) { nil } + let(:organisation) { instance_double(Organisation, prp?: prp?) } + let(:is_renewal?) { nil } + let(:log) { instance_double(LettingsLog, is_renewal?: is_renewal?, owning_organisation: organisation) } + + before do + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct subsection" do + expect(page.subsection).to eq(subsection) + end + + it "has correct questions" do + expect(page.questions.map(&:id)).to eq(%w[referral_register]) + end + + it "has the correct id" do + expect(page.id).to eq("referral_register_prp") + end + + it "has the correct description" do + expect(page.description).to be_nil + end + + it "has the correct depends_on" do + expect(page.depends_on).to be nil + end + + context "when log is a renewal" do + let(:is_renewal?) { true } + + context "and log owning organisation is prp" do + let(:prp?) { true } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + + context "and log owning organisation is not prp" do + let(:prp?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + end + + context "when log is not a renewal" do + let(:is_renewal?) { false } + + context "and log owning organisation is prp" do + let(:prp?) { true } + + it "is routed to" do + expect(page.routed_to?(log, nil)).to be true + end + end + + context "and log owning organisation is not prp" do + let(:prp?) { false } + + it "is not routed to" do + expect(page.routed_to?(log, nil)).to be false + end + end + end +end diff --git a/spec/models/form/lettings/questions/referral_noms_spec.rb b/spec/models/form/lettings/questions/referral_noms_spec.rb new file mode 100644 index 000000000..01fa26c9c --- /dev/null +++ b/spec/models/form/lettings/questions/referral_noms_spec.rb @@ -0,0 +1,83 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Questions::ReferralNoms, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page, referral_register) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + let(:referral_register) { nil } + let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + + before do + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("referral_noms") + end + + it "has the correct type" do + expect(question.type).to eq("radio") + end + + it "is not marked as derived" do + expect(question.derived?(nil)).to be false + end + + context "when referral_register is 6" do + let(:referral_register) { 6 } + + it "has the correct answer_options" do + expect(question.answer_options).to eq( + { + "1" => { + "value" => "Nominated by a local authority to a PRP", + }, + "2" => { + "value" => "Supported housing only - referred by a local authority to a PRP", + }, + "3" => { + "value" => "Internal transfer from another property owned by the same PRP landlord - for existing social tenants only", + }, + "4" => { + "value" => "Other", + }, + }.freeze, + ) + end + end + + context "when referral_register is 7" do + let(:referral_register) { 7 } + + it "has the correct answer_options" do + expect(question.answer_options).to eq( + { + "5" => { + "value" => "Internal transfer from another property owned by the same PRP landlord - for existing social tenants only", + }, + "6" => { + "value" => " A different PRP landlord - for existing social tenants only", + }, + "7" => { + "value" => "Directly referred by a third party", + }, + "8" => { + "value" => "Other", + }, + }.freeze, + ) + end + end + + it "has the correct question_number" do + expect(question.question_number).to eq(92) + end +end diff --git a/spec/models/form/lettings/questions/referral_org_spec.rb b/spec/models/form/lettings/questions/referral_org_spec.rb new file mode 100644 index 000000000..e6962be23 --- /dev/null +++ b/spec/models/form/lettings/questions/referral_org_spec.rb @@ -0,0 +1,119 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Questions::ReferralOrg, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page, referral_noms) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + let(:referral_noms) { nil } + let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + + before do + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("referral_org") + end + + it "has the correct type" do + expect(question.type).to eq("radio") + end + + it "is not marked as derived" do + expect(question.derived?(nil)).to be false + end + + context "when referral_noms is 1" do + let(:referral_noms) { 1 } + + it "has the correct answer_options" do + expect(question.answer_options).to eq( + { + "1" => { + "value" => "Referred to LA by health service", + }, + "2" => { + "value" => "Referred to LA by community learning disability team", + }, + "3" => { + "value" => "Referred to LA by community mental health team", + }, + "4" => { + "value" => "Referred to LA by adult social services", + }, + "5" => { + "value" => "Referred to LA by children's social care", + }, + "6" => { + "value" => "Referred to LA by police, probation, prison or youth offending team following a custodial sentence", + }, + "7" => { + "value" => "Referred to LA by police, probation, prison or youth offending team without a custodial sentence", + }, + "8" => { + "value" => "Referred to LA by a voluntary agency", + }, + "9" => { + "value" => "Other referral", + }, + "10" => { + "value" => "Don't know", + }, + }.freeze, + ) + end + end + + context "when referral_noms is 7" do + let(:referral_noms) { 7 } + + it "has the correct answer_options" do + expect(question.answer_options).to eq( + { + "11" => { + "value" => "Health service", + }, + "12" => { + "value" => "Community learning disability team", + }, + "13" => { + "value" => "Community mental health team", + }, + "14" => { + "value" => "Adult social services", + }, + "15" => { + "value" => "Children's social care", + }, + "16" => { + "value" => "Police, probation, prison or youth offending team following a custodial sentence", + }, + "17" => { + "value" => "Police, probation, prison or youth offending team without a custodial sentence", + }, + "18" => { + "value" => "Voluntary agency", + }, + "19" => { + "value" => "Other third party", + }, + "20" => { + "value" => "Don't know", + }, + }.freeze, + ) + end + end + + it "has the correct question_number" do + expect(question.question_number).to eq(92) + end +end diff --git a/spec/models/form/lettings/questions/referral_register_spec.rb b/spec/models/form/lettings/questions/referral_register_spec.rb new file mode 100644 index 000000000..3722adc1f --- /dev/null +++ b/spec/models/form/lettings/questions/referral_register_spec.rb @@ -0,0 +1,104 @@ +require "rails_helper" + +RSpec.describe Form::Lettings::Questions::ReferralRegister, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page, provider_type) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + let(:provider_type) { nil } + let(:subsection) { instance_double(Form::Subsection) } + let(:form) { instance_double(Form, start_date: Time.zone.today) } + let(:is_renewal?) { nil } + let(:log) { instance_double(LettingsLog, is_renewal?: is_renewal?) } + + before do + allow(page).to receive(:subsection).and_return(subsection) + allow(subsection).to receive(:form).and_return(form) + end + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("referral_register") + end + + it "has the correct type" do + expect(question.type).to eq("radio") + end + + context "when log is a renewal" do + let(:is_renewal?) { true } + + it "is marked as derived" do + expect(question.derived?(log)).to be true + end + end + + context "when log is not a renewal" do + let(:is_renewal?) { false } + + it "is not marked as derived" do + expect(question.derived?(log)).to be false + end + end + + context "when log is owned by an LA" do + let(:provider_type) { :la } + + it "has the correct answer_options" do + expect(question.answer_options).to eq( + { + "1" => { + "value" => "Renewal to the same tenant in the same property", + }, + "2" => { + "value" => "Internal transfer from another property owned by the same local authority - for existing social tenants only", + }, + "3" => { + "value" => "From a housing register (waiting list)", + }, + "4" => { + "value" => "Tenant applied directly (not via a nomination or housing register)", + }, + }.freeze, + ) + end + + it "has the correct question_number" do + expect(question.question_number).to eq(91) + end + end + + context "when log is owned by an PRP" do + let(:provider_type) { :prp } + + it "has the correct answer_options" do + expect(question.answer_options).to eq( + { + "5" => { + "value" => "Renewal to the same tenant in the same property", + }, + "6" => { + "value" => "From a local authority housing register (waiting list) or a register with local authority involvement", + }, + "7" => { + "value" => "From a housing register (waiting list) with no local authority involvement", + }, + "8" => { + "value" => "Tenant applied directly (not via a nomination or waiting list)", + }, + "9" => { + "value" => "Don't know", + }, + }.freeze, + ) + end + + it "has the correct question_number" do + expect(question.question_number).to eq(92) + end + end +end diff --git a/spec/models/form/lettings/subsections/household_situation_spec.rb b/spec/models/form/lettings/subsections/household_situation_spec.rb index eb056ca7a..3da63a140 100644 --- a/spec/models/form/lettings/subsections/household_situation_spec.rb +++ b/spec/models/form/lettings/subsections/household_situation_spec.rb @@ -10,16 +10,18 @@ RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do before do allow(section).to receive(:form).and_return(form) + allow(form).to receive(:start_year_2024_or_later?).and_return(false) + allow(form).to receive(:start_year_2025_or_later?).and_return(false) + allow(form).to receive(:start_year_2026_or_later?).and_return(false) end it "has correct section" do expect(household_situation.section).to eq(section) end - context "with form year before 2024" do + context "with form year is 2024", metadata: { year: 24 } do before do - allow(form).to receive(:start_year_2024_or_later?).and_return(false) - allow(form).to receive(:start_year_2025_or_later?).and_return(false) + allow(form).to receive(:start_year_2024_or_later?).and_return(true) end it "has correct pages" do @@ -29,6 +31,7 @@ RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do time_on_waiting_list reason_for_leaving_last_settled_home reason_for_leaving_last_settled_home_renewal + reasonother_value_check previous_housing_situation previous_housing_situation_renewal homelessness @@ -47,10 +50,10 @@ RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do end end - context "with form year is 2024" do + context "with form year is 2025", metadata: { year: 25 } do before do allow(form).to receive(:start_year_2024_or_later?).and_return(true) - allow(form).to receive(:start_year_2025_or_later?).and_return(false) + allow(form).to receive(:start_year_2025_or_later?).and_return(true) end it "has correct pages" do @@ -69,20 +72,23 @@ RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do reasonable_preference reasonable_preference_reason allocation_system - referral + referral_type + referral_direct + referral_la referral_prp - referral_supported_housing - referral_supported_housing_prp + referral_hsc + referral_justice referral_value_check ], ) end end - context "with form year is 2025" do + context "with form year is 2026", metadata: { year: 26 } do before do allow(form).to receive(:start_year_2024_or_later?).and_return(true) allow(form).to receive(:start_year_2025_or_later?).and_return(true) + allow(form).to receive(:start_year_2026_or_later?).and_return(true) end it "has correct pages" do @@ -101,13 +107,12 @@ RSpec.describe Form::Lettings::Subsections::HouseholdSituation, type: :model do reasonable_preference reasonable_preference_reason allocation_system - referral_type - referral_direct - referral_la - referral_prp - referral_hsc - referral_justice - referral_value_check + referral_register_la + referral_register_prp + referral_noms_la_hr + referral_noms_hr + referral_org_nominated + referral_org_directly_referred ], ) end diff --git a/spec/models/validations/household_validations_spec.rb b/spec/models/validations/household_validations_spec.rb index f79f2c6e4..5d2d971e5 100644 --- a/spec/models/validations/household_validations_spec.rb +++ b/spec/models/validations/household_validations_spec.rb @@ -1,6 +1,8 @@ require "rails_helper" RSpec.describe Validations::HouseholdValidations do + include CollectionTimeHelper + subject(:household_validator) { validator_class.new } let(:validator_class) { Class.new { include Validations::HouseholdValidations } } @@ -488,6 +490,141 @@ RSpec.describe Validations::HouseholdValidations do expect(record.errors["homeless"]).to be_empty end end + + context "when start year is 2026" do + let(:startdate) { collection_start_date_for_year(2026) } + + [ + { + internal_transfer: true, + label: "LA", + referral_register: 2, + referral_noms: nil, + }, + { + internal_transfer: true, + label: "PRP", + referral_register: 6, + referral_noms: 3, + }, + { + internal_transfer: true, + label: "PRP", + referral_register: 7, + referral_noms: 5, + }, + { + internal_transfer: false, + label: "LA", + referral_register: 1, + referral_noms: nil, + }, + { + internal_transfer: false, + label: "PRP", + referral_register: 6, + referral_noms: 2, + }, + { + internal_transfer: false, + label: "PRP", + referral_register: 7, + referral_noms: 6, + }, + ] + .each do |scenario| + context "and record #{scenario[:internal_transfer] ? 'is ' : 'is not '}internal transfer via #{scenario[:label]} path" do + before do + record.owning_organisation.provider_type = scenario[:label] + record.referral_register = scenario[:referral_register] + record.referral_noms = scenario[:referral_noms] + end + + context "and prevten is nil" do + before do + record.prevten = nil + end + + it "does not add an error" do + household_validator.validate_referral(record) + expect(record.errors["prevten"]).to be_empty + expect(record.errors["referral_register"]).to be_empty + expect(record.errors["referral_noms"]).to be_empty + end + end + + [ + { code: 3, label: "Private sector tenancy" }, + { code: 27, label: "Owner occupation (low-cost home ownership)" }, + { code: 26, label: "Owner occupation (private)" }, + { code: 28, label: "Living with friends or family (long-term)" }, + { code: 39, label: "Sofa surfing (moving regularly between family or friends, no permanent bed)" }, + { code: 14, label: "Bed and breakfast" }, + { code: 7, label: "Direct access hostel" }, + { code: 10, label: "Hospital" }, + { code: 29, label: "Prison or approved probation hostel" }, + { code: 19, label: "Rough sleeping" }, + { code: 18, label: "Any other temporary accommodation" }, + { code: 13, label: "Children’s home or foster care" }, + { code: 24, label: "Home Office Asylum Support" }, + { code: 37, label: "Host family or similar refugee accommodation" }, + { code: 23, label: "Mobile home or caravan" }, + { code: 21, label: "Refuge" }, + { code: 9, label: "Residential care home" }, + { code: 4, label: "Tied housing or rented with job" }, + { code: 25, label: "Any other accommodation" }, + ].each do |prevten| + context "and prevten is #{prevten[:code]}" do + before do + record.prevten = prevten[:code] + end + + if scenario[:internal_transfer] + it "adds an error" do + household_validator.validate_referral(record) + expect(record.errors["prevten"]) + .to include(match I18n.t("validations.lettings.household.prevten.general_needs.internal_transfer", prevten: prevten[:label])) + expect(record.errors["referral_register"]) + .to include(match I18n.t("validations.lettings.household.referral.general_needs.internal_transfer", prevten: prevten[:label])) + expect(record.errors["referral_noms"]) + .to include(match I18n.t("validations.lettings.household.referral.general_needs.internal_transfer", prevten: prevten[:label])) + end + else + it "does not add an error" do + household_validator.validate_referral(record) + expect(record.errors["prevten"]).to be_empty + expect(record.errors["referral_register"]).to be_empty + expect(record.errors["referral_noms"]).to be_empty + end + end + end + end + + [ + { code: 30, label: "Fixed-term local authority general needs tenancy" }, + { code: 31, label: "Lifetime local authority general needs tenancy" }, + { code: 32, label: "Fixed-term private registered provider (PRP) general needs tenancy" }, + { code: 33, label: "Lifetime private registered provider (PRP) general needs tenancy" }, + { code: 35, label: "Extra care housing" }, + { code: 38, label: "Older people’s housing for tenants with low support needs" }, + { code: 6, label: "Other supported housing" }, + ].each do |prevten| + context "and prevten is #{prevten[:code]}" do + before do + record.prevten = prevten[:code] + end + + it "does not add an error" do + household_validator.validate_referral(record) + expect(record.errors["prevten"]).to be_empty + expect(record.errors["referral_register"]).to be_empty + expect(record.errors["referral_noms"]).to be_empty + end + end + end + end + end + end end describe "la validations" do @@ -564,10 +701,14 @@ RSpec.describe Validations::HouseholdValidations do end end - context "when the referral is internal transfer" do - it "prevten can be 9" do - record.referral_type = 3 + context "when the referral is internal transfer for 2025" do + let(:startdate) { collection_start_date_for_year(2025) } + + before do record.referral = 1 + end + + it "prevten can be 9" do record.prevten = 9 household_validator.validate_previous_housing_situation(record) expect(record.errors["prevten"]) @@ -593,16 +734,53 @@ RSpec.describe Validations::HouseholdValidations do { code: 28, label: "Living with friends or family" }, { code: 29, label: "Prison or approved probation hostel" }, ].each do |prevten| - it "prevten cannot be #{prevten[:code]}" do - record.referral_type = 3 - record.referral = 1 - record.prevten = prevten[:code] - household_validator.validate_previous_housing_situation(record) - label = record.form.start_year_2025_or_later? && prevten[:code] == 28 ? "Living with friends or family (long-term)" : prevten[:label] - expect(record.errors["prevten"]) - .to include(match I18n.t("validations.lettings.household.prevten.internal_transfer", prevten: label)) - expect(record.errors["referral"]) - .to include(match I18n.t("validations.lettings.household.referral.prevten_invalid", prevten: "")) + context "and prevten is #{prevten}" do + it "adds an error" do + record.prevten = prevten[:code] + household_validator.validate_previous_housing_situation(record) + label = record.form.start_year_2025_or_later? && prevten[:code] == 28 ? "Living with friends or family (long-term)" : prevten[:label] + expect(record.errors["prevten"]) + .to include(match I18n.t("validations.lettings.household.prevten.internal_transfer", prevten: label)) + expect(record.errors["referral"]) + .to include(match I18n.t("validations.lettings.household.referral.prevten_invalid", prevten: "")) + end + end + end + end + + context "when the referral is internal transfer for 2026" do + let(:startdate) { collection_start_date_for_year(2026) } + + before do + record.owning_organisation.provider_type = "LA" + record.referral_register = 2 + end + + [ + { code: 3, label: "Private sector tenancy" }, + { code: 4, label: "Tied housing or rented with job" }, + { code: 7, label: "Direct access hostel" }, + { code: 10, label: "Hospital" }, + { code: 13, label: "Children’s home or foster care" }, + { code: 14, label: "Bed and breakfast" }, + { code: 19, label: "Rough sleeping" }, + { code: 23, label: "Mobile home or caravan" }, + { code: 24, label: "Home Office Asylum Support" }, + { code: 25, label: "Any other accommodation" }, + { code: 26, label: "Owner occupation (private)" }, + { code: 28, label: "Living with friends or family" }, + { code: 29, label: "Prison or approved probation hostel" }, + ].each do |prevten| + context "and prevten is #{prevten}" do + before do + record.prevten = prevten[:code] + end + + it "does not add an error" do + household_validator.validate_previous_housing_situation(record) + expect(record.errors["prevten"]).to be_empty + expect(record.errors["referral"]).to be_empty + end end end end diff --git a/spec/services/bulk_upload/lettings/validator_spec.rb b/spec/services/bulk_upload/lettings/validator_spec.rb index d865196ee..ce5b854fc 100644 --- a/spec/services/bulk_upload/lettings/validator_spec.rb +++ b/spec/services/bulk_upload/lettings/validator_spec.rb @@ -172,8 +172,8 @@ RSpec.describe BulkUpload::Lettings::Validator do expect(error.tenant_code).to eql(log.tenancycode) expect(error.property_ref).to eql(log.propcode) expect(error.row).to eql("2") - expect(error.cell).to eql("CX2") - expect(error.col).to eql("CX") + expect(error.cell).to eql("CX2") # this may change when adding a new field as the cols are in a random order + expect(error.col).to eql("CX") # this may change when adding a new field as the cols are in a random order end end @@ -190,8 +190,8 @@ RSpec.describe BulkUpload::Lettings::Validator do expect(error.tenant_code).to eql(log.tenancycode) expect(error.property_ref).to eql(log.propcode) expect(error.row).to eql("2") - expect(error.cell).to eql("EF2") - expect(error.col).to eql("EF") + expect(error.cell).to eql("EH2") # this may change when adding a new field as the cols are in a random order + expect(error.col).to eql("EH") # this may change when adding a new field as the cols are in a random order end end end diff --git a/spec/services/bulk_upload/lettings/year2026/csv_parser_spec.rb b/spec/services/bulk_upload/lettings/year2026/csv_parser_spec.rb index 379680848..dc1b6e2d9 100644 --- a/spec/services/bulk_upload/lettings/year2026/csv_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2026/csv_parser_spec.rb @@ -244,9 +244,9 @@ RSpec.describe BulkUpload::Lettings::Year2026::CsvParser do end it "returns correct column" do - expect(service.column_for_field("field_5")).to eql("AG") - expect(service.column_for_field("field_22")).to eql("BO") - expect(service.column_for_field("field_26")).to eql("CD") + expect(service.column_for_field("field_5")).to eql("AI") + expect(service.column_for_field("field_22")).to eql("BR") + expect(service.column_for_field("field_26")).to eql("CG") expect(service.column_for_field("field_25")).to eql("E") end end diff --git a/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb index a85bdebbb..68768d7d9 100644 --- a/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2026/row_parser_spec.rb @@ -224,7 +224,7 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do field_114: "2", field_115: "2", - field_116: "2", + field_116: "1", field_117: "1", field_118: "2", @@ -648,12 +648,12 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end context "when an invalid value error has been added" do - let(:attributes) { setup_section_params.merge({ field_116: "100" }) } + let(:attributes) { setup_section_params.merge({ field_115: "100" }) } it "does not add an additional error" do parser.valid? - expect(parser.errors[:field_116].length).to eq(1) - expect(parser.errors[:field_116]).to include(match I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "")) + expect(parser.errors[:field_115].length).to eq(1) + expect(parser.errors[:field_115]).to include(match I18n.t("validations.lettings.2026.bulk_upload.invalid_option", question: "")) end end end @@ -1160,43 +1160,236 @@ RSpec.describe BulkUpload::Lettings::Year2026::RowParser do end end - describe "#field_116" do # referral - context "when 3 ie PRP nominated by LA and owning org is LA" do - let(:attributes) { { bulk_upload:, field_116: "3", field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } + describe "#field_116, field_154, field_155, field_156" do # referral + context "when org is LA" do + let(:owning_org) { create(:organisation, :la, :with_old_visible_id) } - it "is not permitted" do - parser.valid? - expect(parser.errors[:field_116]).to be_present + let(:org_attributes) { { bulk_upload:, field_1: owning_org.old_visible_id } } + + context "and not renewal" do + let(:renewal_attributes) { org_attributes.merge({ field_7: nil }) } + + context "and field_116 is valid" do + let(:attributes) { renewal_attributes.merge({ field_116: 1 }) } + + it "does not add an error" do + parser.valid? + expect(parser.errors[:field_116]).to be_blank + expect(parser.errors[:field_154]).to be_blank + expect(parser.errors[:field_155]).to be_blank + expect(parser.errors[:field_156]).to be_blank + end + end + + context "and field_116 is invalid" do + let(:attributes) { renewal_attributes.merge({ field_116: 5 }) } # PRP option + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + + context "and field_116 is blank" do + let(:attributes) { renewal_attributes.merge({ field_116: nil }) } + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + + context "and other fields are given" do + let(:attributes) { renewal_attributes.merge({ field_116: 1, field_154: 5, field_155: 1, field_152: 1 }) } + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end end - end - context "when 4 ie referred by LA and is general needs and owning org is LA" do - let(:attributes) { { bulk_upload:, field_116: "4", field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id, field_4: "1" } } + context "and is renewal" do + let(:attributes) { org_attributes.merge({ field_7: 1, field_116: 1, field_154: 5, field_155: 1, field_156: 1 }) } - it "is not permitted" do - parser.valid? - expect(parser.errors[:field_116]).to be_present + it "does not add an error for referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_blank + expect(parser.errors[:field_154]).to be_blank + expect(parser.errors[:field_155]).to be_blank + expect(parser.errors[:field_156]).to be_blank + end end end - context "when 4 ie referred by LA and is general needs and owning org is PRP" do + context "when org is PRP" do let(:owning_org) { create(:organisation, :prp, :with_old_visible_id) } - let(:attributes) { { bulk_upload:, field_116: "4", field_1: owning_org.old_visible_id, field_2: owning_org.old_visible_id } } + let(:org_attributes) { { bulk_upload:, field_1: owning_org.old_visible_id } } - it "is permitted" do - parser.valid? - expect(parser.errors[:field_116]).to be_blank + context "and not renewal" do + let(:renewal_attributes) { org_attributes.merge({ field_7: nil }) } + + context "and field_154 is valid and does not expect an answer for field_155" do + let(:attributes) { renewal_attributes.merge({ field_154: 5 }) } + + it "does not add an error" do + parser.valid? + expect(parser.errors[:field_116]).to be_blank + expect(parser.errors[:field_154]).to be_blank + expect(parser.errors[:field_155]).to be_blank + expect(parser.errors[:field_156]).to be_blank + end + + context "and later fields are given" do + let(:attributes) { renewal_attributes.merge({ field_154: 5, field_155: 1, field_156: 1 }) } + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + end + + context "and field_154 is invalid" do + let(:attributes) { renewal_attributes.merge({ field_154: 1 }) } # LA option + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + + context "and field_154 is blank" do + let(:attributes) { renewal_attributes.merge({ field_154: nil }) } + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + + context "and field_154 is valid and expects an answer for field_155" do + let(:field_154_attributes) { renewal_attributes.merge({ field_154: 6 }) } + + context "and field_155 is valid and does not expect an answer for field_156" do + let(:attributes) { field_154_attributes.merge({ field_155: 2 }) } + + it "does not add an error" do + parser.valid? + expect(parser.errors[:field_116]).to be_blank + expect(parser.errors[:field_154]).to be_blank + expect(parser.errors[:field_155]).to be_blank + expect(parser.errors[:field_156]).to be_blank + end + + context "and later fields are given" do + let(:attributes) { field_154_attributes.merge({ field_155: 2, field_156: 1 }) } + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + end + + context "and field_155 is invalid" do + let(:attributes) { field_154_attributes.merge({ field_155: 5 }) } # needs field_154 to be 7 + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + + context "and field_155 is blank" do + let(:attributes) { field_154_attributes.merge({ field_155: nil }) } + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + + context "and field_155 is valid and expects an answer for field_156" do + let(:field_155_attributes) { field_154_attributes.merge({ field_155: 1 }) } + + context "and field_156 is valid" do + let(:attributes) { field_155_attributes.merge({ field_156: 1 }) } + + it "does not add an error" do + parser.valid? + expect(parser.errors[:field_116]).to be_blank + expect(parser.errors[:field_154]).to be_blank + expect(parser.errors[:field_155]).to be_blank + expect(parser.errors[:field_156]).to be_blank + end + end + + context "and field_156 is invalid" do + let(:attributes) { field_155_attributes.merge({ field_156: 11 }) } # needs field_155 to be 7 + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + + context "and field_156 is blank" do + let(:attributes) { field_155_attributes.merge({ field_156: nil }) } + + it "adds errors to all referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_present + expect(parser.errors[:field_154]).to be_present + expect(parser.errors[:field_155]).to be_present + expect(parser.errors[:field_156]).to be_present + end + end + end + end end - end - context "when 4 ie referred by LA and is not general needs" do - let(:bulk_upload) { create(:bulk_upload, :lettings, user:) } - let(:attributes) { { bulk_upload:, field_116: "4", field_4: "2" } } + context "and is renewal" do + let(:attributes) { org_attributes.merge({ field_7: 1, field_116: 1, field_154: 5, field_155: 1, field_156: 1 }) } - it "is permitted" do - parser.valid? - expect(parser.errors[:field_116]).to be_blank + it "does not add an error for referral fields" do + parser.valid? + expect(parser.errors[:field_116]).to be_blank + expect(parser.errors[:field_154]).to be_blank + expect(parser.errors[:field_155]).to be_blank + expect(parser.errors[:field_156]).to be_blank + end end end end diff --git a/spec/services/csv/lettings_log_csv_service_spec.rb b/spec/services/csv/lettings_log_csv_service_spec.rb index f8a6fc438..e20d6212b 100644 --- a/spec/services/csv/lettings_log_csv_service_spec.rb +++ b/spec/services/csv/lettings_log_csv_service_spec.rb @@ -308,7 +308,9 @@ RSpec.describe Csv::LettingsLogCsvService do chr: 1, cap: 0, accessible_register: 0, - referral: 2, + referral_register: 1, + referral_noms: 1, + referral_org: 1, net_income_known: 0, incref: 0, incfreq: 1, diff --git a/spec/services/merge/merge_organisations_service_spec.rb b/spec/services/merge/merge_organisations_service_spec.rb index b5e04bbe7..d669b11a5 100644 --- a/spec/services/merge/merge_organisations_service_spec.rb +++ b/spec/services/merge/merge_organisations_service_spec.rb @@ -56,6 +56,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -100,6 +101,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -137,6 +139,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -557,6 +560,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -590,6 +594,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -652,6 +657,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -688,6 +694,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -877,6 +884,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -996,6 +1004,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1121,6 +1130,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(absorbing_organisation.id).and_return(absorbing_organisation) allow(absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1191,6 +1201,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1235,6 +1246,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1272,6 +1284,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1377,6 +1390,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1409,6 +1423,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1448,6 +1463,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1484,6 +1500,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1593,6 +1610,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1683,6 +1701,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid") @@ -1725,6 +1744,7 @@ RSpec.describe Merge::MergeOrganisationsService do it "rolls back if there's an error" do allow(Organisation).to receive(:find).with(merging_organisation_ids).and_return(Organisation.find(merging_organisation_ids)) + allow(Organisation).to receive(:find).with(merging_organisation.id).and_return(merging_organisation) allow(Organisation).to receive(:find).with(new_absorbing_organisation.id).and_return(new_absorbing_organisation) allow(new_absorbing_organisation).to receive(:save!).and_raise(ActiveRecord::RecordInvalid) expect(Rails.logger).to receive(:error).with("Organisation merge failed with: Record invalid")