Skip to content

Commit 08c2891

Browse files
committed
fixup version ordering in csv upload. fix entry date. add end date in org csv
1 parent 9bf4e21 commit 08c2891

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

application/blueprints/uploads/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
def _order_records(records):
3636
def sort_key(item):
37-
if item.get("end-date") is None:
37+
if item.get("end-date") is None or item.get("end-date") == "":
3838
return datetime.date.max
3939
else:
4040
return item.get("end-date")

application/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def factory(cls, row_id, entity, dataset, data_dict, config):
229229
setattr(record, column.name, data_dict.pop(column.name))
230230

231231
for key, value in data_dict.items():
232-
if key.endswith("-date") and value and key != "entry-date":
232+
if key.endswith("-date") and value:
233233
date_key = key.replace("-", "_")
234234
date_value = parse_date(value)
235235
setattr(record, date_key, date_value)
+24-24
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
entity,name,prefix,reference,addressbase-custodian,billing-authority,company,notes,opendatacommunities-uri,parliament-thesaurus,statistical-geography,twitter,website,website-url,wikidata,wikipedia,entry-date,start-date,end-date
2-
600001,"Ministry of Housing, Communities and Local Government",government-organisation,D4,,,,,http://opendatacommunities.org/def/concept/folders/organisations/department-for-communities-and-local-government,442434,,mhclg,https://www.gov.uk/government/organisations/ministry-of-housing-communities-and-local-government,,Q601819,"Department_for_Levelling_Up,_Housing_and_Communities",2025-02-05,2006-05-01,
3-
600001,"Department for Levelling Up, Housing and Communities",government-organisation,D1342,,,,,,,,luhc,https://www.gov.uk/government/organisations/department-for-levelling-up-housing-and-communities,,Q601819,Department_for_Levelling_Up,2025-02-05,2021-09-20,
4-
600001,"Ministry of Housing, Communities & Local Government",government-organisation,D1342,,,,,,,,mhclg,https://www.gov.uk/government/organisations/ministry-of-housing-communities-local-government,,Q601819,"Ministry_of_Housing,_Communities_and_Local_Government",2025-02-05,2024-07-09,
5-
10,Office for National Statistics,government-organisation,D303,,,,,,60225,,ONS,https://www.ons.gov.uk,,Q1334971,Office_for_National_Statistics,2025-02-05,1996-04-01,
6-
11,Ordnance Survey,government-organisation,D38,7655,,,,,60584,,ordnancesurvey,https://www.gov.uk/government/organisations/ordnance-survey,,Q548721,Ordnance_Survey,2025-02-05,1791-01-01,
7-
13,HM Land Registry,government-organisation,D69,,,,,,42350,,hmlandregistry,https://www.gov.uk/government/organisations/land-registry,,Q5635120,HM_Land_Registry,2025-02-05,1862-01-01,
8-
600002,"Department for Environment, Food & Rural Affairs",government-organisation,D7,,,,,,28661,,defragovuk,https://www.gov.uk/government/organisations/department-for-environment-food-rural-affairs,,Q3044721,"Department_for_Environment,_Food_and_Rural_Affairs",2025-02-05,2001-01-01,
9-
600009,Environment Agency,government-organisation,EA199,,,,,,17847,,EnvAgency,https://www.gov.uk/government/organisations/environment-agency,,Q5381011,Environment_Agency,2025-02-05,1996-04-01,
10-
14,Planning Inspectorate,government-organisation,EA39,,,,,http://opendatacommunities.org/def/concept/folders/organisations/the-planning-inspectorate,82822,,PINSgov,https://www.gov.uk/government/organisations/planning-inspectorate,,Q7201367,Planning_Inspectorate,2025-02-05,,
11-
15,Valuation Office Agency,government-organisation,EA87,,,,,,85516,,,https://www.gov.uk/government/organisations/valuation-office-agency,,Q7912696,Valuation_Office_Agency,2025-02-05,,
12-
16,Historic England,government-organisation,PB1164,,,,,,424432,,,https://historicengland.org.uk,,Q19604421,Historic_England,2025-02-05,1984-01-01,
13-
17,Valuation Tribunal for England,government-organisation,PB1204,,,,,,85518,,,https://www.gov.uk/government/organisations/valuation-tribunal-for-england,,Q81075624,,2025-02-05,,
14-
18,Regulator of Social Housing,government-organisation,PB1218,,,,,,,,rshengland,https://www.gov.uk/government/organisations/regulator-of-social-housing,,Q65071973,Regulator_of_Social_Housing,2025-02-05,2018-01-01,
15-
19,Homes England,government-organisation,PB1232,,,,,http://opendatacommunities.org/def/concept/folders/organisations/the-homes-and-communities-agency,443354,,HomesEngland,https://www.gov.uk/government/organisations/homes-england,,Q5890410,Homes_England,2025-02-05,2018-01-01,
16-
20,Building Regulations Advisory Committee,government-organisation,PB160,,,,,,16718,,,https://www.gov.uk/government/organisations/building-regulations-advisory-committee,,Q39045922,Building_Regulations_Advisory_Committee,2025-02-05,,
17-
501910,Natural England,government-organisation,PB202,,,,,,57927,,naturalengland,https://www.gov.uk/government/organisations/natural-england,,Q1699627,Natural_England,2025-02-05,2006-10-01,
18-
21,Health and Safety Executive,government-organisation,PB207,,,,,,35742,,h_s_e,https://www.gov.uk/government/organisations/health-and-safety-executive,,Q1478750,Health_and_Safety_Executive,2025-02-05,,
19-
22,Housing Ombudsman,government-organisation,PB372,,,,,,25340,,housingombuds,https://www.housing-ombudsman.org.uk,,Q39046108,Housing_Ombudsman,2025-02-05,,
20-
23,Leasehold Advisory Service,government-organisation,PB373,,,,,,42573,,,https://www.gov.uk/government/organisations/leasehold-advisory-service,,Q81054630,,2025-02-05,,
21-
24,Valuation Tribunal Service,government-organisation,PB375,,,,,,85519,,,https://www.gov.uk/government/organisations/valuation-tribunal-service-for-england-valuation-tribunal-service,,Q81056025,,2025-02-05,,
22-
25,Architects Registration Board,government-organisation,PC163,,,,,,1711,,,https://www.gov.uk/government/organisations/architects-registration-board,,Q4787008,Architects_Registration_Board,2025-02-05,,
23-
600010,Department for Transport,government-organisation,D9,,,,,,28665,,transportgovuk,https://www.gov.uk/government/organisations/department-for-transport,,Q2982287,Department_for_Transport,2025-02-05,2002-01-01,
24-
600011,Forestry Commission,government-organisation,D85,,,,,,34765,,ForestryComm,https://www.gov.uk/government/organisations/forestry-commission,,Q1437242,Forestry_Commission,2025-02-05,1919-01-01,
25-
600012,Department for Education,government-organisation,D6,,,,,,348507,,,https://www.gov.uk/government/organisations/department-for-education,,Q2612019,Department_for_Education,2025-02-05,2010-05-12,
2+
600001,"Ministry of Housing, Communities and Local Government",government-organisation,D4,,,,,http://opendatacommunities.org/def/concept/folders/organisations/department-for-communities-and-local-government,442434,,mhclg,https://www.gov.uk/government/organisations/ministry-of-housing-communities-and-local-government,,Q601819,"Department_for_Levelling_Up,_Housing_and_Communities",2024-07-08,2006-05-01,2021-09-20
3+
600001,"Department for Levelling Up, Housing and Communities",government-organisation,D1342,,,,,,,,luhc,https://www.gov.uk/government/organisations/department-for-levelling-up-housing-and-communities,,Q601819,Department_for_Levelling_Up,2021-07-09,2021-09-20,2024-07-09
4+
600001,"Ministry of Housing, Communities & Local Government",government-organisation,D1342,,,,,,,,mhclg,https://www.gov.uk/government/organisations/ministry-of-housing-communities-local-government,,Q601819,"Ministry_of_Housing,_Communities_and_Local_Government",2024-07-10,2024-07-09,
5+
10,Office for National Statistics,government-organisation,D303,,,,,,60225,,ONS,https://www.ons.gov.uk,,Q1334971,Office_for_National_Statistics,2024-06-25,1996-04-01,
6+
11,Ordnance Survey,government-organisation,D38,7655,,,,,60584,,ordnancesurvey,https://www.gov.uk/government/organisations/ordnance-survey,,Q548721,Ordnance_Survey,2024-06-25,1791-01-01,
7+
13,HM Land Registry,government-organisation,D69,,,,,,42350,,hmlandregistry,https://www.gov.uk/government/organisations/land-registry,,Q5635120,HM_Land_Registry,2024-06-25,1862-01-01,
8+
600002,"Department for Environment, Food & Rural Affairs",government-organisation,D7,,,,,,28661,,defragovuk,https://www.gov.uk/government/organisations/department-for-environment-food-rural-affairs,,Q3044721,"Department_for_Environment,_Food_and_Rural_Affairs",2024-06-25,2001-01-01,
9+
600009,Environment Agency,government-organisation,EA199,,,,,,17847,,EnvAgency,https://www.gov.uk/government/organisations/environment-agency,,Q5381011,Environment_Agency,2024-06-28,1996-04-01,
10+
14,Planning Inspectorate,government-organisation,EA39,,,,,http://opendatacommunities.org/def/concept/folders/organisations/the-planning-inspectorate,82822,,PINSgov,https://www.gov.uk/government/organisations/planning-inspectorate,,Q7201367,Planning_Inspectorate,2024-06-25,,
11+
15,Valuation Office Agency,government-organisation,EA87,,,,,,85516,,,https://www.gov.uk/government/organisations/valuation-office-agency,,Q7912696,Valuation_Office_Agency,2024-06-25,,
12+
16,Historic England,government-organisation,PB1164,,,,,,424432,,,https://historicengland.org.uk,,Q19604421,Historic_England,2024-06-25,1984-01-01,
13+
17,Valuation Tribunal for England,government-organisation,PB1204,,,,,,85518,,,https://www.gov.uk/government/organisations/valuation-tribunal-for-england,,Q81075624,,2024-06-25,,
14+
18,Regulator of Social Housing,government-organisation,PB1218,,,,,,,,rshengland,https://www.gov.uk/government/organisations/regulator-of-social-housing,,Q65071973,Regulator_of_Social_Housing,2024-06-25,2018-01-01,
15+
19,Homes England,government-organisation,PB1232,,,,,http://opendatacommunities.org/def/concept/folders/organisations/the-homes-and-communities-agency,443354,,HomesEngland,https://www.gov.uk/government/organisations/homes-england,,Q5890410,Homes_England,2024-06-25,2018-01-01,
16+
20,Building Regulations Advisory Committee,government-organisation,PB160,,,,,,16718,,,https://www.gov.uk/government/organisations/building-regulations-advisory-committee,,Q39045922,Building_Regulations_Advisory_Committee,2024-06-25,,
17+
501910,Natural England,government-organisation,PB202,,,,,,57927,,naturalengland,https://www.gov.uk/government/organisations/natural-england,,Q1699627,Natural_England,2024-06-25,2006-10-01,
18+
21,Health and Safety Executive,government-organisation,PB207,,,,,,35742,,h_s_e,https://www.gov.uk/government/organisations/health-and-safety-executive,,Q1478750,Health_and_Safety_Executive,2024-06-25,,
19+
22,Housing Ombudsman,government-organisation,PB372,,,,,,25340,,housingombuds,https://www.housing-ombudsman.org.uk,,Q39046108,Housing_Ombudsman,2024-06-25,,
20+
23,Leasehold Advisory Service,government-organisation,PB373,,,,,,42573,,,https://www.gov.uk/government/organisations/leasehold-advisory-service,,Q81054630,,2024-06-25,,
21+
24,Valuation Tribunal Service,government-organisation,PB375,,,,,,85519,,,https://www.gov.uk/government/organisations/valuation-tribunal-service-for-england-valuation-tribunal-service,,Q81056025,,2024-06-25,,
22+
25,Architects Registration Board,government-organisation,PC163,,,,,,1711,,,https://www.gov.uk/government/organisations/architects-registration-board,,Q4787008,Architects_Registration_Board,2024-06-25,,
23+
600010,Department for Transport,government-organisation,D9,,,,,,28665,,transportgovuk,https://www.gov.uk/government/organisations/department-for-transport,,Q2982287,Department_for_Transport,2024-06-26,2002-01-01,
24+
600011,Forestry Commission,government-organisation,D85,,,,,,34765,,ForestryComm,https://www.gov.uk/government/organisations/forestry-commission,,Q1437242,Forestry_Commission,2024-07-04,1919-01-01,
25+
600012,Department for Education,government-organisation,D6,,,,,,348507,,,https://www.gov.uk/government/organisations/department-for-education,,Q2612019,Department_for_Education,2024-07-09,2010-05-12,

0 commit comments

Comments
 (0)