Skip to content

Commit

Permalink
chore(Data): Update CCGs
Browse files Browse the repository at this point in the history
England has its own file which has been updated to Apr 2020. Rest of UK
stuck at April 2019
  • Loading branch information
cblanc committed Jun 22, 2020
1 parent e18715e commit 1ac901d
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 20 deletions.
76 changes: 76 additions & 0 deletions data/ccgs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"CCG20CD": {
"ccg19cdh": "CCG20CDH",
"name": "CCG20NM"
},
"E38000001": {
"ccg19cdh": "02N",
"name": "NHS Airedale, Wharfedale and Craven"
Expand Down Expand Up @@ -763,6 +767,78 @@
"ccg19cdh": "15N",
"name": "NHS Devon"
},
"E38000231": {
"ccg19cdh": "92G",
"name": "NHS Bath and North East Somerset, Swindon and Wiltshire"
},
"E38000232": {
"ccg19cdh": "36J",
"name": "NHS Bradford District and Craven"
},
"E38000233": {
"ccg19cdh": "27D",
"name": "NHS Cheshire"
},
"E38000234": {
"ccg19cdh": "84H",
"name": "NHS County Durham"
},
"E38000235": {
"ccg19cdh": "97R",
"name": "NHS East Sussex"
},
"E38000236": {
"ccg19cdh": "18C",
"name": "NHS Herefordshire and Worcestershire"
},
"E38000237": {
"ccg19cdh": "91Q",
"name": "NHS Kent and Medway"
},
"E38000238": {
"ccg19cdh": "71E",
"name": "NHS Lincolnshire"
},
"E38000239": {
"ccg19cdh": "26A",
"name": "NHS Norfolk and Waveney"
},
"E38000240": {
"ccg19cdh": "93C",
"name": "NHS North Central London"
},
"E38000241": {
"ccg19cdh": "42D",
"name": "NHS North Yorkshire"
},
"E38000242": {
"ccg19cdh": "78H",
"name": "NHS Northamptonshire"
},
"E38000243": {
"ccg19cdh": "52R",
"name": "NHS Nottingham and Nottinghamshire"
},
"E38000244": {
"ccg19cdh": "72Q",
"name": "NHS South East London"
},
"E38000245": {
"ccg19cdh": "36L",
"name": "NHS South West London"
},
"E38000246": {
"ccg19cdh": "92A",
"name": "NHS Surrey Heartlands"
},
"E38000247": {
"ccg19cdh": "16C",
"name": "NHS Tees Valley"
},
"E38000248": {
"ccg19cdh": "70F",
"name": "NHS West Sussex"
},
"M01000001": {
"ccg19cdh": "YK1",
"name": "Isle of Man"
Expand Down
48 changes: 29 additions & 19 deletions data/scripts/ccgs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const {extract, isPseudoCode} = require("./index");
const { extract, isPseudoCode } = require("./index");

/**
* @module DataParser/ccgs
Expand All @@ -12,34 +12,44 @@ const {extract, isPseudoCode} = require("./index");
* - "CCG" suffix is dropped from values
*/


const CODE_OFFSET = 0;
const SECOND_CODE_OFFSET = 1;
const VALUE_OFFSET = 2;

const ccgRegex = /\sCCG$/;

const transform = row => {
const code = row[CODE_OFFSET];
const transform = (row) => {
const code = row[CODE_OFFSET];
const second_code = row[SECOND_CODE_OFFSET];
const value = row[VALUE_OFFSET];
if (code === "CCG19CD") return []; // Escape if header
if (isPseudoCode(code)) return [];
return [code, {
"ccg19cdh": second_code,
"name": value.replace(ccgRegex, "").trim()
}];
const value = row[VALUE_OFFSET];
if (code === "CCG19CD") return []; // Escape if header
if (isPseudoCode(code)) return [];
return [
code,
{
ccg19cdh: second_code,
name: value.replace(ccgRegex, "").trim(),
},
];
};

const configs = [
{
file: "CCG names and codes UK as at 04_19.csv",
transform,
parseOptions: {
delimiter: ",",
},
encoding: "utf8",
}
{
file: "CCG names and codes UK as at 04_19.csv",
transform,
parseOptions: {
delimiter: ",",
},
encoding: "utf8",
},
{
file: "CCG names and codes EN as at 04_20.csv",
transform,
parseOptions: {
delimiter: ",",
},
encoding: "utf8",
},
];

extract({ configs });
2 changes: 1 addition & 1 deletion data/scripts/wards.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const { extract } = require("./index");
const CODE_OFFSET = 0;
const VALUE_OFFSET = 1;

const transform = row => {
const transform = (row) => {
const code = row[CODE_OFFSET];
const value = row[VALUE_OFFSET];
if (code === "WD19CD") return []; // Escape if header
Expand Down

0 comments on commit 1ac901d

Please sign in to comment.