Skip to content

Commit

Permalink
feat(Postcodes): Return date of creation in YYYYMM format
Browse files Browse the repository at this point in the history
  • Loading branch information
cblanc committed Jan 4, 2023
1 parent 2a41c3f commit df36589
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/models/postcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface PostcodeInterface {
northings: number | null;
country: string;
nhs_ha: string | null;
date_of_introduction: string;
longitude: number | null;
latitude: number | null;
european_electoral_region: string | null;
Expand Down Expand Up @@ -84,6 +85,7 @@ export interface PostcodeTuple {
region: string;
parish_id: string;
lsoa: string;
date_of_introduction: string;
lsoa_id: string;
msoa: string;
msoa_id: string;
Expand Down Expand Up @@ -134,6 +136,7 @@ const relation: Relation = {
ccg_id: "VARCHAR(32)",
ced_id: "VARCHAR(32)",
constituency_id: "VARCHAR(32)",
date_of_introduction: "VARCHAR(6)",
},
indexes: [
{
Expand Down Expand Up @@ -781,6 +784,7 @@ const toJson = function (
admin_district: p.admin_district,
parish: p.parish,
admin_county: p.admin_county,
date_of_introduction: p.date_of_introduction,
admin_ward: p.admin_ward,
ced: p.ced,
ccg: p.ccg,
Expand Down Expand Up @@ -863,6 +867,7 @@ const seedPostcodes = async (filepath: string) => {
{ column: "outcode", method: (row) => row.extract("pcds").split(" ")[0] },
{ column: "ced_id", method: (row) => row.extract("ced") },
{ column: "ccg_id", method: (row) => row.extract("ccg") },
{ column: "date_of_introduction", method: row => row.extract("dointr") },
]);

await methods.csvSeed({
Expand Down
1 change: 1 addition & 0 deletions test/helper/type_checking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const postcodeAttributes = [
"northings",
"longitude",
"admin_ward",
"date_of_introduction",
"admin_county",
"admin_district",
"region",
Expand Down
3 changes: 3 additions & 0 deletions test/postcode.regression.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe("Postcode data regression testing", function () {
northings: 804021,
country: "Scotland",
nhs_ha: "Grampian",
date_of_introduction: "199606",
admin_county_id: "S99999999",
admin_district_id: "S12000033",
admin_ward_id: "S13002847",
Expand Down Expand Up @@ -78,6 +79,7 @@ describe("Postcode data regression testing", function () {
latitude: 51.492762,
location: "0101000020E61000008080B56AD784B4BF145B41D312BF4940",
european_electoral_region: "London",
date_of_introduction: "201008",
primary_care_trust: "Southwark",
region: "London",
parish_id: "E43000218",
Expand Down Expand Up @@ -138,6 +140,7 @@ describe("Postcode data regression testing", function () {
outcode: "JE2",
ccg_id: "L99999999",
ced: null,
date_of_introduction: "199507",
ced_id: "L99999999",
constituency_id: "L99999999",
parliamentary_constituency: null,
Expand Down

0 comments on commit df36589

Please sign in to comment.