From 8e803a8edfd1298239d1f69d6571a605271a1043 Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Tue, 24 Jan 2023 11:46:04 +0000 Subject: [PATCH] feat: purchase price range service and rake task --- app/models/la_purchase_price_range.rb | 2 + .../imports/purchase_price_ranges_service.rb | 31 + config/purchase_price_range_data/2022.csv | 1329 +++++++++++++++++ ...4111328_create_la_purchase_price_ranges.rb | 14 + db/schema.rb | 13 +- db/seeds.rb | 8 + lib/tasks/purchase_price_ranges.rake | 14 + 7 files changed, 1410 insertions(+), 1 deletion(-) create mode 100644 app/models/la_purchase_price_range.rb create mode 100644 app/services/imports/purchase_price_ranges_service.rb create mode 100644 config/purchase_price_range_data/2022.csv create mode 100644 db/migrate/20230124111328_create_la_purchase_price_ranges.rb create mode 100644 lib/tasks/purchase_price_ranges.rake diff --git a/app/models/la_purchase_price_range.rb b/app/models/la_purchase_price_range.rb new file mode 100644 index 000000000..2884a07a3 --- /dev/null +++ b/app/models/la_purchase_price_range.rb @@ -0,0 +1,2 @@ +class LaPurchasePriceRange < ApplicationRecord +end diff --git a/app/services/imports/purchase_price_ranges_service.rb b/app/services/imports/purchase_price_ranges_service.rb new file mode 100644 index 000000000..5c5756d4d --- /dev/null +++ b/app/services/imports/purchase_price_ranges_service.rb @@ -0,0 +1,31 @@ +require "csv" + +module Imports + class PurchasePriceRangesService + attr_reader :start_year, :path, :count + + def initialize(start_year:, path:) + @start_year = start_year + @path = path + @count = 0 + end + + def call + CSV.foreach(path, headers: true) do |row| + LaPurchasePriceRange.upsert( + { start_year:, + la: row["la"], + bedrooms: row["bedrooms"], + soft_min: row["soft_min"], + soft_max: row["soft_max"], }, + unique_by: %i[start_year bedrooms la], + ) + self.count = count + 1 + end + end + + private + + attr_writer :count + end +end diff --git a/config/purchase_price_range_data/2022.csv b/config/purchase_price_range_data/2022.csv new file mode 100644 index 000000000..d0b8d25a9 --- /dev/null +++ b/config/purchase_price_range_data/2022.csv @@ -0,0 +1,1329 @@ +la_name,la,bedrooms,soft_min,soft_max +Adur,E07000223,1,105000,369000 +Adur,E07000223,2,177000,384000 +Adur,E07000223,3,246000,539000 +Adur,E07000223,4,310000,860000 +Allerdale,E07000026,1,49000,232000 +Allerdale,E07000026,2,54000,232000 +Allerdale,E07000026,3,69000,270000 +Allerdale,E07000026,4,105000,463000 +Amber Valley,E07000032,1,74000,230000 +Amber Valley,E07000032,2,74000,230000 +Amber Valley,E07000032,3,90000,289000 +Amber Valley,E07000032,4,168000,631000 +Arun,E07000224,1,82000,397000 +Arun,E07000224,2,138000,397000 +Arun,E07000224,3,193000,458000 +Arun,E07000224,4,273000,822000 +Ashfield,E07000170,1,58000,189000 +Ashfield,E07000170,2,64000,189000 +Ashfield,E07000170,3,75000,229000 +Ashfield,E07000170,4,140000,401000 +Ashford,E07000105,1,68000,345000 +Ashford,E07000105,2,83000,345000 +Ashford,E07000105,3,184000,460000 +Ashford,E07000105,4,271000,917000 +Aylesbury Vale,E07000004,1,108000,370000 +Aylesbury Vale,E07000004,2,112000,370000 +Aylesbury Vale,E07000004,3,228000,501000 +Aylesbury Vale,E07000004,4,341000,940000 +Babergh,E07000200,1,74000,340000 +Babergh,E07000200,2,109000,340000 +Babergh,E07000200,3,175000,459000 +Babergh,E07000200,4,273000,971000 +Barking and Dagenham,E09000002,1,72000,344000 +Barking and Dagenham,E09000002,2,83000,352000 +Barking and Dagenham,E09000002,3,201000,450000 +Barking and Dagenham,E09000002,4,301000,577000 +Barnet,E09000003,1,114000,523000 +Barnet,E09000003,2,213000,621000 +Barnet,E09000003,3,373000,947000 +Barnet,E09000003,4,591000,2239000 +Barnsley,E08000016,1,53000,176000 +Barnsley,E08000016,2,53000,176000 +Barnsley,E08000016,3,67000,220000 +Barnsley,E08000016,4,124000,432000 +Barrow-in-Furness,E07000027,1,50000,157000 +Barrow-in-Furness,E07000027,2,52000,157000 +Barrow-in-Furness,E07000027,3,74000,256000 +Barrow-in-Furness,E07000027,4,100000,408000 +Basildon,E07000066,1,75000,375000 +Basildon,E07000066,2,105000,375000 +Basildon,E07000066,3,217000,463000 +Basildon,E07000066,4,299000,898000 +Basingstoke and Deane,E07000084,1,77000,347000 +Basingstoke and Deane,E07000084,2,108000,347000 +Basingstoke and Deane,E07000084,3,212000,464000 +Basingstoke and Deane,E07000084,4,309000,924000 +Bassetlaw,E07000171,1,65000,231000 +Bassetlaw,E07000171,2,65000,231000 +Bassetlaw,E07000171,3,77000,271000 +Bassetlaw,E07000171,4,139000,467000 +Bath and North East Somerset,E06000022,1,91000,452000 +Bath and North East Somerset,E06000022,2,112000,452000 +Bath and North East Somerset,E06000022,3,182000,584000 +Bath and North East Somerset,E06000022,4,280000,1217000 +Bedford,E06000055,1,76000,286000 +Bedford,E06000055,2,88000,286000 +Bedford,E06000055,3,158000,372000 +Bedford,E06000055,4,290000,788000 +Bexley,E09000004,1,102000,404000 +Bexley,E09000004,2,151000,404000 +Bexley,E09000004,3,280000,517000 +Bexley,E09000004,4,363000,853000 +Birmingham,E08000025,1,57000,271000 +Birmingham,E08000025,2,76000,271000 +Birmingham,E08000025,3,96000,336000 +Birmingham,E08000025,4,142000,757000 +Blaby,E07000129,1,81000,264000 +Blaby,E07000129,2,81000,264000 +Blaby,E07000129,3,136000,306000 +Blaby,E07000129,4,202000,539000 +Blackburn with Darwen,E06000008,1,48000,172000 +Blackburn with Darwen,E06000008,2,52000,172000 +Blackburn with Darwen,E06000008,3,66000,229000 +Blackburn with Darwen,E06000008,4,110000,458000 +Blackpool,E06000009,1,29000,158000 +Blackpool,E06000009,2,58000,158000 +Blackpool,E06000009,3,72000,196000 +Blackpool,E06000009,4,84000,316000 +Bolsover,E07000033,1,56000,163000 +Bolsover,E07000033,2,59000,163000 +Bolsover,E07000033,3,60000,212000 +Bolsover,E07000033,4,126000,432000 +Bolton,E08000001,1,56000,193000 +Bolton,E08000001,2,59000,193000 +Bolton,E08000001,3,73000,258000 +Bolton,E08000001,4,125000,557000 +Boston,E07000136,1,39000,190000 +Boston,E07000136,2,39000,190000 +Boston,E07000136,3,73000,233000 +Boston,E07000136,4,152000,387000 +Bournemouth,E06000028,1,97000,318000 +Bournemouth,E06000028,2,135000,318000 +Bournemouth,E06000028,3,189000,450000 +Bournemouth,E06000028,4,272000,783000 +"Bournemouth, Christchurch and Poole",E06000058,1,105000,385000 +"Bournemouth, Christchurch and Poole",E06000058,2,153000,386000 +"Bournemouth, Christchurch and Poole",E06000058,3,227000,526000 +"Bournemouth, Christchurch and Poole",E06000058,4,286000,1117000 +Bracknell Forest,E06000036,1,79000,403000 +Bracknell Forest,E06000036,2,124000,403000 +Bracknell Forest,E06000036,3,269000,525000 +Bracknell Forest,E06000036,4,333000,950000 +Bradford,E08000032,1,47000,218000 +Bradford,E08000032,2,57000,218000 +Bradford,E08000032,3,71000,280000 +Bradford,E08000032,4,92000,606000 +Braintree,E07000067,1,101000,333000 +Braintree,E07000067,2,117000,333000 +Braintree,E07000067,3,215000,433000 +Braintree,E07000067,4,292000,922000 +Breckland,E07000143,1,80000,253000 +Breckland,E07000143,2,98000,253000 +Breckland,E07000143,3,135000,335000 +Breckland,E07000143,4,210000,645000 +Brent,E09000005,1,94000,548000 +Brent,E09000005,2,128000,705000 +Brent,E09000005,3,344000,1122000 +Brent,E09000005,4,499000,2304000 +Brentwood,E07000068,1,117000,430000 +Brentwood,E07000068,2,203000,532000 +Brentwood,E07000068,3,319000,744000 +Brentwood,E07000068,4,418000,1589000 +Brighton and Hove,E06000043,1,146000,444000 +Brighton and Hove,E06000043,2,220000,483000 +Brighton and Hove,E06000043,3,280000,668000 +Brighton and Hove,E06000043,4,366000,1264000 +"Bristol, City of",E06000023,1,107000,313000 +"Bristol, City of",E06000023,2,132000,420000 +"Bristol, City of",E06000023,3,175000,520000 +"Bristol, City of",E06000023,4,244000,1079000 +Broadland,E07000144,1,97000,270000 +Broadland,E07000144,2,102000,270000 +Broadland,E07000144,3,177000,353000 +Broadland,E07000144,4,239000,638000 +Bromley,E09000006,1,172000,492000 +Bromley,E09000006,2,238000,553000 +Bromley,E09000006,3,312000,728000 +Bromley,E09000006,4,442000,1411000 +Bromsgrove,E07000234,1,85000,354000 +Bromsgrove,E07000234,2,89000,354000 +Bromsgrove,E07000234,3,139000,417000 +Bromsgrove,E07000234,4,254000,829000 +Broxbourne,E07000095,1,152000,406000 +Broxbourne,E07000095,2,200000,406000 +Broxbourne,E07000095,3,294000,541000 +Broxbourne,E07000095,4,388000,1152000 +Broxtowe,E07000172,1,69000,217000 +Broxtowe,E07000172,2,79000,217000 +Broxtowe,E07000172,3,109000,292000 +Broxtowe,E07000172,4,169000,541000 +Buckinghamshire,E06000060,1,130000,588000 +Buckinghamshire,E06000060,2,139000,588000 +Buckinghamshire,E06000060,3,239000,714000 +Buckinghamshire,E06000060,4,389000,1703000 +Burnley,E07000117,1,42000,160000 +Burnley,E07000117,2,44000,160000 +Burnley,E07000117,3,60000,215000 +Burnley,E07000117,4,109000,366000 +Bury,E08000002,1,57000,236000 +Bury,E08000002,2,69000,236000 +Bury,E08000002,3,95000,295000 +Bury,E08000002,4,161000,580000 +Calderdale,E08000033,1,52000,207000 +Calderdale,E08000033,2,59000,207000 +Calderdale,E08000033,3,73000,291000 +Calderdale,E08000033,4,120000,561000 +Cambridge,E07000008,1,121000,534000 +Cambridge,E07000008,2,139000,538000 +Cambridge,E07000008,3,268000,685000 +Cambridge,E07000008,4,418000,1572000 +Camden,E09000007,1,243000,746000 +Camden,E09000007,2,382000,1311000 +Camden,E09000007,3,497000,2233000 +Camden,E09000007,4,915000,5132000 +Cannock Chase,E07000192,1,53000,190000 +Cannock Chase,E07000192,2,79000,190000 +Cannock Chase,E07000192,3,105000,252000 +Cannock Chase,E07000192,4,168000,402000 +Canterbury,E07000106,1,70000,362000 +Canterbury,E07000106,2,126000,362000 +Canterbury,E07000106,3,189000,477000 +Canterbury,E07000106,4,288000,870000 +Carlisle,E07000028,1,48000,180000 +Carlisle,E07000028,2,63000,180000 +Carlisle,E07000028,3,75000,248000 +Carlisle,E07000028,4,128000,418000 +Castle Point,E07000069,1,132000,368000 +Castle Point,E07000069,2,177000,368000 +Castle Point,E07000069,3,223000,432000 +Castle Point,E07000069,4,299000,779000 +Central Bedfordshire,E06000056,1,88000,329000 +Central Bedfordshire,E06000056,2,100000,329000 +Central Bedfordshire,E06000056,3,193000,433000 +Central Bedfordshire,E06000056,4,312000,784000 +Charnwood,E07000130,1,72000,250000 +Charnwood,E07000130,2,72000,250000 +Charnwood,E07000130,3,116000,309000 +Charnwood,E07000130,4,206000,597000 +Chelmsford,E07000070,1,75000,405000 +Chelmsford,E07000070,2,106000,405000 +Chelmsford,E07000070,3,261000,548000 +Chelmsford,E07000070,4,359000,979000 +Cheltenham,E07000078,1,85000,375000 +Cheltenham,E07000078,2,126000,375000 +Cheltenham,E07000078,3,168000,493000 +Cheltenham,E07000078,4,251000,979000 +Cherwell,E07000177,1,90000,345000 +Cherwell,E07000177,2,90000,345000 +Cherwell,E07000177,3,182000,445000 +Cherwell,E07000177,4,285000,819000 +Cheshire East,E06000049,1,64000,329000 +Cheshire East,E06000049,2,71000,329000 +Cheshire East,E06000049,3,98000,420000 +Cheshire East,E06000049,4,207000,885000 +Cheshire West and Chester,E06000050,1,59000,275000 +Cheshire West and Chester,E06000050,2,67000,275000 +Cheshire West and Chester,E06000050,3,89000,341000 +Cheshire West and Chester,E06000050,4,176000,716000 +Chesterfield,E07000034,1,54000,188000 +Chesterfield,E07000034,2,70000,188000 +Chesterfield,E07000034,3,81000,264000 +Chesterfield,E07000034,4,142000,480000 +Chichester,E07000225,1,79000,475000 +Chichester,E07000225,2,89000,475000 +Chichester,E07000225,3,221000,626000 +Chichester,E07000225,4,333000,1721000 +Chiltern,E07000005,1,170000,646000 +Chiltern,E07000005,2,227000,646000 +Chiltern,E07000005,3,333000,821000 +Chiltern,E07000005,4,461000,1850000 +Chorley,E07000118,1,54000,231000 +Chorley,E07000118,2,71000,231000 +Chorley,E07000118,3,87000,301000 +Chorley,E07000118,4,166000,550000 +Christchurch,E07000048,1,115000,425000 +Christchurch,E07000048,2,149000,425000 +Christchurch,E07000048,3,225000,510000 +Christchurch,E07000048,4,321000,814000 +City of London,E09000001,1,418000,917000 +City of London,E09000001,2,600000,2303000 +City of London,E09000001,3,1576000,4833000 +City of London,E09000001,4,1707000,2116000 +Colchester,E07000071,1,88000,307000 +Colchester,E07000071,2,130000,307000 +Colchester,E07000071,3,202000,400000 +Colchester,E07000071,4,289000,773000 +Copeland,E07000029,1,48000,182000 +Copeland,E07000029,2,53000,182000 +Copeland,E07000029,3,63000,238000 +Copeland,E07000029,4,102000,395000 +Corby,E07000150,1,63000,215000 +Corby,E07000150,2,70000,215000 +Corby,E07000150,3,108000,255000 +Corby,E07000150,4,166000,433000 +Cornwall,E06000052,1,74000,314000 +Cornwall,E06000052,2,75000,314000 +Cornwall,E06000052,3,116000,399000 +Cornwall,E06000052,4,186000,692000 +Cotswold,E07000079,1,54000,480000 +Cotswold,E07000079,2,83000,480000 +Cotswold,E07000079,3,130000,608000 +Cotswold,E07000079,4,305000,1271000 +County Durham,E06000047,1,42000,178000 +County Durham,E06000047,2,42000,178000 +County Durham,E06000047,3,55000,227000 +County Durham,E06000047,4,116000,470000 +Coventry,E08000026,1,61000,202000 +Coventry,E08000026,2,80000,202000 +Coventry,E08000026,3,116000,292000 +Coventry,E08000026,4,168000,598000 +Craven,E07000163,1,75000,305000 +Craven,E07000163,2,80000,305000 +Craven,E07000163,3,122000,377000 +Craven,E07000163,4,169000,701000 +Crawley,E07000226,1,122000,330000 +Crawley,E07000226,2,178000,330000 +Crawley,E07000226,3,249000,423000 +Crawley,E07000226,4,309000,627000 +Croydon,E09000008,1,100000,395000 +Croydon,E09000008,2,153000,490000 +Croydon,E09000008,3,299000,612000 +Croydon,E09000008,4,403000,1068000 +Dacorum,E07000096,1,141000,495000 +Dacorum,E07000096,2,184000,495000 +Dacorum,E07000096,3,282000,667000 +Dacorum,E07000096,4,378000,1492000 +Darlington,E06000005,1,43000,183000 +Darlington,E06000005,2,51000,183000 +Darlington,E06000005,3,68000,238000 +Darlington,E06000005,4,139000,469000 +Dartford,E07000107,1,91000,349000 +Dartford,E07000107,2,91000,351000 +Dartford,E07000107,3,243000,473000 +Dartford,E07000107,4,338000,760000 +Daventry,E07000151,1,42000,313000 +Daventry,E07000151,2,67000,313000 +Daventry,E07000151,3,120000,366000 +Daventry,E07000151,4,237000,745000 +Derby,E06000015,1,48000,194000 +Derby,E06000015,2,66000,194000 +Derby,E06000015,3,82000,260000 +Derby,E06000015,4,169000,486000 +Derbyshire Dales,E07000035,1,64000,352000 +Derbyshire Dales,E07000035,2,66000,352000 +Derbyshire Dales,E07000035,3,125000,423000 +Derbyshire Dales,E07000035,4,217000,740000 +Doncaster,E08000017,1,58000,185000 +Doncaster,E08000017,2,58000,185000 +Doncaster,E08000017,3,68000,218000 +Doncaster,E08000017,4,122000,445000 +Dorset,E06000059,1,74000,349000 +Dorset,E06000059,2,109000,349000 +Dorset,E06000059,3,156000,484000 +Dorset,E06000059,4,259000,893000 +Dover,E07000108,1,83000,316000 +Dover,E07000108,2,94000,316000 +Dover,E07000108,3,150000,414000 +Dover,E07000108,4,206000,767000 +Dudley,E08000027,1,53000,216000 +Dudley,E08000027,2,74000,216000 +Dudley,E08000027,3,99000,278000 +Dudley,E08000027,4,152000,471000 +Ealing,E09000009,1,111000,520000 +Ealing,E09000009,2,168000,680000 +Ealing,E09000009,3,297000,968000 +Ealing,E09000009,4,463000,1976000 +East Cambridgeshire,E07000009,1,100000,310000 +East Cambridgeshire,E07000009,2,101000,310000 +East Cambridgeshire,E07000009,3,181000,405000 +East Cambridgeshire,E07000009,4,263000,737000 +East Devon,E07000040,1,67000,340000 +East Devon,E07000040,2,84000,340000 +East Devon,E07000040,3,123000,454000 +East Devon,E07000040,4,240000,839000 +East Dorset,E07000049,1,131000,423000 +East Dorset,E07000049,2,158000,423000 +East Dorset,E07000049,3,229000,516000 +East Dorset,E07000049,4,316000,841000 +East Hampshire,E07000085,1,89000,456000 +East Hampshire,E07000085,2,120000,456000 +East Hampshire,E07000085,3,224000,594000 +East Hampshire,E07000085,4,339000,1201000 +East Hertfordshire,E07000242,1,100000,467000 +East Hertfordshire,E07000242,2,136000,467000 +East Hertfordshire,E07000242,3,277000,654000 +East Hertfordshire,E07000242,4,410000,1265000 +East Lindsey,E07000137,1,52000,236000 +East Lindsey,E07000137,2,58000,236000 +East Lindsey,E07000137,3,81000,276000 +East Lindsey,E07000137,4,136000,536000 +East Northamptonshire,E07000152,1,69000,262000 +East Northamptonshire,E07000152,2,71000,262000 +East Northamptonshire,E07000152,3,133000,328000 +East Northamptonshire,E07000152,4,215000,692000 +East Riding of Yorkshire,E06000011,1,59000,241000 +East Riding of Yorkshire,E06000011,2,74000,241000 +East Riding of Yorkshire,E06000011,3,98000,292000 +East Riding of Yorkshire,E06000011,4,150000,562000 +East Staffordshire,E07000193,1,59000,241000 +East Staffordshire,E07000193,2,73000,241000 +East Staffordshire,E07000193,3,92000,289000 +East Staffordshire,E07000193,4,175000,568000 +East Suffolk,E07000244,1,75000,330000 +East Suffolk,E07000244,2,99000,330000 +East Suffolk,E07000244,3,125000,415000 +East Suffolk,E07000244,4,209000,869000 +Eastbourne,E07000061,1,95000,291000 +Eastbourne,E07000061,2,135000,300000 +Eastbourne,E07000061,3,188000,404000 +Eastbourne,E07000061,4,254000,704000 +Eastleigh,E07000086,1,88000,319000 +Eastleigh,E07000086,2,89000,319000 +Eastleigh,E07000086,3,133000,409000 +Eastleigh,E07000086,4,289000,739000 +Eden,E07000030,1,55000,265000 +Eden,E07000030,2,70000,265000 +Eden,E07000030,3,96000,331000 +Eden,E07000030,4,159000,588000 +Elmbridge,E07000207,1,115000,666000 +Elmbridge,E07000207,2,205000,666000 +Elmbridge,E07000207,3,366000,944000 +Elmbridge,E07000207,4,552000,2294000 +Enfield,E09000010,1,119000,470000 +Enfield,E09000010,2,157000,533000 +Enfield,E09000010,3,302000,770000 +Enfield,E09000010,4,438000,1549000 +Epping Forest,E07000072,1,108000,565000 +Epping Forest,E07000072,2,200000,565000 +Epping Forest,E07000072,3,311000,740000 +Epping Forest,E07000072,4,436000,1665000 +Epsom and Ewell,E07000208,1,179000,544000 +Epsom and Ewell,E07000208,2,245000,544000 +Epsom and Ewell,E07000208,3,345000,749000 +Epsom and Ewell,E07000208,4,491000,1273000 +Erewash,E07000036,1,62000,201000 +Erewash,E07000036,2,73000,201000 +Erewash,E07000036,3,98000,271000 +Erewash,E07000036,4,151000,525000 +Exeter,E07000041,1,79000,296000 +Exeter,E07000041,2,97000,296000 +Exeter,E07000041,3,163000,373000 +Exeter,E07000041,4,242000,757000 +Fareham,E07000087,1,99000,337000 +Fareham,E07000087,2,145000,337000 +Fareham,E07000087,3,208000,425000 +Fareham,E07000087,4,286000,761000 +Fenland,E07000010,1,70000,214000 +Fenland,E07000010,2,96000,214000 +Fenland,E07000010,3,124000,285000 +Fenland,E07000010,4,184000,501000 +Folkestone and Hythe,E07000112,1,82000,332000 +Folkestone and Hythe,E07000112,2,92000,332000 +Folkestone and Hythe,E07000112,3,166000,454000 +Folkestone and Hythe,E07000112,4,226000,771000 +Forest Heath,E07000201,1,61000,247000 +Forest Heath,E07000201,2,110000,247000 +Forest Heath,E07000201,3,125000,323000 +Forest Heath,E07000201,4,198000,548000 +Forest of Dean,E07000080,1,74000,325000 +Forest of Dean,E07000080,2,91000,325000 +Forest of Dean,E07000080,3,127000,393000 +Forest of Dean,E07000080,4,197000,693000 +Fylde,E07000119,1,56000,344000 +Fylde,E07000119,2,79000,293000 +Fylde,E07000119,3,81000,293000 +Fylde,E07000119,4,169000,555000 +Gateshead,E08000037,1,45000,172000 +Gateshead,E08000037,2,52000,172000 +Gateshead,E08000037,3,70000,255000 +Gateshead,E08000037,4,116000,469000 +Gedling,E07000173,1,57000,222000 +Gedling,E07000173,2,75000,222000 +Gedling,E07000173,3,109000,285000 +Gedling,E07000173,4,169000,517000 +Gloucester,E07000081,1,52000,228000 +Gloucester,E07000081,2,85000,228000 +Gloucester,E07000081,3,125000,301000 +Gloucester,E07000081,4,205000,465000 +Gosport,E07000088,1,78000,298000 +Gosport,E07000088,2,109000,299000 +Gosport,E07000088,3,160000,349000 +Gosport,E07000088,4,218000,643000 +Gravesham,E07000109,1,69000,357000 +Gravesham,E07000109,2,99000,357000 +Gravesham,E07000109,3,207000,442000 +Gravesham,E07000109,4,279000,916000 +Great Yarmouth,E07000145,1,70000,220000 +Great Yarmouth,E07000145,2,79000,220000 +Great Yarmouth,E07000145,3,95000,275000 +Great Yarmouth,E07000145,4,146000,481000 +Greenwich,E09000011,1,100000,540000 +Greenwich,E09000011,2,142000,631000 +Greenwich,E09000011,3,249000,792000 +Greenwich,E09000011,4,373000,1668000 +Guildford,E07000209,1,99000,546000 +Guildford,E07000209,2,183000,581000 +Guildford,E07000209,3,303000,791000 +Guildford,E07000209,4,420000,1789000 +Hackney,E09000012,1,165000,612000 +Hackney,E09000012,2,209000,848000 +Hackney,E09000012,3,374000,1280000 +Hackney,E09000012,4,662000,1933000 +Halton,E06000006,1,53000,190000 +Halton,E06000006,2,61000,190000 +Halton,E06000006,3,73000,237000 +Halton,E06000006,4,121000,441000 +Hambleton,E07000164,1,73000,267000 +Hambleton,E07000164,2,88000,267000 +Hambleton,E07000164,3,122000,351000 +Hambleton,E07000164,4,193000,680000 +Hammersmith and Fulham,E09000013,1,178000,697000 +Hammersmith and Fulham,E09000013,2,295000,1054000 +Hammersmith and Fulham,E09000013,3,328000,1657000 +Hammersmith and Fulham,E09000013,4,918000,3040000 +Harborough,E07000131,1,54000,319000 +Harborough,E07000131,2,54000,319000 +Harborough,E07000131,3,119000,384000 +Harborough,E07000131,4,250000,766000 +Haringey,E09000014,1,158000,520000 +Haringey,E09000014,2,240000,753000 +Haringey,E09000014,3,364000,1141000 +Haringey,E09000014,4,549000,2471000 +Harlow,E07000073,1,103000,328000 +Harlow,E07000073,2,130000,337000 +Harlow,E07000073,3,216000,436000 +Harlow,E07000073,4,299000,707000 +Harrogate,E07000165,1,76000,341000 +Harrogate,E07000165,2,89000,341000 +Harrogate,E07000165,3,145000,444000 +Harrogate,E07000165,4,244000,939000 +Harrow,E09000015,1,109000,480000 +Harrow,E09000015,2,257000,549000 +Harrow,E09000015,3,373000,746000 +Harrow,E09000015,4,496000,1414000 +Hart,E07000089,1,85000,446000 +Hart,E07000089,2,116000,446000 +Hart,E07000089,3,267000,567000 +Hart,E07000089,4,406000,1193000 +Hartlepool,E06000001,1,41000,186000 +Hartlepool,E06000001,2,41000,186000 +Hartlepool,E06000001,3,59000,197000 +Hartlepool,E06000001,4,101000,465000 +Hastings,E07000062,1,83000,280000 +Hastings,E07000062,2,125000,304000 +Hastings,E07000062,3,168000,352000 +Hastings,E07000062,4,223000,621000 +Havant,E07000090,1,80000,334000 +Havant,E07000090,2,114000,334000 +Havant,E07000090,3,178000,405000 +Havant,E07000090,4,248000,698000 +Havering,E09000016,1,111000,418000 +Havering,E09000016,2,155000,437000 +Havering,E09000016,3,300000,588000 +Havering,E09000016,4,370000,1048000 +"Herefordshire, County of",E06000019,1,73000,307000 +"Herefordshire, County of",E06000019,2,73000,307000 +"Herefordshire, County of",E06000019,3,121000,373000 +"Herefordshire, County of",E06000019,4,204000,672000 +Hertsmere,E07000098,1,157000,540000 +Hertsmere,E07000098,2,240000,540000 +Hertsmere,E07000098,3,354000,757000 +Hertsmere,E07000098,4,468000,1817000 +High Peak,E07000037,1,74000,247000 +High Peak,E07000037,2,94000,247000 +High Peak,E07000037,3,113000,352000 +High Peak,E07000037,4,181000,619000 +Hillingdon,E09000017,1,111000,441000 +Hillingdon,E09000017,2,196000,525000 +Hillingdon,E09000017,3,354000,693000 +Hillingdon,E09000017,4,441000,1280000 +Hinckley and Bosworth,E07000132,1,64000,246000 +Hinckley and Bosworth,E07000132,2,74000,246000 +Hinckley and Bosworth,E07000132,3,109000,315000 +Hinckley and Bosworth,E07000132,4,197000,629000 +Horsham,E07000227,1,73000,433000 +Horsham,E07000227,2,98000,433000 +Horsham,E07000227,3,238000,599000 +Horsham,E07000227,4,391000,1193000 +Hounslow,E09000018,1,96000,507000 +Hounslow,E09000018,2,133000,635000 +Hounslow,E09000018,3,297000,896000 +Hounslow,E09000018,4,419000,2465000 +Huntingdonshire,E07000011,1,70000,308000 +Huntingdonshire,E07000011,2,84000,308000 +Huntingdonshire,E07000011,3,159000,380000 +Huntingdonshire,E07000011,4,251000,668000 +Hyndburn,E07000120,1,48000,166000 +Hyndburn,E07000120,2,48000,166000 +Hyndburn,E07000120,3,62000,216000 +Hyndburn,E07000120,4,116000,391000 +Ipswich,E07000202,1,82000,247000 +Ipswich,E07000202,2,102000,247000 +Ipswich,E07000202,3,144000,319000 +Ipswich,E07000202,4,204000,682000 +Isle of Wight,E06000046,1,78000,283000 +Isle of Wight,E06000046,2,100000,283000 +Isle of Wight,E06000046,3,146000,368000 +Isle of Wight,E06000046,4,197000,701000 +Islington,E09000019,1,171000,672000 +Islington,E09000019,2,291000,1068000 +Islington,E09000019,3,430000,1690000 +Islington,E09000019,4,676000,2918000 +Kensington and Chelsea,E09000020,1,223000,1101000 +Kensington and Chelsea,E09000020,2,538000,2079000 +Kensington and Chelsea,E09000020,3,677000,4300000 +Kensington and Chelsea,E09000020,4,1182000,10727000 +Kettering,E07000153,1,67000,223000 +Kettering,E07000153,2,67000,223000 +Kettering,E07000153,3,119000,292000 +Kettering,E07000153,4,200000,564000 +King's Lynn and West Norfolk,E07000146,1,60000,276000 +King's Lynn and West Norfolk,E07000146,2,96000,276000 +King's Lynn and West Norfolk,E07000146,3,128000,327000 +King's Lynn and West Norfolk,E07000146,4,193000,622000 +"Kingston upon Hull, City of",E06000010,1,46000,142000 +"Kingston upon Hull, City of",E06000010,2,50000,142000 +"Kingston upon Hull, City of",E06000010,3,62000,194000 +"Kingston upon Hull, City of",E06000010,4,81000,301000 +Kingston upon Thames,E09000021,1,126000,534000 +Kingston upon Thames,E09000021,2,281000,635000 +Kingston upon Thames,E09000021,3,360000,853000 +Kingston upon Thames,E09000021,4,482000,1761000 +Kirklees,E08000034,1,51000,193000 +Kirklees,E08000034,2,60000,193000 +Kirklees,E08000034,3,84000,273000 +Kirklees,E08000034,4,144000,555000 +Knowsley,E08000011,1,53000,169000 +Knowsley,E08000011,2,53000,169000 +Knowsley,E08000011,3,66000,227000 +Knowsley,E08000011,4,96000,354000 +Lambeth,E09000022,1,137000,579000 +Lambeth,E09000022,2,221000,754000 +Lambeth,E09000022,3,359000,1129000 +Lambeth,E09000022,4,532000,1917000 +Lancaster,E07000121,1,56000,233000 +Lancaster,E07000121,2,70000,233000 +Lancaster,E07000121,3,91000,281000 +Lancaster,E07000121,4,105000,514000 +Leeds,E08000035,1,61000,244000 +Leeds,E08000035,2,72000,244000 +Leeds,E08000035,3,92000,331000 +Leeds,E08000035,4,133000,674000 +Leicester,E06000016,1,35000,213000 +Leicester,E06000016,2,59000,213000 +Leicester,E06000016,3,78000,273000 +Leicester,E06000016,4,172000,532000 +Lewes,E07000063,1,98000,416000 +Lewes,E07000063,2,141000,416000 +Lewes,E07000063,3,205000,579000 +Lewes,E07000063,4,292000,1161000 +Lewisham,E09000023,1,153000,451000 +Lewisham,E09000023,2,213000,597000 +Lewisham,E09000023,3,316000,790000 +Lewisham,E09000023,4,451000,1415000 +Lichfield,E07000194,1,75000,315000 +Lichfield,E07000194,2,75000,315000 +Lichfield,E07000194,3,131000,414000 +Lichfield,E07000194,4,213000,763000 +Lincoln,E07000138,1,31000,188000 +Lincoln,E07000138,2,61000,188000 +Lincoln,E07000138,3,93000,258000 +Lincoln,E07000138,4,141000,421000 +Liverpool,E08000012,1,56000,227000 +Liverpool,E08000012,2,56000,234000 +Liverpool,E08000012,3,68000,280000 +Liverpool,E08000012,4,96000,575000 +Luton,E06000032,1,89000,279000 +Luton,E06000032,2,121000,279000 +Luton,E06000032,3,201000,376000 +Luton,E06000032,4,245000,600000 +Maidstone,E07000110,1,60000,363000 +Maidstone,E07000110,2,96000,363000 +Maidstone,E07000110,3,161000,470000 +Maidstone,E07000110,4,322000,895000 +Maldon,E07000074,1,70000,421000 +Maldon,E07000074,2,98000,421000 +Maldon,E07000074,3,229000,475000 +Maldon,E07000074,4,319000,1063000 +Malvern Hills,E07000235,1,76000,332000 +Malvern Hills,E07000235,2,76000,332000 +Malvern Hills,E07000235,3,120000,432000 +Malvern Hills,E07000235,4,234000,740000 +Manchester,E08000003,1,75000,268000 +Manchester,E08000003,2,76000,328000 +Manchester,E08000003,3,79000,381000 +Manchester,E08000003,4,123000,785000 +Mansfield,E07000174,1,54000,182000 +Mansfield,E07000174,2,59000,182000 +Mansfield,E07000174,3,73000,233000 +Mansfield,E07000174,4,134000,422000 +Medway,E06000035,1,51000,300000 +Medway,E06000035,2,108000,300000 +Medway,E06000035,3,176000,388000 +Medway,E06000035,4,244000,639000 +Melton,E07000133,1,52000,267000 +Melton,E07000133,2,52000,267000 +Melton,E07000133,3,117000,365000 +Melton,E07000133,4,196000,745000 +Mendip,E07000187,1,81000,325000 +Mendip,E07000187,2,82000,325000 +Mendip,E07000187,3,161000,400000 +Mendip,E07000187,4,230000,885000 +Merton,E09000024,1,169000,617000 +Merton,E09000024,2,208000,701000 +Merton,E09000024,3,326000,915000 +Merton,E09000024,4,462000,2637000 +Mid Devon,E07000042,1,78000,307000 +Mid Devon,E07000042,2,85000,307000 +Mid Devon,E07000042,3,138000,387000 +Mid Devon,E07000042,4,213000,725000 +Mid Suffolk,E07000203,1,88000,324000 +Mid Suffolk,E07000203,2,98000,324000 +Mid Suffolk,E07000203,3,174000,416000 +Mid Suffolk,E07000203,4,253000,731000 +Mid Sussex,E07000228,1,136000,435000 +Mid Sussex,E07000228,2,159000,435000 +Mid Sussex,E07000228,3,274000,564000 +Mid Sussex,E07000228,4,376000,1138000 +Middlesbrough,E06000002,1,44000,165000 +Middlesbrough,E06000002,2,49000,165000 +Middlesbrough,E06000002,3,61000,209000 +Middlesbrough,E06000002,4,139000,411000 +Milton Keynes,E06000042,1,52000,302000 +Milton Keynes,E06000042,2,74000,302000 +Milton Keynes,E06000042,3,157000,396000 +Milton Keynes,E06000042,4,283000,741000 +Mole Valley,E07000210,1,128000,577000 +Mole Valley,E07000210,2,180000,577000 +Mole Valley,E07000210,3,338000,787000 +Mole Valley,E07000210,4,480000,1547000 +New Forest,E07000091,1,100000,437000 +New Forest,E07000091,2,148000,437000 +New Forest,E07000091,3,214000,600000 +New Forest,E07000091,4,302000,1173000 +Newark and Sherwood,E07000175,1,62000,260000 +Newark and Sherwood,E07000175,2,62000,260000 +Newark and Sherwood,E07000175,3,83000,298000 +Newark and Sherwood,E07000175,4,158000,636000 +Newcastle-under-Lyme,E07000195,1,67000,183000 +Newcastle-under-Lyme,E07000195,2,67000,183000 +Newcastle-under-Lyme,E07000195,3,87000,261000 +Newcastle-under-Lyme,E07000195,4,154000,521000 +Newcastle upon Tyne,E08000021,1,43000,223000 +Newcastle upon Tyne,E08000021,2,54000,223000 +Newcastle upon Tyne,E08000021,3,67000,293000 +Newcastle upon Tyne,E08000021,4,137000,670000 +Newham,E09000025,1,97000,454000 +Newham,E09000025,2,130000,600000 +Newham,E09000025,3,212000,695000 +Newham,E09000025,4,351000,982000 +North Devon,E07000043,1,69000,311000 +North Devon,E07000043,2,80000,311000 +North Devon,E07000043,3,133000,372000 +North Devon,E07000043,4,183000,615000 +North Dorset,E07000050,1,79000,259000 +North Dorset,E07000050,2,114000,303000 +North Dorset,E07000050,3,177000,392000 +North Dorset,E07000050,4,229000,773000 +North East Derbyshire,E07000038,1,55000,233000 +North East Derbyshire,E07000038,2,57000,233000 +North East Derbyshire,E07000038,3,83000,322000 +North East Derbyshire,E07000038,4,164000,641000 +North East Lincolnshire,E06000012,1,39000,179000 +North East Lincolnshire,E06000012,2,50000,179000 +North East Lincolnshire,E06000012,3,64000,210000 +North East Lincolnshire,E06000012,4,122000,433000 +North Hertfordshire,E07000099,1,86000,421000 +North Hertfordshire,E07000099,2,127000,425000 +North Hertfordshire,E07000099,3,256000,606000 +North Hertfordshire,E07000099,4,358000,1248000 +North Kesteven,E07000139,1,56000,247000 +North Kesteven,E07000139,2,56000,247000 +North Kesteven,E07000139,3,95000,283000 +North Kesteven,E07000139,4,175000,498000 +North Lincolnshire,E06000013,1,50000,212000 +North Lincolnshire,E06000013,2,61000,212000 +North Lincolnshire,E06000013,3,74000,231000 +North Lincolnshire,E06000013,4,130000,421000 +North Norfolk,E07000147,1,85000,345000 +North Norfolk,E07000147,2,103000,345000 +North Norfolk,E07000147,3,134000,417000 +North Norfolk,E07000147,4,200000,834000 +North Somerset,E06000024,1,79000,324000 +North Somerset,E06000024,2,109000,324000 +North Somerset,E06000024,3,165000,433000 +North Somerset,E06000024,4,228000,814000 +North Tyneside,E08000022,1,55000,207000 +North Tyneside,E08000022,2,55000,207000 +North Tyneside,E08000022,3,73000,286000 +North Tyneside,E08000022,4,155000,486000 +North Warwickshire,E07000218,1,77000,266000 +North Warwickshire,E07000218,2,77000,266000 +North Warwickshire,E07000218,3,108000,333000 +North Warwickshire,E07000218,4,190000,703000 +North West Leicestershire,E07000134,1,68000,225000 +North West Leicestershire,E07000134,2,68000,225000 +North West Leicestershire,E07000134,3,95000,298000 +North West Leicestershire,E07000134,4,191000,540000 +Northampton,E07000154,1,42000,221000 +Northampton,E07000154,2,72000,221000 +Northampton,E07000154,3,131000,302000 +Northampton,E07000154,4,204000,558000 +Northumberland,E06000057,1,47000,252000 +Northumberland,E06000057,2,50000,252000 +Northumberland,E06000057,3,71000,283000 +Northumberland,E06000057,4,145000,611000 +Norwich,E07000148,1,69000,212000 +Norwich,E07000148,2,69000,275000 +Norwich,E07000148,3,119000,381000 +Norwich,E07000148,4,187000,814000 +Nottingham,E06000018,1,45000,224000 +Nottingham,E06000018,2,58000,224000 +Nottingham,E06000018,3,64000,260000 +Nottingham,E06000018,4,122000,587000 +Nuneaton and Bedworth,E07000219,1,62000,209000 +Nuneaton and Bedworth,E07000219,2,71000,209000 +Nuneaton and Bedworth,E07000219,3,99000,268000 +Nuneaton and Bedworth,E07000219,4,172000,465000 +Oadby and Wigston,E07000135,1,77000,229000 +Oadby and Wigston,E07000135,2,95000,229000 +Oadby and Wigston,E07000135,3,137000,311000 +Oadby and Wigston,E07000135,4,210000,666000 +Oldham,E08000004,1,59000,197000 +Oldham,E08000004,2,59000,197000 +Oldham,E08000004,3,76000,270000 +Oldham,E08000004,4,119000,541000 +Oxford,E07000178,1,101000,554000 +Oxford,E07000178,2,162000,554000 +Oxford,E07000178,3,260000,652000 +Oxford,E07000178,4,352000,1845000 +Pendle,E07000122,1,43000,189000 +Pendle,E07000122,2,43000,189000 +Pendle,E07000122,3,59000,270000 +Pendle,E07000122,4,107000,496000 +Peterborough,E06000031,1,60000,226000 +Peterborough,E06000031,2,70000,226000 +Peterborough,E06000031,3,114000,273000 +Peterborough,E06000031,4,176000,554000 +Plymouth,E06000026,1,64000,234000 +Plymouth,E06000026,2,70000,234000 +Plymouth,E06000026,3,111000,282000 +Plymouth,E06000026,4,162000,484000 +Poole,E06000029,1,105000,338000 +Poole,E06000029,2,148000,366000 +Poole,E06000029,3,205000,473000 +Poole,E06000029,4,254000,1292000 +Portsmouth,E06000044,1,82000,273000 +Portsmouth,E06000044,2,113000,273000 +Portsmouth,E06000044,3,160000,361000 +Portsmouth,E06000044,4,221000,725000 +Preston,E07000123,1,32000,187000 +Preston,E07000123,2,55000,187000 +Preston,E07000123,3,74000,240000 +Preston,E07000123,4,139000,477000 +Purbeck,E07000051,1,116000,333000 +Purbeck,E07000051,2,155000,403000 +Purbeck,E07000051,3,203000,455000 +Purbeck,E07000051,4,285000,862000 +Reading,E06000038,1,111000,342000 +Reading,E06000038,2,183000,371000 +Reading,E06000038,3,253000,525000 +Reading,E06000038,4,344000,949000 +Redbridge,E09000026,1,86000,440000 +Redbridge,E09000026,2,143000,561000 +Redbridge,E09000026,3,314000,753000 +Redbridge,E09000026,4,432000,1219000 +Redcar and Cleveland,E06000003,1,48000,184000 +Redcar and Cleveland,E06000003,2,48000,184000 +Redcar and Cleveland,E06000003,3,62000,212000 +Redcar and Cleveland,E06000003,4,108000,367000 +Redditch,E07000236,1,45000,222000 +Redditch,E07000236,2,76000,222000 +Redditch,E07000236,3,115000,293000 +Redditch,E07000236,4,179000,467000 +Reigate and Banstead,E07000211,1,109000,469000 +Reigate and Banstead,E07000211,2,125000,469000 +Reigate and Banstead,E07000211,3,300000,694000 +Reigate and Banstead,E07000211,4,409000,1507000 +Ribble Valley,E07000124,1,73000,245000 +Ribble Valley,E07000124,2,73000,245000 +Ribble Valley,E07000124,3,93000,360000 +Ribble Valley,E07000124,4,206000,710000 +Richmond upon Thames,E09000027,1,217000,709000 +Richmond upon Thames,E09000027,2,307000,850000 +Richmond upon Thames,E09000027,3,423000,1209000 +Richmond upon Thames,E09000027,4,612000,2519000 +Richmondshire,E07000166,1,61000,266000 +Richmondshire,E07000166,2,78000,266000 +Richmondshire,E07000166,3,91000,324000 +Richmondshire,E07000166,4,171000,643000 +Rochdale,E08000005,1,50000,165000 +Rochdale,E08000005,2,54000,165000 +Rochdale,E08000005,3,71000,244000 +Rochdale,E08000005,4,129000,460000 +Rochford,E07000075,1,105000,413000 +Rochford,E07000075,2,186000,413000 +Rochford,E07000075,3,253000,478000 +Rochford,E07000075,4,319000,832000 +Rossendale,E07000125,1,44000,197000 +Rossendale,E07000125,2,57000,197000 +Rossendale,E07000125,3,78000,279000 +Rossendale,E07000125,4,134000,506000 +Rother,E07000064,1,67000,373000 +Rother,E07000064,2,104000,373000 +Rother,E07000064,3,187000,512000 +Rother,E07000064,4,282000,913000 +Rotherham,E08000018,1,50000,188000 +Rotherham,E08000018,2,50000,188000 +Rotherham,E08000018,3,66000,229000 +Rotherham,E08000018,4,133000,444000 +Rugby,E07000220,1,78000,246000 +Rugby,E07000220,2,78000,246000 +Rugby,E07000220,3,135000,330000 +Rugby,E07000220,4,224000,598000 +Runnymede,E07000212,1,113000,420000 +Runnymede,E07000212,2,156000,457000 +Runnymede,E07000212,3,320000,659000 +Runnymede,E07000212,4,429000,1450000 +Rushcliffe,E07000176,1,72000,366000 +Rushcliffe,E07000176,2,72000,366000 +Rushcliffe,E07000176,3,130000,392000 +Rushcliffe,E07000176,4,236000,711000 +Rushmoor,E07000092,1,82000,332000 +Rushmoor,E07000092,2,132000,332000 +Rushmoor,E07000092,3,245000,444000 +Rushmoor,E07000092,4,344000,658000 +Rutland,E06000017,1,65000,301000 +Rutland,E06000017,2,65000,301000 +Rutland,E06000017,3,136000,455000 +Rutland,E06000017,4,234000,1033000 +Ryedale,E07000167,1,74000,331000 +Ryedale,E07000167,2,91000,331000 +Ryedale,E07000167,3,129000,369000 +Ryedale,E07000167,4,177000,739000 +Salford,E08000006,1,63000,269000 +Salford,E08000006,2,73000,272000 +Salford,E08000006,3,91000,300000 +Salford,E08000006,4,151000,571000 +Sandwell,E08000028,1,51000,179000 +Sandwell,E08000028,2,70000,179000 +Sandwell,E08000028,3,87000,242000 +Sandwell,E08000028,4,131000,363000 +Scarborough,E07000168,1,47000,218000 +Scarborough,E07000168,2,73000,218000 +Scarborough,E07000168,3,85000,274000 +Scarborough,E07000168,4,117000,483000 +Sedgemoor,E07000188,1,76000,277000 +Sedgemoor,E07000188,2,79000,277000 +Sedgemoor,E07000188,3,126000,355000 +Sedgemoor,E07000188,4,200000,682000 +Sefton,E08000014,1,55000,246000 +Sefton,E08000014,2,62000,246000 +Sefton,E08000014,3,76000,284000 +Sefton,E08000014,4,124000,596000 +Selby,E07000169,1,61000,232000 +Selby,E07000169,2,69000,232000 +Selby,E07000169,3,92000,285000 +Selby,E07000169,4,187000,518000 +Sevenoaks,E07000111,1,132000,551000 +Sevenoaks,E07000111,2,132000,551000 +Sevenoaks,E07000111,3,249000,751000 +Sevenoaks,E07000111,4,381000,1843000 +Sheffield,E08000019,1,56000,239000 +Sheffield,E08000019,2,59000,239000 +Sheffield,E08000019,3,79000,318000 +Sheffield,E08000019,4,149000,722000 +Shropshire,E06000051,1,66000,298000 +Shropshire,E06000051,2,78000,298000 +Shropshire,E06000051,3,116000,349000 +Shropshire,E06000051,4,188000,641000 +Slough,E06000039,1,122000,345000 +Slough,E06000039,2,172000,366000 +Slough,E06000039,3,277000,542000 +Slough,E06000039,4,349000,841000 +Solihull,E08000029,1,71000,379000 +Solihull,E08000029,2,90000,379000 +Solihull,E08000029,3,119000,422000 +Solihull,E08000029,4,243000,920000 +Somerset West and Taunton,E07000246,1,82000,307000 +Somerset West and Taunton,E07000246,2,101000,307000 +Somerset West and Taunton,E07000246,3,156000,381000 +Somerset West and Taunton,E07000246,4,223000,752000 +South Bucks,E07000006,1,98000,671000 +South Bucks,E07000006,2,158000,671000 +South Bucks,E07000006,3,339000,884000 +South Bucks,E07000006,4,513000,1889000 +South Cambridgeshire,E07000012,1,105000,410000 +South Cambridgeshire,E07000012,2,130000,410000 +South Cambridgeshire,E07000012,3,207000,539000 +South Cambridgeshire,E07000012,4,324000,959000 +South Derbyshire,E07000039,1,71000,226000 +South Derbyshire,E07000039,2,73000,226000 +South Derbyshire,E07000039,3,100000,276000 +South Derbyshire,E07000039,4,184000,546000 +South Gloucestershire,E06000025,1,67000,300000 +South Gloucestershire,E06000025,2,104000,300000 +South Gloucestershire,E06000025,3,190000,383000 +South Gloucestershire,E06000025,4,283000,670000 +South Hams,E07000044,1,79000,423000 +South Hams,E07000044,2,79000,423000 +South Hams,E07000044,3,150000,526000 +South Hams,E07000044,4,239000,948000 +South Holland,E07000140,1,57000,214000 +South Holland,E07000140,2,57000,214000 +South Holland,E07000140,3,101000,276000 +South Holland,E07000140,4,173000,470000 +South Kesteven,E07000141,1,62000,264000 +South Kesteven,E07000141,2,68000,264000 +South Kesteven,E07000141,3,98000,324000 +South Kesteven,E07000141,4,184000,649000 +South Lakeland,E07000031,1,69000,318000 +South Lakeland,E07000031,2,89000,318000 +South Lakeland,E07000031,3,122000,395000 +South Lakeland,E07000031,4,195000,660000 +South Norfolk,E07000149,1,88000,291000 +South Norfolk,E07000149,2,88000,291000 +South Norfolk,E07000149,3,171000,382000 +South Norfolk,E07000149,4,236000,645000 +South Northamptonshire,E07000155,1,85000,348000 +South Northamptonshire,E07000155,2,85000,348000 +South Northamptonshire,E07000155,3,163000,397000 +South Northamptonshire,E07000155,4,279000,825000 +South Oxfordshire,E07000179,1,106000,492000 +South Oxfordshire,E07000179,2,123000,492000 +South Oxfordshire,E07000179,3,191000,616000 +South Oxfordshire,E07000179,4,349000,1554000 +South Ribble,E07000126,1,70000,209000 +South Ribble,E07000126,2,72000,209000 +South Ribble,E07000126,3,95000,246000 +South Ribble,E07000126,4,156000,484000 +South Somerset,E07000189,1,70000,275000 +South Somerset,E07000189,2,99000,275000 +South Somerset,E07000189,3,131000,358000 +South Somerset,E07000189,4,202000,735000 +South Staffordshire,E07000196,1,69000,275000 +South Staffordshire,E07000196,2,70000,275000 +South Staffordshire,E07000196,3,121000,341000 +South Staffordshire,E07000196,4,194000,694000 +South Tyneside,E08000023,1,43000,192000 +South Tyneside,E08000023,2,50000,192000 +South Tyneside,E08000023,3,61000,250000 +South Tyneside,E08000023,4,123000,460000 +Southampton,E06000045,1,67000,213000 +Southampton,E06000045,2,113000,273000 +Southampton,E06000045,3,169000,363000 +Southampton,E06000045,4,211000,637000 +Southend-on-Sea,E06000033,1,103000,384000 +Southend-on-Sea,E06000033,2,117000,417000 +Southend-on-Sea,E06000033,3,220000,524000 +Southend-on-Sea,E06000033,4,299000,901000 +Southwark,E09000028,1,130000,597000 +Southwark,E09000028,2,165000,818000 +Southwark,E09000028,3,300000,1147000 +Southwark,E09000028,4,512000,2119000 +Spelthorne,E07000213,1,177000,450000 +Spelthorne,E07000213,2,232000,462000 +Spelthorne,E07000213,3,311000,603000 +Spelthorne,E07000213,4,415000,973000 +St Albans,E07000240,1,156000,648000 +St Albans,E07000240,2,250000,648000 +St Albans,E07000240,3,355000,854000 +St Albans,E07000240,4,532000,1739000 +St Edmundsbury,E07000204,1,96000,320000 +St Edmundsbury,E07000204,2,122000,320000 +St Edmundsbury,E07000204,3,171000,410000 +St Edmundsbury,E07000204,4,236000,776000 +St. Helens,E08000013,1,55000,165000 +St. Helens,E08000013,2,55000,165000 +St. Helens,E08000013,3,69000,235000 +St. Helens,E08000013,4,129000,478000 +Stafford,E07000197,1,61000,257000 +Stafford,E07000197,2,66000,257000 +Stafford,E07000197,3,109000,315000 +Stafford,E07000197,4,185000,569000 +Staffordshire Moorlands,E07000198,1,57000,267000 +Staffordshire Moorlands,E07000198,2,78000,267000 +Staffordshire Moorlands,E07000198,3,101000,328000 +Staffordshire Moorlands,E07000198,4,148000,586000 +Stevenage,E07000243,1,68000,315000 +Stevenage,E07000243,2,87000,320000 +Stevenage,E07000243,3,232000,399000 +Stevenage,E07000243,4,274000,656000 +Stockport,E08000007,1,68000,288000 +Stockport,E08000007,2,72000,288000 +Stockport,E08000007,3,125000,402000 +Stockport,E08000007,4,217000,808000 +Stockton-on-Tees,E06000004,1,45000,192000 +Stockton-on-Tees,E06000004,2,45000,192000 +Stockton-on-Tees,E06000004,3,65000,227000 +Stockton-on-Tees,E06000004,4,134000,491000 +Stoke-on-Trent,E06000021,1,50000,151000 +Stoke-on-Trent,E06000021,2,51000,151000 +Stoke-on-Trent,E06000021,3,62000,216000 +Stoke-on-Trent,E06000021,4,125000,379000 +Stratford-on-Avon,E07000221,1,87000,357000 +Stratford-on-Avon,E07000221,2,87000,357000 +Stratford-on-Avon,E07000221,3,145000,493000 +Stratford-on-Avon,E07000221,4,277000,1020000 +Stroud,E07000082,1,72000,326000 +Stroud,E07000082,2,89000,326000 +Stroud,E07000082,3,164000,453000 +Stroud,E07000082,4,239000,888000 +Suffolk Coastal,E07000205,1,79000,357000 +Suffolk Coastal,E07000205,2,126000,387000 +Suffolk Coastal,E07000205,3,168000,420000 +Suffolk Coastal,E07000205,4,244000,747000 +Sunderland,E08000024,1,44000,165000 +Sunderland,E08000024,2,51000,165000 +Sunderland,E08000024,3,62000,217000 +Sunderland,E08000024,4,114000,413000 +Surrey Heath,E07000214,1,116000,472000 +Surrey Heath,E07000214,2,116000,472000 +Surrey Heath,E07000214,3,294000,598000 +Surrey Heath,E07000214,4,416000,1173000 +Sutton,E09000029,1,110000,432000 +Sutton,E09000029,2,189000,445000 +Sutton,E09000029,3,312000,616000 +Sutton,E09000029,4,432000,1171000 +Swale,E07000113,1,88000,303000 +Swale,E07000113,2,102000,303000 +Swale,E07000113,3,163000,389000 +Swale,E07000113,4,253000,751000 +Swindon,E06000030,1,80000,243000 +Swindon,E06000030,2,91000,243000 +Swindon,E06000030,3,151000,322000 +Swindon,E06000030,4,235000,576000 +Tameside,E08000008,1,69000,177000 +Tameside,E08000008,2,78000,177000 +Tameside,E08000008,3,99000,252000 +Tameside,E08000008,4,143000,490000 +Tamworth,E07000199,1,66000,211000 +Tamworth,E07000199,2,74000,211000 +Tamworth,E07000199,3,112000,285000 +Tamworth,E07000199,4,173000,462000 +Tandridge,E07000215,1,107000,493000 +Tandridge,E07000215,2,164000,493000 +Tandridge,E07000215,3,316000,692000 +Tandridge,E07000215,4,431000,1649000 +Taunton Deane,E07000190,1,77000,249000 +Taunton Deane,E07000190,2,78000,249000 +Taunton Deane,E07000190,3,135000,325000 +Taunton Deane,E07000190,4,210000,657000 +Teignbridge,E07000045,1,74000,310000 +Teignbridge,E07000045,2,84000,310000 +Teignbridge,E07000045,3,142000,392000 +Teignbridge,E07000045,4,217000,714000 +Telford and Wrekin,E06000020,1,61000,202000 +Telford and Wrekin,E06000020,2,68000,202000 +Telford and Wrekin,E06000020,3,86000,258000 +Telford and Wrekin,E06000020,4,152000,484000 +Tendring,E07000076,1,71000,295000 +Tendring,E07000076,2,111000,295000 +Tendring,E07000076,3,150000,382000 +Tendring,E07000076,4,222000,739000 +Test Valley,E07000093,1,77000,405000 +Test Valley,E07000093,2,90000,405000 +Test Valley,E07000093,3,164000,470000 +Test Valley,E07000093,4,287000,999000 +Tewkesbury,E07000083,1,55000,298000 +Tewkesbury,E07000083,2,75000,298000 +Tewkesbury,E07000083,3,120000,404000 +Tewkesbury,E07000083,4,255000,720000 +Thanet,E07000114,1,80000,297000 +Thanet,E07000114,2,119000,297000 +Thanet,E07000114,3,165000,390000 +Thanet,E07000114,4,229000,701000 +Three Rivers,E07000102,1,191000,530000 +Three Rivers,E07000102,2,204000,613000 +Three Rivers,E07000102,3,334000,796000 +Three Rivers,E07000102,4,480000,1730000 +Thurrock,E06000034,1,103000,327000 +Thurrock,E06000034,2,134000,327000 +Thurrock,E06000034,3,221000,408000 +Thurrock,E06000034,4,299000,647000 +Tonbridge and Malling,E07000115,1,101000,375000 +Tonbridge and Malling,E07000115,2,106000,375000 +Tonbridge and Malling,E07000115,3,236000,565000 +Tonbridge and Malling,E07000115,4,345000,1080000 +Torbay,E06000027,1,67000,295000 +Torbay,E06000027,2,89000,295000 +Torbay,E06000027,3,127000,334000 +Torbay,E06000027,4,168000,606000 +Torridge,E07000046,1,81000,279000 +Torridge,E07000046,2,100000,279000 +Torridge,E07000046,3,132000,375000 +Torridge,E07000046,4,188000,611000 +Tower Hamlets,E09000030,1,131000,564000 +Tower Hamlets,E09000030,2,181000,806000 +Tower Hamlets,E09000030,3,230000,1253000 +Tower Hamlets,E09000030,4,430000,1616000 +Trafford,E08000009,1,78000,377000 +Trafford,E08000009,2,109000,377000 +Trafford,E08000009,3,149000,473000 +Trafford,E08000009,4,245000,1241000 +Tunbridge Wells,E07000116,1,85000,471000 +Tunbridge Wells,E07000116,2,121000,471000 +Tunbridge Wells,E07000116,3,259000,677000 +Tunbridge Wells,E07000116,4,389000,1408000 +Uttlesford,E07000077,1,60000,448000 +Uttlesford,E07000077,2,111000,448000 +Uttlesford,E07000077,3,217000,566000 +Uttlesford,E07000077,4,376000,1179000 +Vale of White Horse,E07000180,1,73000,381000 +Vale of White Horse,E07000180,2,104000,381000 +Vale of White Horse,E07000180,3,209000,483000 +Vale of White Horse,E07000180,4,329000,947000 +Wakefield,E08000036,1,57000,174000 +Wakefield,E08000036,2,64000,174000 +Wakefield,E08000036,3,78000,243000 +Wakefield,E08000036,4,141000,450000 +Walsall,E08000030,1,59000,198000 +Walsall,E08000030,2,71000,198000 +Walsall,E08000030,3,88000,281000 +Walsall,E08000030,4,143000,605000 +Waltham Forest,E09000031,1,126000,467000 +Waltham Forest,E09000031,2,212000,574000 +Waltham Forest,E09000031,3,360000,744000 +Waltham Forest,E09000031,4,451000,997000 +Wandsworth,E09000032,1,154000,629000 +Wandsworth,E09000032,2,253000,859000 +Wandsworth,E09000032,3,403000,1259000 +Wandsworth,E09000032,4,711000,2487000 +Warrington,E06000007,1,63000,256000 +Warrington,E06000007,2,76000,256000 +Warrington,E06000007,3,98000,335000 +Warrington,E06000007,4,177000,715000 +Warwick,E07000222,1,70000,359000 +Warwick,E07000222,2,102000,359000 +Warwick,E07000222,3,182000,467000 +Warwick,E07000222,4,306000,924000 +Watford,E07000103,1,134000,406000 +Watford,E07000103,2,211000,431000 +Watford,E07000103,3,322000,674000 +Watford,E07000103,4,417000,1172000 +Waveney,E07000206,1,62000,271000 +Waveney,E07000206,2,89000,271000 +Waveney,E07000206,3,105000,291000 +Waveney,E07000206,4,150000,570000 +Waverley,E07000216,1,118000,576000 +Waverley,E07000216,2,150000,576000 +Waverley,E07000216,3,299000,738000 +Waverley,E07000216,4,446000,1825000 +Wealden,E07000065,1,99000,415000 +Wealden,E07000065,2,113000,415000 +Wealden,E07000065,3,199000,570000 +Wealden,E07000065,4,310000,1260000 +Wellingborough,E07000156,1,26000,254000 +Wellingborough,E07000156,2,50000,254000 +Wellingborough,E07000156,3,124000,313000 +Wellingborough,E07000156,4,202000,685000 +Welwyn Hatfield,E07000241,1,80000,439000 +Welwyn Hatfield,E07000241,2,118000,487000 +Welwyn Hatfield,E07000241,3,269000,693000 +Welwyn Hatfield,E07000241,4,387000,1402000 +West Berkshire,E06000037,1,82000,439000 +West Berkshire,E06000037,2,104000,439000 +West Berkshire,E06000037,3,241000,546000 +West Berkshire,E06000037,4,357000,1256000 +West Devon,E07000047,1,73000,333000 +West Devon,E07000047,2,106000,333000 +West Devon,E07000047,3,149000,416000 +West Devon,E07000047,4,194000,765000 +West Dorset,E07000052,1,97000,327000 +West Dorset,E07000052,2,106000,327000 +West Dorset,E07000052,3,168000,432000 +West Dorset,E07000052,4,247000,846000 +West Lancashire,E07000127,1,41000,296000 +West Lancashire,E07000127,2,58000,296000 +West Lancashire,E07000127,3,58000,314000 +West Lancashire,E07000127,4,117000,648000 +West Lindsey,E07000142,1,59000,234000 +West Lindsey,E07000142,2,59000,234000 +West Lindsey,E07000142,3,81000,290000 +West Lindsey,E07000142,4,141000,522000 +West Oxfordshire,E07000181,1,90000,407000 +West Oxfordshire,E07000181,2,94000,407000 +West Oxfordshire,E07000181,3,168000,524000 +West Oxfordshire,E07000181,4,300000,982000 +West Somerset,E07000191,1,86000,333000 +West Somerset,E07000191,2,103000,333000 +West Somerset,E07000191,3,152000,357000 +West Somerset,E07000191,4,207000,798000 +West Suffolk,E07000245,1,65000,300000 +West Suffolk,E07000245,2,86000,300000 +West Suffolk,E07000245,3,138000,410000 +West Suffolk,E07000245,4,250000,798000 +Westminster,E09000033,1,245000,879000 +Westminster,E09000033,2,430000,1846000 +Westminster,E09000033,3,501000,2876000 +Westminster,E09000033,4,914000,7794000 +Weymouth and Portland,E07000053,1,69000,255000 +Weymouth and Portland,E07000053,2,104000,255000 +Weymouth and Portland,E07000053,3,154000,335000 +Weymouth and Portland,E07000053,4,201000,547000 +Wigan,E08000010,1,58000,181000 +Wigan,E08000010,2,58000,181000 +Wigan,E08000010,3,70000,239000 +Wigan,E08000010,4,140000,399000 +Wiltshire,E06000054,1,76000,325000 +Wiltshire,E06000054,2,89000,325000 +Wiltshire,E06000054,3,160000,430000 +Wiltshire,E06000054,4,250000,863000 +Winchester,E07000094,1,80000,516000 +Winchester,E07000094,2,103000,516000 +Winchester,E07000094,3,230000,729000 +Winchester,E07000094,4,371000,1384000 +Windsor and Maidenhead,E06000040,1,177000,556000 +Windsor and Maidenhead,E06000040,2,239000,561000 +Windsor and Maidenhead,E06000040,3,334000,816000 +Windsor and Maidenhead,E06000040,4,474000,1683000 +Wirral,E08000015,1,53000,249000 +Wirral,E08000015,2,62000,249000 +Wirral,E08000015,3,79000,283000 +Wirral,E08000015,4,116000,619000 +Woking,E07000217,1,150000,443000 +Woking,E07000217,2,220000,454000 +Woking,E07000217,3,309000,698000 +Woking,E07000217,4,436000,1373000 +Wokingham,E06000041,1,99000,428000 +Wokingham,E06000041,2,112000,428000 +Wokingham,E06000041,3,231000,551000 +Wokingham,E06000041,4,411000,1039000 +Wolverhampton,E08000031,1,30000,200000 +Wolverhampton,E08000031,2,47000,200000 +Wolverhampton,E08000031,3,76000,252000 +Wolverhampton,E08000031,4,125000,526000 +Worcester,E07000237,1,63000,231000 +Worcester,E07000237,2,95000,231000 +Worcester,E07000237,3,133000,322000 +Worcester,E07000237,4,204000,572000 +Worthing,E07000229,1,117000,366000 +Worthing,E07000229,2,147000,371000 +Worthing,E07000229,3,238000,473000 +Worthing,E07000229,4,313000,718000 +Wychavon,E07000238,1,74000,338000 +Wychavon,E07000238,2,74000,338000 +Wychavon,E07000238,3,123000,406000 +Wychavon,E07000238,4,234000,722000 +Wycombe,E07000007,1,134000,501000 +Wycombe,E07000007,2,168000,501000 +Wycombe,E07000007,3,273000,631000 +Wycombe,E07000007,4,376000,1385000 +Wyre,E07000128,1,51000,226000 +Wyre,E07000128,2,61000,226000 +Wyre,E07000128,3,81000,271000 +Wyre,E07000128,4,147000,484000 +Wyre Forest,E07000239,1,68000,255000 +Wyre Forest,E07000239,2,68000,255000 +Wyre Forest,E07000239,3,106000,294000 +Wyre Forest,E07000239,4,170000,689000 +York,E06000014,1,79000,322000 +York,E06000014,2,126000,322000 +York,E06000014,3,161000,397000 +York,E06000014,4,236000,731000 +Other,,1,40000,399000 +Other,,2,60000,499000 +Other,,3,100000,799000 +Other,,4,120000,999000 diff --git a/db/migrate/20230124111328_create_la_purchase_price_ranges.rb b/db/migrate/20230124111328_create_la_purchase_price_ranges.rb new file mode 100644 index 000000000..d122ed768 --- /dev/null +++ b/db/migrate/20230124111328_create_la_purchase_price_ranges.rb @@ -0,0 +1,14 @@ +class CreateLaPurchasePriceRanges < ActiveRecord::Migration[7.0] + def change + create_table :la_purchase_price_ranges do |t| + t.string :la + t.integer :bedrooms + t.decimal :soft_min, precision: 10, scale: 2 + t.decimal :soft_max, precision: 10, scale: 2 + t.integer :start_year + + t.index %i[start_year bedrooms la], unique: true, name: "index_la_purchase_price_ranges_on_start_year_bedrooms_la" + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 624b38769..f61fb6599 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_01_23_171907) do +ActiveRecord::Schema[7.0].define(version: 2023_01_24_111328) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -54,6 +54,17 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_23_171907) do t.index ["organisation_id"], name: "index_data_protection_confirmations_on_organisation_id" end + create_table "la_purchase_price_ranges", force: :cascade do |t| + t.string "la" + t.integer "bedrooms" + t.decimal "soft_min", precision: 10, scale: 2 + t.decimal "soft_max", precision: 10, scale: 2 + t.integer "start_year" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["start_year", "bedrooms", "la"], name: "index_la_purchase_price_ranges_on_start_year_bedrooms_la", unique: true + end + create_table "la_rent_ranges", force: :cascade do |t| t.integer "ranges_rent_id" t.integer "lettype" diff --git a/db/seeds.rb b/db/seeds.rb index 8dea68d80..e7444a267 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -310,5 +310,13 @@ unless Rails.env.test? service.call end end + + if LaPurchasePriceRange.count.zero? + Dir.glob("config/purchase_price_range_data/*.csv").each do |path| + start_year = File.basename(path, ".csv") + service = Imports::PurchasePriceRangesService.new(start_year:, path:) + service.call + end + end end # rubocop:enable Rails/Output diff --git a/lib/tasks/purchase_price_ranges.rake b/lib/tasks/purchase_price_ranges.rake new file mode 100644 index 000000000..464ed940c --- /dev/null +++ b/lib/tasks/purchase_price_ranges.rake @@ -0,0 +1,14 @@ +namespace :data_import do + desc "Import annual purchase price range data" + task :purchase_price_ranges, %i[start_year path] => :environment do |_task, args| + start_year = args[:start_year] + path = args[:path] + + raise "Usage: rake data_import:purchase_price_ranges[start_year,'path/to/csv_file']" if path.blank? || start_year.blank? + + service = Imports::PurchasePriceRangesService.new(start_year:, path:) + service.call + + pp "Created/updated #{service.count} LA Purchase Price Range records for #{start_year}" unless Rails.env.test? + end +end