diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f16715e..1971fdf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,10 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v5 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v6 with: python-version: 3.9 diff --git a/.github/workflows/schema.yml b/.github/workflows/schema.yml index 2faa760..ef86799 100644 --- a/.github/workflows/schema.yml +++ b/.github/workflows/schema.yml @@ -9,10 +9,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v5 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v6 with: python-version: 3.9 @@ -29,7 +29,7 @@ jobs: cd pyxb_build python setup.py bdist_wheel - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: ukrdc_schema_wheel path: pyxb_build/dist/*.whl @@ -48,10 +48,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v5 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v6 with: python-version: 3.9 @@ -66,7 +66,7 @@ jobs: ./build.sh python setup.py bdist_wheel - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: ukrdc_xsdata_wheel path: xsdata_build/dist/*.whl @@ -86,7 +86,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4.1.7 - name: Release uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml index 7f12f0b..3bbfd8d 100644 --- a/.github/workflows/scripts.yml +++ b/.github/workflows/scripts.yml @@ -11,10 +11,10 @@ jobs: working-directory: scripts steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v5 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v6 with: python-version: 3.8 diff --git a/.github/workflows/validate_samples.yml b/.github/workflows/validate_samples.yml index d54b2cc..2cd1c6b 100644 --- a/.github/workflows/validate_samples.yml +++ b/.github/workflows/validate_samples.yml @@ -8,10 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v5 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v6 with: python-version: 3.9 diff --git a/codes/README.md b/codes/README.md new file mode 100644 index 0000000..79b7fd0 --- /dev/null +++ b/codes/README.md @@ -0,0 +1,3 @@ +# Registry codes +Historically this directory was used to store csv files containing picklists and mappings for the codes which were used by the UKRDC. They have been now moved to a repo exclusively for this purpose which can be found [here](https://github.com/renalreg/registry-codes). + diff --git a/codes/code_lists/edta2.csv b/codes/code_lists/edta2.csv deleted file mode 100644 index 71ce7c1..0000000 --- a/codes/code_lists/edta2.csv +++ /dev/null @@ -1,287 +0,0 @@ -EDTA2,2513,AA amyloid secondary to chronic inflammation -EDTA2,1768,Acquired obstructive nephropathy due to neurogenic bladder -EDTA2,1752,Acquired obstructive uropathy / nephropathy -EDTA2,3442,Acute cortical necrosis -EDTA2,3380,Acute kidney injury -EDTA2,3403,Acute kidney injury due to circulatory failure -EDTA2,3398,Acute kidney injury due to hypovolaemia -EDTA2,3435,Acute kidney injury due to nephrotoxicity -EDTA2,3426,Acute kidney injury due to rhabdomyolysis -EDTA2,3419,Acute kidney injury due to sepsis -EDTA2,3457,Acute pyelonephritis -EDTA2,2196,Acute urate nephropathy - histologically proven -EDTA2,2183,Acute urate nephropathy - no histology -EDTA2,1003,Adult nephrotic syndrome - no histology -EDTA2,2392,Ageing kidney - no histology -EDTA2,2521,AL amyloid secondary to plasma cell dyscrasia -EDTA2,3071,Alagille syndrome -EDTA2,2760,Alport syndrome - histologically proven -EDTA2,2756,Alport syndrome - no histology -EDTA2,1472,Anti-Glomerular basement membrane (GBM) disease / Goodpasture's syndrome - histologically proven -EDTA2,1464,Anti-Glomerular basement membrane (GBM) disease / Goodpasture's syndrome - no histology -EDTA2,3118,Apparent mineralocorticoid excess -EDTA2,1995,Aristolochic acid nephropathy (Balkan / Chinese herb / endemic nephropathy) - histologically proven -EDTA2,1982,Aristolochic acid nephropathy (Balkan / Chinese herb / endemic nephropathy) - no histology -EDTA2,2448,Atheroembolic renal disease - histologically proven -EDTA2,2430,Atheroembolic renal disease - no histology -EDTA2,2623,Atypical haemolytic uraemic syndrome (HUS) - diarrhoea negative -EDTA2,2718,Autosomal dominant (AD) polycystic kidney disease -EDTA2,2725,Autosomal dominant (AD) polycystic kidney disease type I -EDTA2,2739,Autosomal dominant (AD) polycystic kidney disease type II -EDTA2,2741,Autosomal recessive (AR) polycystic kidney disease -EDTA2,3085,Bartter syndrome -EDTA2,2773,Benign familial haematuria -EDTA2,1710,Bladder exstrophy -EDTA2,3322,Branchio-oto-renal syndrome -EDTA2,1845,Calcium oxalate urolithiasis -EDTA2,1832,Calculus nephropathy / urolithiasis -EDTA2,2482,Cardiorenal syndrome -EDTA2,2363,Chronic hypertensive nephropathy - histologically proven -EDTA2,2359,Chronic hypertensive nephropathy - no histology -EDTA2,3564,Chronic kidney disease (CKD) / chronic renal failure (CRF) - aetiology uncertain / unknown - histologically proven -EDTA2,3555,Chronic kidney disease (CKD) / chronic renal failure (CRF) - aetiology uncertain / unknown - no histology -EDTA2,3529,Chronic kidney disease (CKD) / chronic renal failure (CRF) caused by tumour nephrectomy -EDTA2,3540,Chronic kidney disease (CKD) / chronic renal failure (CRF) due to donor nephrectomy -EDTA2,3538,Chronic kidney disease (CKD) / chronic renal failure (CRF) due to traumatic loss of kidney -EDTA2,3708,Chronic renal failure -EDTA2,3643,Chronic renal failure due to systemic infection -EDTA2,2203,Chronic urate nephropathy - histologically proven -EDTA2,3636,Chronic urate nephropathy - no histology -EDTA2,1440,Churg-Strauss syndrome - histologically proven -EDTA2,1438,Churg-Strauss syndrome - no histology -EDTA2,1625,Congenital dysplasia / hypoplasia -EDTA2,2652,Congenital haemolytic uraemic syndrome (HUS) -EDTA2,1088,Congenital nephrotic syndrome (CNS) - congenital infection -EDTA2,1057,Congenital nephrotic syndrome (CNS) - diffuse mesangial sclerosis -EDTA2,1042,Congenital nephrotic syndrome (CNS) - Finnish type - histologically proven -EDTA2,1035,Congenital nephrotic syndrome (CNS) - Finnish type - no histology -EDTA2,1061,Congenital nephrotic syndrome (CNS) - focal segmental glomerulosclerosis (FSGS) -EDTA2,1026,Congenital nephrotic syndrome (CNS) - no histology -EDTA2,1706,Congenital neurogenic bladder -EDTA2,1660,Congenital pelvi-ureteric junction obstruction -EDTA2,1673,Congenital vesico-ureteric junction obstruction -EDTA2,1570,Cryoglobulinaemia secondary to hepatitis C - histologically proven -EDTA2,1562,Cryoglobulinaemia secondary to hepatitis C - no histology -EDTA2,1591,Cryoglobulinaemia secondary to systemic disease - histologically proven -EDTA2,1589,Cryoglobulinaemia secondary to systemic disease - no histology -EDTA2,2794,Cystic kidney disease -EDTA2,2964,Cystinosis -EDTA2,2955,Cystinuria -EDTA2,2929,Dent disease -EDTA2,1074,Denys-Drash syndrome -EDTA2,2328,Diabetic nephropathy in type I diabetes - histologically proven -EDTA2,2316,Diabetic nephropathy in type I diabetes - no histology -EDTA2,2344,Diabetic nephropathy in type II diabetes - histologically proven -EDTA2,2337,Diabetic nephropathy in type II diabetes - no histology -EDTA2,1331,Diffuse endocapillary glomerulonephritis -EDTA2,3028,Distal renal tubular acidosis (RTA) - type I -EDTA2,3037,Distal renal tubular acidosis with sensorineural deafness - gene mutations -EDTA2,2005,Drug-induced tubulointerstitial nephritis - no histology -EDTA2,2014,Drug-induced tubulointerstitial nephritis - histologically proven -EDTA2,2005,Drug-induced tubulointerstitial nephritis - no histology -EDTA2,1641,Dysplasia due to fetal ACE-inhibitor exposure -EDTA2,1850,Enteric hyperoxaluria -EDTA2,1558,Essential mixed cryoglobulinaemia - histologically proven -EDTA2,1543,Essential mixed cryoglobulinaemia - no histology -EDTA2,3230,Fabry disease - histologically proven -EDTA2,3224,Fabry disease - no histology -EDTA2,2566,Familial AA amyloid secondary to familial Mediterranean fever / TRAPS (Hibernian fever) - histologically proven -EDTA2,2550,Familial AA amyloid secondary to familial Mediterranean fever / TRAPS (Hibernian fever) - no histology -EDTA2,2545,Familial amyloid secondary to protein mutations - histologically proven -EDTA2,2532,Familial amyloid secondary to protein mutations - no histology -EDTA2,1308,Familial focal segmental glomerulosclerosis (FSGS) - autosomal dominant - histologically proven -EDTA2,1298,Familial focal segmental glomerulosclerosis (FSGS) - autosomal dominant - no histology -EDTA2,1280,Familial focal segmental glomerulosclerosis (FSGS) - autosomal recessive - histologically proven -EDTA2,1279,Familial focal segmental glomerulosclerosis (FSGS) - autosomal recessive - no histology -EDTA2,2668,Familial haemolytic uraemic syndrome (HUS) -EDTA2,3173,Familial hypercalciuric hypocalcaemia -EDTA2,3160,Familial hypocalciuric hypercalcaemia -EDTA2,3187,Familial hypomagnesaemia -EDTA2,1144,Familial IgA nephropathy - histologically proven -EDTA2,1137,Familial IgA nephropathy - no histology -EDTA2,1911,Familial interstitial nephropathy - histologically proven -EDTA2,1907,Familial interstitial nephropathy - no histology -EDTA2,3379,Familial nephropathy -EDTA2,1618,Familial reflux nephropathy -EDTA2,2675,Familial thrombotic thrombocytopenic purpura (TTP) -EDTA2,2453,Fibromuscular dysplasia of renal artery -EDTA2,1354,Focal and segmental proliferative glomerulonephritis -EDTA2,3754,Focal segmental glomerulosclerosis (FSGS) secondary to HIV -EDTA2,3765,Focal segmental glomerulosclerosis (FSGS) secondary to lithium -EDTA2,1320,Focal segmental glomerulosclerosis (FSGS) secondary to obesity - histologically proven -EDTA2,1312,Focal segmental glomerulosclerosis (FSGS) secondary to obesity - no histology -EDTA2,3777,Focal segmental glomerulosclerosis (FSGS) secondary to sickle cell -EDTA2,3314,Frasier syndrome -EDTA2,3092,Gitelman syndrome -EDTA2,1656,Glomerulocystic disease -EDTA2,1377,Glomerulonephritis - histologically indeterminate -EDTA2,3749,Glomerulonephritis - no histology -EDTA2,1365,Glomerulonephritis - secondary to other systemic disease -EDTA2,1365,Glomerulonephritis - secondary to systemic disease -EDTA2,3125,Glucocorticoid suppressible hyperaldosteronism -EDTA2,1417,Granulomatosis with polyangiitis - histologically proven -EDTA2,1401,Granulomatosis with polyangiitis - no histology -EDTA2,3572,Haematuria and proteinuria - no histology -EDTA2,2610,Haemolytic uraemic syndrome (HUS) - diarrhoea associated -EDTA2,2647,Haemolytic uraemic syndrome (HUS) secondary to systemic disease -EDTA2,2257,Hantavirus nephropathy -EDTA2,1515,Henoch-Schönlein purpura / nephritis - histologically proven -EDTA2,1504,Henoch-Schönlein purpura / nephritis - no histology -EDTA2,2495,Hepatorenal syndrome -EDTA2,3305,Horse-shoe kidney -EDTA2,3662,Hypercalcaemic nephropathy -EDTA2,2993,Hypophosphataemic rickets autosomal recessive (AR) -EDTA2,2986,Hypophosphataemic rickets X-linked (XL) -EDTA2,1251,Idiopathic rapidly progressive (crescentic) glomerulonephritis -EDTA2,1813,Idiopathic retroperitoneal fibrosis -EDTA2,1128,IgA nephropathy - histologically proven -EDTA2,1116,IgA nephropathy - no histology -EDTA2,1163,IgA nephropathy secondary to liver cirrhosis - histologically proven -EDTA2,1159,IgA nephropathy secondary to liver cirrhosis - no histology -EDTA2,1171,IgM - associated nephropathy -EDTA2,2606,Immunotactoid / fibrillary nephropathy -EDTA2,3823,Infiltration by lymphoma - histologically proven -EDTA2,3139,Inherited / genetic diabetes mellitus type II -EDTA2,2940,Inherited aminoaciduria -EDTA2,2972,Inherited renal glycosuria -EDTA2,2407,Ischaemic nephropathy - no histology -EDTA2,2411,Ischaemic nephropathy / microvascular disease - histologically proven -EDTA2,3712,Isolated haematuria - no histology -EDTA2,3720,Isolated proteinuria - no histology -EDTA2,3810,Kidney stones due to ARPT deficiency -EDTA2,3461,Kidney tumour -EDTA2,3351,Lawrence-Moon-Biedl / Bardet-Biedl syndrome -EDTA2,2177,Lead induced nephropathy - histologically proven -EDTA2,2165,Lead induced nephropathy - no histology -EDTA2,2242,Leptospirosis -EDTA2,3059,Lesch Nyhan syndrome - hypoxanthine guanine phosphoribosyl transferase deficiency -EDTA2,3102,Liddle syndrome -EDTA2,2597,Light chain deposition disease -EDTA2,2938,Lowe syndrome (oculocerebrorenal syndrome) -EDTA2,1866,Magnesium ammonium phosphate (struvite) urolithiasis -EDTA2,2385,Malignant hypertensive nephropathy / accelerated hypertensive nephropathy - histologically proven -EDTA2,2371,Malignant hypertensive nephropathy / accelerated hypertensive nephropathy - no histology -EDTA2,2804,Medullary cystic kidney disease type I -EDTA2,2815,Medullary cystic kidney disease type II -EDTA2,3295,Medullary sponge kidneys -EDTA2,1723,Megacystis-megaureter -EDTA2,1205,Membranous nephropathy - drug induced -EDTA2,1185,Membranous nephropathy - idiopathic -EDTA2,1214,Membranous nephropathy - infection associated -EDTA2,1192,Membranous nephropathy - malignancy associated -EDTA2,1349,Mesangial proliferative glomerulonephritis -EDTA2,1222,Mesangiocapillary glomerulonephritis type 1 -EDTA2,1233,Mesangiocapillary glomerulonephritis type 2 (dense deposit disease) -EDTA2,1246,Mesangiocapillary glomerulonephritis type 3 -EDTA2,3501,Mesoblastic nephroma - histologically proven -EDTA2,1429,Microscopic polyangiitis - histologically proven -EDTA2,1100,Minimal change nephropathy - histologically proven -EDTA2,1090,Minimal change nephropathy - no histology -EDTA2,3367,Mitochondrial cytopathy -EDTA2,1639,Multicystic dysplastic kidneys -EDTA2,2584,Myeloma cast nephropathy - histologically proven -EDTA2,2578,Myeloma kidney - no histology -EDTA2,3253,Nail-patella syndrome -EDTA2,3044,Nephrogenic diabetes insipidus -EDTA2,2836,Nephronophthisis -EDTA2,2843,Nephronophthisis - type 1 (juvenile type) -EDTA2,2858,Nephronophthisis - type 2 (infantile type) -EDTA2,2862,Nephronophthisis - type 3 (adolescent type) -EDTA2,2870,Nephronophthisis - type 4 (juvenile type) -EDTA2,2889,Nephronophthisis - type 5 -EDTA2,2891,Nephronophthisis - type 6 -EDTA2,2098,Nephropathy due to aminoglycosides - histologically proven -EDTA2,2080,Nephropathy due to aminoglycosides - no histology -EDTA2,2112,Nephropathy due to amphotericin - histologically proven -EDTA2,2108,Nephropathy due to amphotericin - no histology -EDTA2,2033,Nephropathy due to analgesic drugs - histologically proven -EDTA2,2022,Nephropathy due to analgesic drugs - no histology -EDTA2,2051,Nephropathy due to ciclosporin - histologically proven -EDTA2,2046,Nephropathy due to ciclosporin - no histology -EDTA2,2131,Nephropathy due to cisplatin - histologically proven -EDTA2,2120,Nephropathy due to cisplatin - no histology -EDTA2,2154,Nephropathy due to lithium - histologically proven -EDTA2,2149,Nephropathy due to lithium - no histology -EDTA2,2681,Nephropathy due to eclampsia -EDTA2,3834,Nephropathy due to pre- eclampsia -EDTA2,2079,Nephropathy due to tacrolimus - histologically proven -EDTA2,2067,Nephropathy due to tacrolimus - no histology -EDTA2,2288,Nephropathy related to HIV - histologically proven -EDTA2,2274,Nephropathy related to HIV - no histology -EDTA2,3615,Nephrotic syndrome of childhood - no trial of steroids - no histology -EDTA2,3604,Nephrotic syndrome of childhood - steroid resistant - no histology -EDTA2,1019,Nephrotic syndrome of childhood - steroid sensitive - no histology -EDTA2,1799,Obstructive nephropathy due to bladder cancer -EDTA2,1809,Obstructive nephropathy due to other malignancies -EDTA2,1781,Obstructive nephropathy due to prostate cancer -EDTA2,1775,Obstructive nephropathy due to prostatic hypertrophy -EDTA2,1734,Oligomeganephronia -EDTA2,2300,Other specific infection -EDTA2,3063,Phosphoribosyl pyrophosphate synthetase (PRPPS) superactivity -EDTA2,1455,Polyarteritis nodosa -EDTA2,1687,Posterior urethral valves -EDTA2,2901,Primary Fanconi syndrome -EDTA2,1267,Primary focal segmental glomerulosclerosis (FSGS) -EDTA2,3194,Primary hyperoxaluria -EDTA2,3207,Primary hyperoxaluria type I -EDTA2,3211,Primary hyperoxaluria type II -EDTA2,3731,Primary hyperoxaluria type III -EDTA2,1602,Primary reflux nephropathy - sporadic -EDTA2,3000,Primary renal tubular acidosis (RTA) -EDTA2,3016,Proximal renal tubular acidosis (RTA) - type II -EDTA2,3141,Pseudohypoaldosteronism type 1 -EDTA2,3156,Pseudohypoaldosteronism type 2 (Gordon syndrome) -EDTA2,2219,Radiation nephritis -EDTA2,2226,Renal / perinephric abscess -EDTA2,2509,Renal amyloidosis -EDTA2,2469,Renal arterial thrombosis / occlusion -EDTA2,2424,Renal artery stenosis -EDTA2,3474,Renal cell carcinoma - histologically proven -EDTA2,3658,Renal coloboma syndrome -EDTA2,3627,Renal cysts and diabetes syndrome -EDTA2,1641,Renal dysplasia due to fetal ACE-inhibitor exposure -EDTA2,3691,Renal failure -EDTA2,1747,Renal papillary necrosis -EDTA2,3796,Renal papillary necrosis caused by analgesics -EDTA2,3783,Renal papillary necrosis caused by diabetes -EDTA2,3806,Renal papillary necrosis caused by sickle cell -EDTA2,1976,Renal sarcoidosis - histologically proven -EDTA2,1969,Renal sarcoidosis - no histology -EDTA2,1536,Renal scleroderma / systemic sclerosis - histologically proven -EDTA2,1527,Renal scleroderma / systemic sclerosis - no histology -EDTA2,2235,Renal tuberculosis -EDTA2,2476,Renal vein thrombosis -EDTA2,3689,Retroperitoneal fibrosis secondary to drugs -EDTA2,1821,Retroperitoneal fibrosis secondary to malignancies -EDTA2,3670,Retroperitoneal fibrosis secondary to peri-aortitis -EDTA2,3269,Rubinstein-Taybi syndrome -EDTA2,2290,Schistosomiasis -EDTA2,2702,Sickle cell nephropathy - histologically proven -EDTA2,2699,Sickle cell nephropathy - no histology -EDTA2,3517,Single kidney identified in adulthood -EDTA2,1694,Syndrome of agenesis of abdominal muscles - prune belly syndrome -EDTA2,1493,Systemic lupus erythematosus / nephritis - histologically proven -EDTA2,1486,Systemic lupus erythematosus / nephritis - no histology -EDTA2,1383,Systemic vasculitis - ANCA negative - histologically proven -EDTA2,3847,Systemic vasculitis - ANCA negative - no histology -EDTA2,3852,Systemic vasculitis - ANCA positive - histologically proven -EDTA2,1396,Systemic vasculitis - ANCA positive - no histology -EDTA2,2787,Thin basement membrane disease -EDTA2,2634,Thrombotic thrombocytopenic purpura (TTP) -EDTA2,3346,Townes-Brocks syndrome -EDTA2,3488,Transitional cell carcinoma - histologically proven -EDTA2,3276,Tuberous sclerosis -EDTA2,2917,Tubular disorder as part of inherited metabolic diseases -EDTA2,1897,Tubulointerstitial nephritis - histologically proven -EDTA2,1884,Tubulointerstitial nephritis - no histology -EDTA2,1930,Tubulointerstitial nephritis associated with autoimmune disease - histologically proven -EDTA2,1924,Tubulointerstitial nephritis associated with autoimmune disease - no histology -EDTA2,1953,Tubulointerstitial nephritis with uveitis (TINU) - histologically proven -EDTA2,1948,Tubulointerstitial nephritis with uveitis (TINU) - no histology -EDTA2,1878,Uric acid urolithiasis -EDTA2,2827,Uromodulin-associated nephropathy (familial juvenile hyperuricaemic nephropathy) -EDTA2,3282,Von Hippel-Lindau disease -EDTA2,3333,Williams syndrome -EDTA2,3490,Wilms tumour - histologically proven -EDTA2,3248,Xanthinuria -EDTA2,2261,Xanthogranulomatous pyelonephritis diff --git a/codes/code_lists/snomed.csv b/codes/code_lists/snomed.csv deleted file mode 100644 index 2b9e460..0000000 --- a/codes/code_lists/snomed.csv +++ /dev/null @@ -1,232 +0,0 @@ -SNOMED,52254009,Nephrotic syndrome -SNOMED,445119005,Steroid sensitive nephrotic syndrome of childhood -SNOMED,48796009,Congenital nephrotic syndrome -SNOMED,197601003,Finnish congenital nephrotic syndrome -SNOMED,722369003,Congenital nephrotic syndrome -SNOMED,236384008,Congenital nephrotic syndrome with focal glomerulosclerosis -SNOMED,236385009,Drash syndrome -SNOMED,722118005,Congenital nephrotic syndrome -SNOMED,44785005,Minimal change disease -SNOMED,236407003,IgA nephropathy -SNOMED,445404003,Familial immunoglobulin A nephropathy -SNOMED,282364005,IgA nephropathy associated with liver disease -SNOMED,236411009,IgM nephropathy -SNOMED,722119002,Idiopathic membranous glomerulonephritis -SNOMED,722086002,Membranous glomerulonephritis due to malignant neoplastic disease -SNOMED,722120008,Drug-induced membranous glomerulonephritis -SNOMED,722168002,Membranous glomerulonephritis with infectious disease -SNOMED,75888001,"Mesangiocapillary glomerulonephritis, type I " -SNOMED,722760002,"Mesangiocapillary glomerulonephritis, type II " -SNOMED,236409000,Mesangiocapillary glomerulonephritis type III -SNOMED,197697005, -SNOMED,236404005,Classical focal segmental glomerulosclerosis -SNOMED,445388002,Autosomal recessive focal segmental glomerulosclerosis -SNOMED,444977005,Autosomal dominant focal segmental glomerulosclerosis -SNOMED,1269761000000101,Focal segmental glomerulosclerosis (FSGS) secondary to obesity -SNOMED,3704008,Diffuse endocapillary proliferative glomerulonephritis -SNOMED,35546006,Mesangial proliferative glomerulonephritis -SNOMED,83866005,Focal AND segmental proliferative glomerulonephritis -SNOMED, 724599009,Systemic vasculitis - histologically proven -SNOMED,722191003,Antineutrophil cytoplasmic antibody positive vasculitis -SNOMED,195353004,Granulomatosis with polyangiitis -SNOMED,1144805008,Microscopic polyarteritis nodosa -SNOMED,82275008,EGPA - eosinophilic granulomatosis with polyangiitis -SNOMED,155441006,Polyarteritis nodosa -SNOMED,50581000,Goodpasture syndrome -SNOMED,68815009,Lupus nephritis -SNOMED,191306005,Henoch-Schönlein purpura -SNOMED,236502006,Renal involvement in scleroderma -SNOMED,239947001,Essential mixed cryoglobulinemia -SNOMED,128971000119101,Cryoglobulinemia due to chronic hepatitis C -SNOMED,30911005,Cryoglobulinemia -SNOMED,197764002,Non-obstructive reflux-associated chronic pyelonephritis -SNOMED,707208009,Familial non-obstructive reflux-associated chronic pyelonephritis -SNOMED,204949001,Renal dysplasia -SNOMED,737562008,Multicystic dysplastic kidney -SNOMED,710571007,Renal dysplasia due to fetal exposure to angiotensin converting enzyme inhibitor -SNOMED,253864004,"Familial hypoplastic, glomerulocystic kidney" -SNOMED,373584008,Congenital pelviureteric junction obstruction -SNOMED,373585009,Congenital ureterovesical obstruction -SNOMED,253900005,Congenital posterior urethral valves -SNOMED,5187006,Prune belly syndrome -SNOMED,445387007,Congenital neurogenic urinary bladder -SNOMED,61758007,Exstrophy of bladder sequence -SNOMED,253904001,Megacystis-megaureter syndrome -SNOMED,18417009,Oligomeganephronic hypoplasia of kidney -SNOMED,90241004,Papillary necrosis -SNOMED,86249007,Obstructive nephropathy -SNOMED,722078002,Obstructive nephropathy due to neurogenic bladder -SNOMED,722082000,Obstructive nephropathy due to benign prostatic hyperplasia -SNOMED,722081007,Obstructive nephropathy due to carcinoma of prostate -SNOMED,722089009,Obstructive nephropathy due to bladder cancer -SNOMED,722088001,Obstructive nephropathy due to malignancy -SNOMED,197808006,Idiopathic retroperitoneal fibrosis -SNOMED,236017004,Malignant retroperitoneal fibrosis -SNOMED,95566004,Urolithiasis -SNOMED,444717006,Calcium oxalate urolithiasis -SNOMED,37497004,Enteric hyperoxaluria -SNOMED,444690001,Magnesium ammonium phosphate urolithiasis -SNOMED,267441009,Uric acid urolithiasis -SNOMED,428255004,Tubulointerstitial nephritis -SNOMED,83923004,Familial interstitial nephritis -SNOMED,45927004,Immunologic mediated tubulointerstitial nephritis -SNOMED,418839003,Tubulointerstitial nephritis with uveitis syndrome -SNOMED,37061001,Granulomatous sarcoid nephropathy -SNOMED,717770008,Aristolochic acid nephropathy -SNOMED,439990003,Drug-induced tubulointerstitial nephritis -SNOMED,59400006,Analgesic nephropathy -SNOMED,704203009,Nephropathy induced by ciclosporin -SNOMED,704205002,Nephropathy induced by tacrolimus -SNOMED,704206001,Nephropathy induced by aminoglycosides -SNOMED,704055002,Nephropathy induced by amphotericin -SNOMED,53556002,Cis-platinum nephropathy -SNOMED,4390004,Lithium nephropathy -SNOMED,704204003,Nephropathy induced by lead -SNOMED,236496000,Acute urate nephropathy -SNOMED,7725007,Radiation nephritis -SNOMED,197772000,Renal abscess OR Perirenal abscess -SNOMED,44323002,Tuberculosis of kidney -SNOMED,77377001,Leptospirosis -SNOMED,716864001,Haemorrhagic fever with renal syndrome -SNOMED,38898003,Xanthogranulomatous pyelonephritis -SNOMED,713504001,HIV-associated nephropathy -SNOMED,236706006,Urinary schistosomiasis -SNOMED,40733004,Infectious disease -SNOMED,96441000119101,Chronic kidney disease due to type 1 diabetes mellitus -SNOMED,771000119108,Chronic kidney disease due to type 2 diabetes mellitus -SNOMED,38481006,Hypertensive renal disease -SNOMED,65443008,Malignant hypertensive renal disease -SNOMED,445108007,Age related reduction of renal function -SNOMED,710565001,Ischaemic nephropathy -SNOMED,302233006,Renal artery stenosis -SNOMED,51677000,Atheroembolism of renal arteries -SNOMED,783730009,Fibromuscular dysplasia of renal artery -SNOMED,236488005,Renal artery occlusion -SNOMED,15842009,Thrombosis of renal vein -SNOMED,445236007,Cardiorenal syndrome -SNOMED,51292008,Hepatorenal syndrome -SNOMED,48713002,Renal amyloidosis -SNOMED,274945004,AA amyloidosis -SNOMED,23132008,AL amyloidosis -SNOMED,66451004,Familial renal amyloidosis -SNOMED,367528006,Amyloid of familial Mediterranean fever -SNOMED,32278006,Myeloma kidney -SNOMED,373604002,Light chain deposition disease -SNOMED,73305009,Fibrillary glomerulonephritis -SNOMED,373421000,Diarrhea-associated hemolytic uremic syndrome -SNOMED,373422007,Atypical haemolytic uraemic syndrome -SNOMED,78129009,Thrombotic thrombocytopenic purpura -SNOMED, 111407006,Hemolytic uremic syndrome -SNOMED,444976001,Congenital hemolytic uremic syndrome -SNOMED,722721004,Familial haemolytic-uraemic syndrome -SNOMED,373420004,Upshaw-Schulman syndrome -SNOMED,736993008,Nephropathy following eclampsia -SNOMED,13886001,Sickle cell nephropathy -SNOMED,765330003,Autosomal dominant polycystic kidney disease -SNOMED,253878003,Autosomal dominant polycystic kidney disease type 1 -SNOMED,253879006,Autosomal dominant polycystic kidney disease type 2 -SNOMED,28770003,Autosomal recessive polycystic kidney disease -SNOMED,770414008,Alport syndrome -SNOMED,236418003,Thin basement membrane disease -SNOMED, 722223000,Cystic kidney disease -SNOMED,726017001,Medullary cystic kidney disease type 1 -SNOMED,723373006,Medullary cystic kidney disease type 2 -SNOMED,46785007,Familial juvenile hyperuricaemia nephropathy -SNOMED,204958008,Nephronophthisis -SNOMED,444830001,Familial juvenile nephronophthisis -SNOMED,444558002,Infantile nephronophthisis -SNOMED,444749006,Adolescent nephronophthisis -SNOMED,446989009,Juvenile nephronophthisis -SNOMED,446991001,Nephronophthisis type 5 -SNOMED,447335007,Nephronophthisis type 6 -SNOMED,236466005,Congenital Fanconi syndrome -SNOMED,197744007,Renal tubulo-interstitial disorders in metabolic diseases -SNOMED,444645005,Dent's disease -SNOMED,79385002,Lowe syndrome -SNOMED,698953004,Inherited aminoaciduria -SNOMED,85020001,Cystinuria -SNOMED,190681003,Cystinosis -SNOMED,226309007,Familial renal glucosuria -SNOMED,82236004,Familial x-linked hypophosphatemic vitamin D refractory rickets -SNOMED,726080006,Autosomal recessive hypophosphatemic vitamin D refractory rickets -SNOMED,1776003,Renal tubular acidosis -SNOMED,24790002,Proximal renal tubular acidosis -SNOMED,236461000,Distal renal tubular acidosis -SNOMED,722468005,Distal renal tubular acidosis with sensorineural hearing loss (SNHL) -SNOMED,111395007,Nephrogenic diabetes insipidus -SNOMED,10406007,Lesch-Nyhan syndrome -SNOMED,35759001,Phosphoribosyl pyrophosphate synthase superactivity -SNOMED,31742004,Alagille syndrome -SNOMED,707742001,Bartter syndrome -SNOMED,707756004,Gitelman syndrome -SNOMED,707747007,Liddle syndrome -SNOMED,237770005,Syndrome of apparent mineralocorticoid excess -SNOMED,237743003,Glucocorticoid-suppressible hyperaldosteronism -SNOMED,237604008,Diabetes mellitus autosomal dominant type II -SNOMED,43941006,"Pseudohypoaldosteronism, type 1 " -SNOMED,15689008,"Pseudohypoaldosteronism, type 2 " -SNOMED,237885008,Familial hypocalciuric hypercalcemia -SNOMED,711152006,Familial hypercalciuric hypocalcaemia -SNOMED,48655003,Isolated familial renal hypomagnesaemia -SNOMED,17901006,Primary hyperoxaluria -SNOMED,65520001,Primary hyperoxaluria type I -SNOMED,40951006,"Primary hyperoxaluria, type II " -SNOMED,16652001,Fabry's disease -SNOMED,190919008,Xanthinuria -SNOMED,22199006,Nail patella-like renal disease -SNOMED,45582004,Rubinstein-Taybi syndrome -SNOMED,7199000,Tuberous sclerosis syndrome -SNOMED,46659004,Von Hippel-Lindau syndrome -SNOMED,236443009,Medullary sponge kidney -SNOMED,41729002,Horseshoe kidney -SNOMED,445431000,Frasier syndrome -SNOMED,290006,Branchio-oto-renal syndrome -SNOMED,63247009,Williams syndrome -SNOMED,24750000,Townes-Brocks syndrome -SNOMED,5619004,Laurence-Moon syndrome -SNOMED,240096000,Mitochondrial cytopathy -SNOMED,236419006,Familial nephropathy -SNOMED,14669001,Acute kidney injury -SNOMED,1048451000000103,Acute kidney injury due to acute tubular necrosis due to hypovolaemia -SNOMED,1048481000000109,Acute kidney injury due to acute tubular necrosis due to circulatory failure -SNOMED,1048491000000106,Acute kidney injury due to acute tubular necrosis due to sepsis -SNOMED,23697004,Acute kidney injury due to rhabdomyolysis -SNOMED,236428007,Acute kidney injury due to nephrotoxicity -SNOMED,444794000,Acute cortical necrosis -SNOMED,36689008,Acute pyelonephritis -SNOMED,126880001,Neoplasm of kidney -SNOMED,702391001,Renal cell carcinoma -SNOMED,408642003,Transitional cell carcinoma of kidney -SNOMED,302849000,Nephroblastoma -SNOMED,307604008,Mesoblastic nephroma -SNOMED,824131000000108,Solitary kidney -SNOMED,722149000,Chronic kidney disease (CKD) caused by tumour nephrectomy -SNOMED,722467000,Chronic kidney disease due to traumatic loss of kidney -SNOMED,722098007,Chronic kidney disease after donor nephrectomy -SNOMED,709044004,Chronic kidney disease - aetiology uncertain / unknown -SNOMED,449820008,Steroid resistant nephrotic syndrome of childhood -SNOMED,705065000,Childhood nephrotic syndrome -SNOMED,609572000,Renal cysts and diabetes syndrome -SNOMED,190829000,Chronic urate nephropathy -SNOMED,722150000,Chronic kidney disease due to systemic infection -SNOMED,446449009,Renal coloboma syndrome -SNOMED,33763006,Hypercalcemic nephropathy -SNOMED,49120005,Retroperitoneal fibrosis -SNOMED,236015007,Drug-induced retroperitoneal fibrosis -SNOMED,42399005,Renal failure syndrome -SNOMED,90688005,Chronic renal failure syndrome -SNOMED,53298003,Hematuria -SNOMED,53298000,Hematuria syndrome -SNOMED,12491000132101,Proteinuria -SNOMED,734990008,"Primary hyperoxaluria, type III " -SNOMED,36171008,Glomerulonephritis -SNOMED, 713887002,Focal segmental glomerulosclerosis co-occurrent with human immunodeficiency virus infection -SNOMED, 722139003,Focal segmental glomerulosclerosis caused by lithium -SNOMED,722147003,Focal segmental glomerulosclerosis due to sickle cell disease -SNOMED,723074006,Renal papillary necrosis due to diabetes mellitus -SNOMED,722077007,Renal papillary necrosis caused by analgesic drug -SNOMED, 722085003,Renal papillary necrosis due to sickle cell disease -SNOMED, 95570007,Kidney stone -SNOMED,118600007,Malignant lymphoma  -SNOMED,736992003,Nephropathy following pre-eclampsia -SNOMED,6956008,Systemic Vasculitis diff --git a/codes/code_mappings/edta2_to_snomed.csv b/codes/code_mappings/edta2_to_snomed.csv deleted file mode 100644 index a59e02e..0000000 --- a/codes/code_mappings/edta2_to_snomed.csv +++ /dev/null @@ -1,283 +0,0 @@ -EDTA2,1003,SNOMED,52254009 -EDTA2,1019,SNOMED,445119005 -EDTA2,1026,SNOMED,48796009 -EDTA2,1035,SNOMED,197601003 -EDTA2,1042,SNOMED,197601003 -EDTA2,1057,SNOMED,722369003 -EDTA2,1061,SNOMED,236384008 -EDTA2,1074,SNOMED,236385009 -EDTA2,1088,SNOMED,722118005 -EDTA2,1090,SNOMED,44785005 -EDTA2,1100,SNOMED,44785005 -EDTA2,1116,SNOMED,236407003 -EDTA2,1128,SNOMED,236407003 -EDTA2,1137,SNOMED,445404003 -EDTA2,1144,SNOMED,445404003 -EDTA2,1159,SNOMED,282364005 -EDTA2,1163,SNOMED,282364005 -EDTA2,1171,SNOMED,236411009 -EDTA2,1185,SNOMED,722119002 -EDTA2,1192,SNOMED,722086002 -EDTA2,1205,SNOMED,722120008 -EDTA2,1214,SNOMED,722168002 -EDTA2,1222,SNOMED,75888001 -EDTA2,1233,SNOMED,722760002 -EDTA2,1246,SNOMED,236409000 -EDTA2,1251,SNOMED,197697005 -EDTA2,1267,SNOMED,236404005 -EDTA2,1279,SNOMED,445388002 -EDTA2,1280,SNOMED,445388002 -EDTA2,1298,SNOMED,444977005 -EDTA2,1308,SNOMED,444977005 -EDTA2,1312,SNOMED,1269761000000101 -EDTA2,1320,SNOMED,1269761000000101 -EDTA2,1331,SNOMED,3704008 -EDTA2,1349,SNOMED,35546006 -EDTA2,1354,SNOMED,83866005 -EDTA2,1365,SNOMED,36171008 -EDTA2,1377,SNOMED, 36171008 -EDTA2,1383,SNOMED, 724599009 -EDTA2,1396,SNOMED,722191003 -EDTA2,1401,SNOMED,195353004 -EDTA2,1417,SNOMED,195353004 -EDTA2,1429,SNOMED,1144805008 -EDTA2,1438,SNOMED,82275008 -EDTA2,1440,SNOMED,82275008 -EDTA2,1455,SNOMED,155441006 -EDTA2,1464,SNOMED,50581000 -EDTA2,1472,SNOMED,50581000 -EDTA2,1486,SNOMED,68815009 -EDTA2,1493,SNOMED,68815009 -EDTA2,1504,SNOMED,191306005 -EDTA2,1515,SNOMED,191306005 -EDTA2,1527,SNOMED,236502006 -EDTA2,1536,SNOMED,236502006 -EDTA2,1543,SNOMED,239947001 -EDTA2,1558,SNOMED,239947001 -EDTA2,1562,SNOMED,128971000119101 -EDTA2,1570,SNOMED,128971000119101 -EDTA2,1589,SNOMED,30911005 -EDTA2,1591,SNOMED,30911005 -EDTA2,1602,SNOMED,197764002 -EDTA2,1618,SNOMED,707208009 -EDTA2,1625,SNOMED,204949001 -EDTA2,1639,SNOMED,737562008 -EDTA2,1641,SNOMED,710571007 -EDTA2,1656,SNOMED,253864004 -EDTA2,1660,SNOMED,373584008 -EDTA2,1673,SNOMED,373585009 -EDTA2,1687,SNOMED,253900005 -EDTA2,1694,SNOMED,5187006 -EDTA2,1706,SNOMED,445387007 -EDTA2,1710,SNOMED,61758007 -EDTA2,1723,SNOMED,253904001 -EDTA2,1734,SNOMED,18417009 -EDTA2,1747,SNOMED,90241004 -EDTA2,1752,SNOMED,86249007 -EDTA2,1768,SNOMED,722078002 -EDTA2,1775,SNOMED,722082000 -EDTA2,1781,SNOMED,722081007 -EDTA2,1799,SNOMED,722089009 -EDTA2,1809,SNOMED,722088001 -EDTA2,1813,SNOMED,197808006 -EDTA2,1821,SNOMED,236017004 -EDTA2,1832,SNOMED,95566004 -EDTA2,1845,SNOMED,444717006 -EDTA2,1850,SNOMED,37497004 -EDTA2,1866,SNOMED,444690001 -EDTA2,1878,SNOMED,267441009 -EDTA2,1884,SNOMED,428255004 -EDTA2,1897,SNOMED,428255004 -EDTA2,1907,SNOMED,83923004 -EDTA2,1911,SNOMED,83923004 -EDTA2,1924,SNOMED,45927004 -EDTA2,1930,SNOMED,45927004 -EDTA2,1948,SNOMED,418839003 -EDTA2,1953,SNOMED,418839003 -EDTA2,1969,SNOMED,37061001 -EDTA2,1976,SNOMED,37061001 -EDTA2,1982,SNOMED,717770008 -EDTA2,1995,SNOMED,717770008 -EDTA2,2005,SNOMED,439990003 -EDTA2,2014,SNOMED,439990003 -EDTA2,2022,SNOMED,59400006 -EDTA2,2033,SNOMED,59400006 -EDTA2,2046,SNOMED,704203009 -EDTA2,2051,SNOMED,704203009 -EDTA2,2067,SNOMED,704205002 -EDTA2,2079,SNOMED,704205002 -EDTA2,2080,SNOMED,704206001 -EDTA2,2098,SNOMED,704206001 -EDTA2,2108,SNOMED,704055002 -EDTA2,2112,SNOMED,704055002 -EDTA2,2120,SNOMED,53556002 -EDTA2,2131,SNOMED,53556002 -EDTA2,2149,SNOMED,4390004 -EDTA2,2154,SNOMED,4390004 -EDTA2,2165,SNOMED,704204003 -EDTA2,2177,SNOMED,704204003 -EDTA2,2183,SNOMED,236496000 -EDTA2,2196,SNOMED,236496000 -EDTA2,2203,SNOMED,190829000 -EDTA2,2219,SNOMED,7725007 -EDTA2,2226,SNOMED,197772000 -EDTA2,2235,SNOMED,44323002 -EDTA2,2242,SNOMED,77377001 -EDTA2,2257,SNOMED,716864001 -EDTA2,2261,SNOMED,38898003 -EDTA2,2274,SNOMED,713504001 -EDTA2,2288,SNOMED,713504001 -EDTA2,2290,SNOMED,236706006 -EDTA2,2300,SNOMED,40733004 -EDTA2,2316,SNOMED,96441000119101 -EDTA2,2328,SNOMED,96441000119101 -EDTA2,2337,SNOMED,771000119108 -EDTA2,2344,SNOMED,771000119108 -EDTA2,2359,SNOMED,38481006 -EDTA2,2363,SNOMED,38481006 -EDTA2,2371,SNOMED,65443008 -EDTA2,2385,SNOMED,65443008 -EDTA2,2392,SNOMED,445108007 -EDTA2,2407,SNOMED,710565001 -EDTA2,2411,SNOMED,710565001 -EDTA2,2424,SNOMED,302233006 -EDTA2,2430,SNOMED,51677000 -EDTA2,2448,SNOMED,51677000 -EDTA2,2453,SNOMED,783730009 -EDTA2,2469,SNOMED,236488005 -EDTA2,2476,SNOMED,15842009 -EDTA2,2482,SNOMED,445236007 -EDTA2,2495,SNOMED,51292008 -EDTA2,2509,SNOMED,48713002 -EDTA2,2513,SNOMED,274945004 -EDTA2,2521,SNOMED,23132008 -EDTA2,2532,SNOMED,66451004 -EDTA2,2545,SNOMED,66451004 -EDTA2,2550,SNOMED,367528006 -EDTA2,2566,SNOMED,367528006 -EDTA2,2578,SNOMED,32278006 -EDTA2,2584,SNOMED,32278006 -EDTA2,2597,SNOMED,373604002 -EDTA2,2606,SNOMED,73305009 -EDTA2,2610,SNOMED,373421000 -EDTA2,2623,SNOMED,373422007 -EDTA2,2634,SNOMED,78129009 -EDTA2,2647,SNOMED, 111407006 -EDTA2,2652,SNOMED,444976001 -EDTA2,2668,SNOMED,722721004 -EDTA2,2675,SNOMED,373420004 -EDTA2,2681,SNOMED,736993008 -EDTA2,2699,SNOMED,13886001 -EDTA2,2702,SNOMED,13886001 -EDTA2,2718,SNOMED,765330003 -EDTA2,2725,SNOMED,253878003 -EDTA2,2739,SNOMED,253879006 -EDTA2,2741,SNOMED,28770003 -EDTA2,2756,SNOMED,770414008 -EDTA2,2760,SNOMED,770414008 -EDTA2,2773,SNOMED,236418003 -EDTA2,2787,SNOMED,236418003 -EDTA2,2794,SNOMED, 722223000 -EDTA2,2804,SNOMED,726017001 -EDTA2,2815,SNOMED,723373006 -EDTA2,2827,SNOMED,46785007 -EDTA2,2836,SNOMED,204958008 -EDTA2,2843,SNOMED,444830001 -EDTA2,2858,SNOMED,444558002 -EDTA2,2862,SNOMED,444749006 -EDTA2,2870,SNOMED,446989009 -EDTA2,2889,SNOMED,446991001 -EDTA2,2891,SNOMED,447335007 -EDTA2,2901,SNOMED,236466005 -EDTA2,2917,SNOMED,197744007 -EDTA2,2929,SNOMED,444645005 -EDTA2,2938,SNOMED,79385002 -EDTA2,2940,SNOMED,698953004 -EDTA2,2955,SNOMED,85020001 -EDTA2,2964,SNOMED,190681003 -EDTA2,2972,SNOMED,226309007 -EDTA2,2986,SNOMED,82236004 -EDTA2,2993,SNOMED,726080006 -EDTA2,3000,SNOMED,1776003 -EDTA2,3016,SNOMED,24790002 -EDTA2,3028,SNOMED,236461000 -EDTA2,3037,SNOMED,722468005 -EDTA2,3044,SNOMED,111395007 -EDTA2,3059,SNOMED,10406007 -EDTA2,3063,SNOMED,35759001 -EDTA2,3071,SNOMED,31742004 -EDTA2,3085,SNOMED,707742001 -EDTA2,3092,SNOMED,707756004 -EDTA2,3102,SNOMED,707747007 -EDTA2,3118,SNOMED,237770005 -EDTA2,3125,SNOMED,237743003 -EDTA2,3139,SNOMED,237604008 -EDTA2,3141,SNOMED,43941006 -EDTA2,3156,SNOMED,15689008 -EDTA2,3160,SNOMED,237885008 -EDTA2,3173,SNOMED,711152006 -EDTA2,3187,SNOMED,48655003 -EDTA2,3194,SNOMED,17901006 -EDTA2,3207,SNOMED,65520001 -EDTA2,3211,SNOMED,40951006 -EDTA2,3224,SNOMED,16652001 -EDTA2,3230,SNOMED,16652001 -EDTA2,3248,SNOMED,190919008 -EDTA2,3253,SNOMED,22199006 -EDTA2,3269,SNOMED,45582004 -EDTA2,3276,SNOMED,7199000 -EDTA2,3282,SNOMED,46659004 -EDTA2,3295,SNOMED,236443009 -EDTA2,3305,SNOMED,41729002 -EDTA2,3314,SNOMED,445431000 -EDTA2,3322,SNOMED,290006 -EDTA2,3333,SNOMED,63247009 -EDTA2,3346,SNOMED,24750000 -EDTA2,3351,SNOMED,5619004 -EDTA2,3367,SNOMED,240096000 -EDTA2,3379,SNOMED,236419006 -EDTA2,3380,SNOMED,14669001 -EDTA2,3398,SNOMED,1048451000000103 -EDTA2,3403,SNOMED,1048481000000109 -EDTA2,3419,SNOMED,1048491000000106 -EDTA2,3426,SNOMED,23697004 -EDTA2,3435,SNOMED,236428007 -EDTA2,3442,SNOMED,444794000 -EDTA2,3457,SNOMED,36689008 -EDTA2,3461,SNOMED,126880001 -EDTA2,3474,SNOMED,702391001 -EDTA2,3488,SNOMED,408642003 -EDTA2,3490,SNOMED,302849000 -EDTA2,3501,SNOMED,307604008 -EDTA2,3517,SNOMED,824131000000108 -EDTA2,3529,SNOMED,722149000 -EDTA2,3538,SNOMED,722467000 -EDTA2,3540,SNOMED,722098007 -EDTA2,3555,SNOMED,709044004 -EDTA2,3564,SNOMED,709044004 -EDTA2,3604,SNOMED,449820008 -EDTA2,3615,SNOMED,705065000 -EDTA2,3627,SNOMED,609572000 -EDTA2,3636,SNOMED,190829000 -EDTA2,3643,SNOMED,722150000 -EDTA2,3658,SNOMED,446449009 -EDTA2,3662,SNOMED,33763006 -EDTA2,3670,SNOMED,49120005 -EDTA2,3689,SNOMED,236015007 -EDTA2,3691,SNOMED,42399005 -EDTA2,3708,SNOMED,90688005 -EDTA2,3712,SNOMED,53298000 -EDTA2,3720,SNOMED,12491000132101 -EDTA2,3731,SNOMED,734990008 -EDTA2,3749,SNOMED,36171008 -EDTA2,3754,SNOMED, 713887002 -EDTA2,3765,SNOMED, 722139003 -EDTA2,3777,SNOMED,722147003 -EDTA2,3783,SNOMED,723074006 -EDTA2,3796,SNOMED,722077007 -EDTA2,3806,SNOMED, 722085003 -EDTA2,3810,SNOMED, 95570007 -EDTA2,3823,SNOMED,118600007 -EDTA2,3834,SNOMED,736992003 -EDTA2,3847,SNOMED,6956008 -EDTA2,3852,SNOMED,6956008 diff --git a/codes/code_mappings/snomed_to_edta2.csv b/codes/code_mappings/snomed_to_edta2.csv deleted file mode 100644 index 9cb0e70..0000000 --- a/codes/code_mappings/snomed_to_edta2.csv +++ /dev/null @@ -1,234 +0,0 @@ -SNOMED,52254009,EDTA2,1003 -SNOMED,445119005,EDTA2,1019 -SNOMED,48796009,EDTA2,1026 -SNOMED,197601003,EDTA2,1035 -SNOMED,722369003,EDTA2,1057 -SNOMED,236384008,EDTA2,1061 -SNOMED,236385009,EDTA2,1074 -SNOMED,722118005,EDTA2,1088 -SNOMED,44785005,EDTA2,1090 -SNOMED,236407003,EDTA2,1116 -SNOMED,445404003,EDTA2,1137 -SNOMED,282364005,EDTA2,1159 -SNOMED,236411009,EDTA2,1171 -SNOMED,722119002,EDTA2,1185 -SNOMED,722086002,EDTA2,1192 -SNOMED,722120008,EDTA2,1205 -SNOMED,722168002,EDTA2,1214 -SNOMED,75888001,EDTA2,1222 -SNOMED,722760002,EDTA2,1233 -SNOMED,236409000,EDTA2,1246 -SNOMED,197697005,EDTA2,1251 -SNOMED,236404005,EDTA2,1267 -SNOMED,445388002,EDTA2,1279 -SNOMED,444977005,EDTA2,1298 -SNOMED,1269761000000101,EDTA2,1312 -SNOMED,3704008,EDTA2,1331 -SNOMED,35546006,EDTA2,1349 -SNOMED,83866005,EDTA2,1354 -SNOMED, 36171008,EDTA2,1377 -SNOMED, 724599009,EDTA2,1383 -SNOMED,722191003,EDTA2,1396 -SNOMED,195353004,EDTA2,1401 -SNOMED,1144805008,EDTA2,1429 -SNOMED,82275008,EDTA2,1438 -SNOMED,155441006,EDTA2,1455 -SNOMED,50581000,EDTA2,1464 -SNOMED,68815009,EDTA2,1486 -SNOMED,191306005,EDTA2,1504 -SNOMED,236502006,EDTA2,1527 -SNOMED,239947001,EDTA2,1543 -SNOMED,128971000119101,EDTA2,1562 -SNOMED,30911005,EDTA2,1589 -SNOMED,197764002,EDTA2,1602 -SNOMED,707208009,EDTA2,1618 -SNOMED,204949001,EDTA2,1625 -SNOMED,737562008,EDTA2,1639 -SNOMED,710571007,EDTA2,1641 -SNOMED,253864004,EDTA2,1656 -SNOMED,373584008,EDTA2,1660 -SNOMED,373585009,EDTA2,1673 -SNOMED,253900005,EDTA2,1687 -SNOMED,5187006,EDTA2,1694 -SNOMED,445387007,EDTA2,1706 -SNOMED,61758007,EDTA2,1710 -SNOMED,253904001,EDTA2,1723 -SNOMED,18417009,EDTA2,1734 -SNOMED,90241004,EDTA2,1747 -SNOMED,86249007,EDTA2,1752 -SNOMED,722078002,EDTA2,1768 -SNOMED,722082000,EDTA2,1775 -SNOMED,722081007,EDTA2,1781 -SNOMED,722089009,EDTA2,1799 -SNOMED,722088001,EDTA2,1809 -SNOMED,197808006,EDTA2,1813 -SNOMED,236017004,EDTA2,1821 -SNOMED,95566004,EDTA2,1832 -SNOMED,444717006,EDTA2,1845 -SNOMED,37497004,EDTA2,1850 -SNOMED,444690001,EDTA2,1866 -SNOMED,267441009,EDTA2,1878 -SNOMED,428255004,EDTA2,1884 -SNOMED,83923004,EDTA2,1907 -SNOMED,45927004,EDTA2,1924 -SNOMED,418839003,EDTA2,1948 -SNOMED,37061001,EDTA2,1969 -SNOMED,717770008,EDTA2,1982 -SNOMED,439990003,EDTA2,2005 -SNOMED,59400006,EDTA2,2022 -SNOMED,704203009,EDTA2,2046 -SNOMED,704205002,EDTA2,2067 -SNOMED,704206001,EDTA2,2080 -SNOMED,704055002,EDTA2,2108 -SNOMED,53556002,EDTA2,2120 -SNOMED,4390004,EDTA2,2149 -SNOMED,704204003,EDTA2,2165 -SNOMED,236496000,EDTA2,2183 -SNOMED,7725007,EDTA2,2219 -SNOMED,197772000,EDTA2,2226 -SNOMED,44323002,EDTA2,2235 -SNOMED,77377001,EDTA2,2242 -SNOMED,716864001,EDTA2,2257 -SNOMED,38898003,EDTA2,2261 -SNOMED,713504001,EDTA2,2274 -SNOMED,236706006,EDTA2,2290 -SNOMED,40733004,EDTA2,2300 -SNOMED,96441000119101,EDTA2,2316 -SNOMED,771000119108,EDTA2,2337 -SNOMED,38481006,EDTA2,2359 -SNOMED,65443008,EDTA2,2371 -SNOMED,445108007,EDTA2,2392 -SNOMED,710565001,EDTA2,2407 -SNOMED,302233006,EDTA2,2424 -SNOMED,51677000,EDTA2,2430 -SNOMED,783730009,EDTA2,2453 -SNOMED,236488005,EDTA2,2469 -SNOMED,15842009,EDTA2,2476 -SNOMED,445236007,EDTA2,2482 -SNOMED,51292008,EDTA2,2495 -SNOMED,48713002,EDTA2,2509 -SNOMED,274945004,EDTA2,2513 -SNOMED,23132008,EDTA2,2521 -SNOMED,66451004,EDTA2,2532 -SNOMED,367528006,EDTA2,2550 -SNOMED,32278006,EDTA2,2578 -SNOMED,373604002,EDTA2,2597 -SNOMED,73305009,EDTA2,2606 -SNOMED,373421000,EDTA2,2610 -SNOMED,373422007,EDTA2,2623 -SNOMED,78129009,EDTA2,2634 -SNOMED, 111407006,EDTA2,2647 -SNOMED,444976001,EDTA2,2652 -SNOMED,722721004,EDTA2,2668 -SNOMED,373420004,EDTA2,2675 -SNOMED,736993008,EDTA2,2681 -SNOMED,13886001,EDTA2,2699 -SNOMED,765330003,EDTA2,2718 -SNOMED,253878003,EDTA2,2725 -SNOMED,253879006,EDTA2,2739 -SNOMED,28770003,EDTA2,2741 -SNOMED,770414008,EDTA2,2756 -SNOMED,236418003,EDTA2,2787 -SNOMED, 722223000,EDTA2,2794 -SNOMED,726017001,EDTA2,2804 -SNOMED,723373006,EDTA2,2815 -SNOMED,46785007,EDTA2,2827 -SNOMED,204958008,EDTA2,2836 -SNOMED,444830001,EDTA2,2843 -SNOMED,444558002,EDTA2,2858 -SNOMED,444749006,EDTA2,2862 -SNOMED,446989009,EDTA2,2870 -SNOMED,446991001,EDTA2,2889 -SNOMED,447335007,EDTA2,2891 -SNOMED,236466005,EDTA2,2901 -SNOMED,197744007,EDTA2,2917 -SNOMED,444645005,EDTA2,2929 -SNOMED,79385002,EDTA2,2938 -SNOMED,698953004,EDTA2,2940 -SNOMED,85020001,EDTA2,2955 -SNOMED,190681003,EDTA2,2964 -SNOMED,226309007,EDTA2,2972 -SNOMED,82236004,EDTA2,2986 -SNOMED,726080006,EDTA2,2993 -SNOMED,1776003,EDTA2,3000 -SNOMED,24790002,EDTA2,3016 -SNOMED,236461000,EDTA2,3028 -SNOMED,722468005,EDTA2,3037 -SNOMED,111395007,EDTA2,3044 -SNOMED,10406007,EDTA2,3059 -SNOMED,35759001,EDTA2,3063 -SNOMED,31742004,EDTA2,3071 -SNOMED,707742001,EDTA2,3085 -SNOMED,707756004,EDTA2,3092 -SNOMED,707747007,EDTA2,3102 -SNOMED,237770005,EDTA2,3118 -SNOMED,237743003,EDTA2,3125 -SNOMED,237604008,EDTA2,3139 -SNOMED,43941006,EDTA2,3141 -SNOMED,15689008,EDTA2,3156 -SNOMED,237885008,EDTA2,3160 -SNOMED,711152006,EDTA2,3173 -SNOMED,48655003,EDTA2,3187 -SNOMED,17901006,EDTA2,3194 -SNOMED,65520001,EDTA2,3207 -SNOMED,40951006,EDTA2,3211 -SNOMED,16652001,EDTA2,3224 -SNOMED,190919008,EDTA2,3248 -SNOMED,22199006,EDTA2,3253 -SNOMED,45582004,EDTA2,3269 -SNOMED,7199000,EDTA2,3276 -SNOMED,46659004,EDTA2,3282 -SNOMED,236443009,EDTA2,3295 -SNOMED,41729002,EDTA2,3305 -SNOMED,445431000,EDTA2,3314 -SNOMED,290006,EDTA2,3322 -SNOMED,63247009,EDTA2,3333 -SNOMED,24750000,EDTA2,3346 -SNOMED,5619004,EDTA2,3351 -SNOMED,240096000,EDTA2,3367 -SNOMED,236419006,EDTA2,3379 -SNOMED,14669001,EDTA2,3380 -SNOMED,1048451000000103,EDTA2,3398 -SNOMED,1048481000000109,EDTA2,3403 -SNOMED,1048491000000106,EDTA2,3419 -SNOMED,23697004,EDTA2,3426 -SNOMED,236428007,EDTA2,3435 -SNOMED,444794000,EDTA2,3442 -SNOMED,36689008,EDTA2,3457 -SNOMED,126880001,EDTA2,3461 -SNOMED,702391001,EDTA2,3474 -SNOMED,408642003,EDTA2,3488 -SNOMED,302849000,EDTA2,3490 -SNOMED,307604008,EDTA2,3501 -SNOMED,824131000000108,EDTA2,3517 -SNOMED,722149000,EDTA2,3529 -SNOMED,722467000,EDTA2,3538 -SNOMED,722098007,EDTA2,3540 -SNOMED,709044004,EDTA2,3555 -SNOMED,34436003,EDTA2,3572 -SNOMED,29738008,EDTA2,3572 -SNOMED,449820008,EDTA2,3604 -SNOMED,705065000,EDTA2,3615 -SNOMED,609572000,EDTA2,3627 -SNOMED,190829000,EDTA2,3636 -SNOMED,722150000,EDTA2,3643 -SNOMED,446449009,EDTA2,3658 -SNOMED,33763006,EDTA2,3662 -SNOMED,49120005,EDTA2,3670 -SNOMED,236015007,EDTA2,3689 -SNOMED,42399005,EDTA2,3691 -SNOMED,90688005,EDTA2,3708 -SNOMED,53298000,EDTA2,3712 -SNOMED,12491000132101,EDTA2,3720 -SNOMED,734990008,EDTA2,3731 -SNOMED,36171008,EDTA2,3749 -SNOMED, 713887002,EDTA2,3754 -SNOMED, 722139003,EDTA2,3765 -SNOMED,722147003,EDTA2,3777 -SNOMED,723074006,EDTA2,3783 -SNOMED,722077007,EDTA2,3796 -SNOMED, 722085003,EDTA2,3806 -SNOMED, 95570007,EDTA2,3810 -SNOMED,118600007,EDTA2,3823 -SNOMED,736992003,EDTA2,3834 -SNOMED,6956008,EDTA2,3847 diff --git a/dataset/UKRR/v4/RR-Dataset-v4.2.xls b/dataset/UKRR/v4/UKRR DataSet v4_2_0.xls similarity index 99% rename from dataset/UKRR/v4/RR-Dataset-v4.2.xls rename to dataset/UKRR/v4/UKRR DataSet v4_2_0.xls index 04074ae..3cc6dae 100644 Binary files a/dataset/UKRR/v4/RR-Dataset-v4.2.xls and b/dataset/UKRR/v4/UKRR DataSet v4_2_0.xls differ diff --git a/dataset/UKRR/v5/CHANGELOG.md b/dataset/UKRR/v5/CHANGELOG.md new file mode 100644 index 0000000..eacbb35 --- /dev/null +++ b/dataset/UKRR/v5/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +## 5.0.0 - 2024-05-05 +### Added +- Initial Version + + > This is the version of the document that was distributed to sites/suppliers post-Consultation. + diff --git a/dataset/UKRR/v5/DataSet_v5_0_For Renal units.xlsx b/dataset/UKRR/v5/UKRR DataSet v5_0_0.xlsx similarity index 100% rename from dataset/UKRR/v5/DataSet_v5_0_For Renal units.xlsx rename to dataset/UKRR/v5/UKRR DataSet v5_0_0.xlsx diff --git a/docs_build/main.py b/docs_build/main.py index 81c58a5..d4521be 100644 --- a/docs_build/main.py +++ b/docs_build/main.py @@ -1,8 +1,10 @@ import os +import re import sys -import lxml.etree as ET -from typing import List from pathlib import Path +from typing import List + +import lxml.etree as ET in_path = Path(sys.argv[1]) out_path = Path(sys.argv[2]) @@ -13,6 +15,31 @@ xslt = ET.parse(xsl_path.as_posix()) transform = ET.XSLT(xslt) +type_paths = {} + + +def replace_strings(html_document, lookup_dict): + pattern = r'XXX(\w+)YYY' # Regular expression pattern to match XXXValueYYY + + if isinstance(html_document, bytes): + html_document = html_document.decode() + + def replace(match): + value = match.group(1) + + type_path = lookup_dict.get(value, None) + + if type_path: + replacement = f"Type: {value}" + else: + replacement = f"Type: {value}" + + return replacement + + replaced_html = re.sub(pattern, replace, html_document) + + return replaced_html + def make_index(title: str, dir_links: List[str], file_links: List[str]): file_links.sort() @@ -38,6 +65,32 @@ def make_index(title: str, dir_links: List[str], file_links: List[str]): content += "" return content +for path, dirs, files in os.walk(in_path): + + path_relative_to_base = Path(path).relative_to(in_path) + page_dir = out_path.joinpath(path_relative_to_base) + page_dir.mkdir(exist_ok=True) + + for xsd_file in [f for f in files if f.endswith(".xsd")]: + + in_file = Path(path).joinpath(xsd_file) + dom = ET.parse(in_file.as_posix()) + + namespace = "http://www.w3.org/2001/XMLSchema" + xpath_expr = "//xs:complexType/@name|//xs:simpleType/@name" + xsd_types = dom.xpath(xpath_expr, namespaces={"xs": namespace}) + + for xsd_type in xsd_types: + type_path = str(in_file).replace('schema/ukrdc/', '') + + type_path_list = type_path.split('/') + if len(type_path_list) > 1: + if type_path_list[0] == type_path_list[1]: + type_path = "/".join(type_path_list[1:]) + # HACK: This only fixes a specific case. + # type_path.replace('Types/Types/', 'Types/') + + type_paths[xsd_type] = str(type_path)[:-4] + ".html" for path, dirs, files in os.walk(in_path): @@ -62,9 +115,16 @@ def make_index(title: str, dir_links: List[str], file_links: List[str]): dom = ET.parse(in_file.as_posix()) newdom = transform(dom) + + html_string = ET.tostring(newdom, pretty_print=True) + + # TODO: This doesn't work if the definition is in a different + # file in the same folder as it's being used in. + # The replace function needs to take account of the current path. + html_string = replace_strings(html_string, type_paths) - with open(out_file, "wb") as html: - html.write(ET.tostring(newdom, pretty_print=True)) + with open(out_file, "w") as html_file: + html_file.write(html_string) index_path = out_path.joinpath(path_relative_to_base, "index.html") with open(index_path, "w") as html: diff --git a/docs_build/stylesheet.xsl b/docs_build/stylesheet.xsl index 205c39a..6d54ab4 100644 --- a/docs_build/stylesheet.xsl +++ b/docs_build/stylesheet.xsl @@ -1,5 +1,5 @@ - + + +
+ Should be submitted for: +
+
+
+
+
@@ -165,8 +173,11 @@ + + Type: + - + XXXYYY @@ -236,6 +247,7 @@ + @@ -245,8 +257,74 @@ + + Type: + - + XXXYYY +
+ + + + + + + + + +
@@ -352,6 +430,8 @@ + + diff --git a/pyxb_build/setup.py b/pyxb_build/setup.py index e28ac7b..81e789d 100644 --- a/pyxb_build/setup.py +++ b/pyxb_build/setup.py @@ -6,7 +6,7 @@ match_pat = r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]' version = re.search(match_pat, f.read(), re.MULTILINE).group(1) -data = {'ukrdc_schema': ['transforms/*.xsl'], } +data = {'ukrdc_schema': ['transforms/*.xsl', 'py.typed'], } setup( name='ukrdc_schema', version=version, diff --git a/pyxb_build/ukrdc_schema/__init__.py b/pyxb_build/ukrdc_schema/__init__.py index 3bc35c3..f0bddce 100644 --- a/pyxb_build/ukrdc_schema/__init__.py +++ b/pyxb_build/ukrdc_schema/__init__.py @@ -1 +1 @@ -__version__ = "3.4.5" +__version__ = "4.2.0" \ No newline at end of file diff --git a/pyxb_build/ukrdc_schema/py.typed b/pyxb_build/ukrdc_schema/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/sample_files/ukrdc/fullDemographics.xml b/sample_files/ukrdc/fullDemographics.xml index 5df0871..2b60c73 100644 --- a/sample_files/ukrdc/fullDemographics.xml +++ b/sample_files/ukrdc/fullDemographics.xml @@ -1,5 +1,5 @@ - ABC123 + ABC123 UKRDC diff --git a/sample_files/ukrdc/fullFile.xml b/sample_files/ukrdc/fullFile.xml index ba4e676..2c95a4e 100644 --- a/sample_files/ukrdc/fullFile.xml +++ b/sample_files/ukrdc/fullFile.xml @@ -1,5 +1,5 @@ - ABC123 + ABC123 UKRDC @@ -251,16 +251,16 @@ CF_RR23 l - Description61 + Litre Frequency0 Comments17 0 - CodingStandard62 - Code62 - Description62 + CF_RR23 + other + Other Indication0 EncounterNumber2 @@ -278,11 +278,6 @@ Haemodialysis 2006-05-04T18:13:51.0 - - ODS - ABC123 - Dr Foster - RR1+ ABC123 @@ -297,17 +292,7 @@ Code82 Description82 - - ODS - Code83 - Description83 - 2006-05-04T18:13:51.0 - - ODS - Code84 - Description84 - ODS Code85 @@ -324,11 +309,6 @@ PEX 2006-05-04T18:13:51.0 - - ODS - ABC123 - Dr Foster - RR1+ ABC123 @@ -344,11 +324,6 @@ Construction of arteriovenous fistula 2006-05-04T18:13:51.0 - - ODS - ABC123 - Dr Foster - RR1+ ABC123 diff --git a/sample_files/ukrdc/minimalDemographics.xml b/sample_files/ukrdc/minimalDemographics.xml index a10fe3d..ef6a0e3 100644 --- a/sample_files/ukrdc/minimalDemographics.xml +++ b/sample_files/ukrdc/minimalDemographics.xml @@ -1,5 +1,5 @@ - ABC123 + ABC123 UKRDC diff --git a/schema/rrtf/RRTF_4.xsd b/schema/rrtf/RRTF_4.xsd index e0289aa..edf6104 100644 --- a/schema/rrtf/RRTF_4.xsd +++ b/schema/rrtf/RRTF_4.xsd @@ -1688,6 +1688,116 @@ + + + + + + Non-melanoma skin cancer, BCC, SCC + + + + + + + Melanoma + + + + + + + Breast + + + + + + + Upper GI (oesophagus/stomach) + + + + + + + Lower GI (small/large bowel) + + + + + + + Lung + + + + + + + Urological NOT prostate + + + + + + + Prostate + + + + + + + Testicular + + + + + + + Leukaemia + + + + + + + Lymphoma + + + + + + + Myeloma + + + + + + + CNS Tumour + + + + + + + Musculo-skeletal + + + + + + + Other + + + + + + @@ -3593,6 +3703,37 @@ + + + + RR_DATE_FIRST_CKD1 + + + + + + RR_DATE_FIRST_CKD2 + + + + + + RR_DATE_FIRST_CKD3 + + + + + + RR_DATE_FIRST_CKD4 + + + + + + RR_DATE_FIRST_CKD5 + + + @@ -3654,14 +3795,12 @@ Pre dialysis Creatinine at 1st RRT / ERF treatment - - @@ -4073,7 +4212,7 @@ - + @@ -4970,6 +5109,8 @@ + + diff --git a/schema/ukrdc/Assessments/Assessment.xsd b/schema/ukrdc/Assessments/Assessment.xsd index be85eee..ede3e72 100644 --- a/schema/ukrdc/Assessments/Assessment.xsd +++ b/schema/ukrdc/Assessments/Assessment.xsd @@ -1,25 +1,33 @@ - - + + UKRRv5 + + - + + UKRRv5 + The Date the Assessment Started - + + UKRRv5 + The Date the Assessment Ended - + - + + UKRRv5 + Assessment Type @@ -27,7 +35,7 @@ - + @@ -50,7 +58,9 @@ - + + UKRRv5 + Assessment Outcome @@ -58,7 +68,7 @@ - + diff --git a/schema/ukrdc/CHANGELOG.md b/schema/ukrdc/CHANGELOG.md index c552a14..0641f0c 100644 --- a/schema/ukrdc/CHANGELOG.md +++ b/schema/ukrdc/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## 4.2.0 - 2024-02-26 +### Changed +- Restricted Treatment/VisitDescription to 255 characters +- Increased ResultItem/ResultValue to 30 characters +- Increased Observation/ObservationValue to 30 characters +- Amended Medication UoM to use CF_RR23 type. +- Remove EnteredBy from Procedure +- Allow Multiple PRD/CoD Records +- Make ObservationTime mandatory on ResultItem/Observation + +## 4.1.3 - 2023-12-22 +### Changed +- Remove maxOccurs from PatientNumbers to fix PyXB + +## 4.1.0 - 2023-08-13 +### Changed +- Added Missing EDTA2 PRD Codes +- Added Missing Admisssion Reason Codes +- Reduced Admission Reason Description to 100 characters to match database. +- Changed Mandatory fields in DialysisPrescription +- Modified Diagnosis to allow LOCAL/ICD-10 CodingStandards + ## 4.0.0 - 2023-06-13 ### Added - Assessment Element Type diff --git a/schema/ukrdc/Diagnoses/CauseOfDeath.xsd b/schema/ukrdc/Diagnoses/CauseOfDeath.xsd index f06b3ae..de49251 100644 --- a/schema/ukrdc/Diagnoses/CauseOfDeath.xsd +++ b/schema/ukrdc/Diagnoses/CauseOfDeath.xsd @@ -34,12 +34,6 @@ - - - - Clinician Coding Death - - diff --git a/schema/ukrdc/Diagnoses/Diagnosis.xsd b/schema/ukrdc/Diagnoses/Diagnosis.xsd index e2f5da1..9d4b055 100644 --- a/schema/ukrdc/Diagnoses/Diagnosis.xsd +++ b/schema/ukrdc/Diagnoses/Diagnosis.xsd @@ -1,7 +1,7 @@ - + @@ -21,7 +21,7 @@ National Clinicial code where possible or other local code if not. - + SNOMED CT coded diagnoses. This should also include any diagnosis that has been submitted elsewhere as a Primary Renal Diagnosis. diff --git a/schema/ukrdc/DialysisPrescriptions/DialysisPrescription.xsd b/schema/ukrdc/DialysisPrescriptions/DialysisPrescription.xsd index a19fed6..eefda60 100644 --- a/schema/ukrdc/DialysisPrescriptions/DialysisPrescription.xsd +++ b/schema/ukrdc/DialysisPrescriptions/DialysisPrescription.xsd @@ -1,7 +1,9 @@ - + + UKRRv5 + @@ -11,7 +13,7 @@ The date the Dialysis Prescription was created. - + Time the Period the Dialysis Prescription Applies To Starts @@ -23,25 +25,25 @@ Time the Period the Dialysis Prescription Applies To Ends - + Session Type (Same as QHD41) - + Number of Dialysis Sessions per Week - + Time Dialysed (Minutes) - + Vascular Access to Use (QHD20) diff --git a/schema/ukrdc/DialysisSessions/DialysisSession.xsd b/schema/ukrdc/DialysisSessions/DialysisSession.xsd index 797d50c..7c77fc6 100644 --- a/schema/ukrdc/DialysisSessions/DialysisSession.xsd +++ b/schema/ukrdc/DialysisSessions/DialysisSession.xsd @@ -20,7 +20,7 @@ - + Symptomatic hypotension (QHD19) @@ -32,7 +32,7 @@ - + Vascular Access Site (QHD21) diff --git a/schema/ukrdc/Encounters/Treatment.xsd b/schema/ukrdc/Encounters/Treatment.xsd index 482ed03..19a5c07 100644 --- a/schema/ukrdc/Encounters/Treatment.xsd +++ b/schema/ukrdc/Encounters/Treatment.xsd @@ -75,12 +75,17 @@ National code for the hospital providing care - e.g. RXF01 - + Free text about the Treatment record. + + + + + diff --git a/schema/ukrdc/LabOrders/LabOrder.xsd b/schema/ukrdc/LabOrders/LabOrder.xsd index 6526c0f..67fafcf 100644 --- a/schema/ukrdc/LabOrders/LabOrder.xsd +++ b/schema/ukrdc/LabOrders/LabOrder.xsd @@ -10,8 +10,10 @@ - - + + + + @@ -22,23 +24,27 @@ - + + UKRRv4,UKRRv5,PKB,RADAR + - + + UKRRv4,UKRRv5,PKB,RADAR + Location or Facility receiving/performing the order. - laborder.placerid + UKRRv4,UKRRv5,PKB,RADAR - ORC:2 Placer's Order Id + ORC:2 Placer (Hospital)'s Order Id @@ -48,8 +54,10 @@ - - + + + UKRRv4,UKRRv5,PKB,RADAR + ORC:3 Filler (Lab)'s Order Id @@ -58,9 +66,19 @@ + + + + UKRRv4,UKRRv5,PKB,RADAR + + Requesting Location (as in Hospital, GP, etc.) + + - + + UKRRv4,UKRRv5,PKB,RADAR + OBR:4 Service Id - the identity of the test ordered. @@ -68,14 +86,18 @@ - + + UKRRv4,UKRRv5,PKB,RADAR + OBR:22 - + + UKRRv4,UKRRv5,PKB,RADAR + OBR:14 @@ -143,7 +165,9 @@ - + + UKRRv4,UKRRv5,PKB,RADAR + @@ -166,7 +190,10 @@ - + + UKRRv4,UKRRv5,PKB,RADAR + + Was the sample taken PRE or POST dialysis @@ -196,6 +223,9 @@ + + UKRRv4,UKRRv5,PKB,RADAR + Test Code (OBX:3) @@ -212,18 +242,24 @@ - + + UKRRv4,UKRRv5,PKB,RADAR + + OBX:5 - + - + + UKRRv4,UKRRv5,PKB,RADAR + + OBX:6 @@ -234,7 +270,9 @@ - + + UKRRv4,UKRRv5,PKB,RADAR + OBX:7 @@ -245,7 +283,10 @@ - + + UKRRv4,UKRRv5,PKB,RADAR + + Interpretation Codes (OBX:8) @@ -293,7 +334,7 @@ - + OBX:14 diff --git a/schema/ukrdc/Medications/Medication.xsd b/schema/ukrdc/Medications/Medication.xsd index 135da58..4ace4a8 100644 --- a/schema/ukrdc/Medications/Medication.xsd +++ b/schema/ukrdc/Medications/Medication.xsd @@ -1,4 +1,5 @@ + @@ -107,7 +108,7 @@ Dose - + diff --git a/schema/ukrdc/Observations/Observation.xsd b/schema/ukrdc/Observations/Observation.xsd index bc44a25..bbaa7ad 100644 --- a/schema/ukrdc/Observations/Observation.xsd +++ b/schema/ukrdc/Observations/Observation.xsd @@ -17,7 +17,7 @@ - + @@ -77,7 +77,7 @@ - + diff --git a/schema/ukrdc/Patient.xsd b/schema/ukrdc/Patient.xsd index 0bdb42b..338f72a 100644 --- a/schema/ukrdc/Patient.xsd +++ b/schema/ukrdc/Patient.xsd @@ -12,15 +12,21 @@ + - Every Patient should have one MRN type PatientNumber. This should be the primary identifier for the Patient in the sending system and typically not change. If a National Identifier (such as NHS Number) is used as the MRN it should also be submitted as an NI type PatientNumber. - + + UKRRv4,UKRRv5 + + Patient Numbers + + Names + @@ -31,6 +37,9 @@ + + Addresses + diff --git a/schema/ukrdc/Procedures/Procedure.xsd b/schema/ukrdc/Procedures/Procedure.xsd index d2eac97..b1a79d4 100644 --- a/schema/ukrdc/Procedures/Procedure.xsd +++ b/schema/ukrdc/Procedures/Procedure.xsd @@ -11,25 +11,16 @@ - At least code must be entered - The time the Procedure started. - - - - Person entering the diagnosis as a National Clinicial code where possible or other local code if not. - - - Location the procedure was performed at. Use National coding e.g. RXF01 diff --git a/schema/ukrdc/README.md b/schema/ukrdc/README.md index c803c69..b31d7e5 100644 --- a/schema/ukrdc/README.md +++ b/schema/ukrdc/README.md @@ -6,7 +6,7 @@ [Schema Documentation](https://renalregistry.atlassian.net/wiki/spaces/UD/overview) -[File Transfer Instructions](https://renalregistry.atlassian.net/wiki/spaces/UD/pages/2044133823/UKRDC+File+Transmission) +[Building a Renal Unit to UKRDC Feed](https://renalregistry.atlassian.net/wiki/spaces/UD/pages/2383118357/Building+a+Renal+Unit+to+UKRDC+Feed) ## Technical References diff --git a/schema/ukrdc/Types/Address.xsd b/schema/ukrdc/Types/Address.xsd index 4d3d3d5..a4b2864 100644 --- a/schema/ukrdc/Types/Address.xsd +++ b/schema/ukrdc/Types/Address.xsd @@ -52,14 +52,14 @@ - + - + diff --git a/schema/ukrdc/Types/CF_EDTA_PRD.xsd b/schema/ukrdc/Types/CF_EDTA_PRD.xsd index 3132814..5e504d6 100644 --- a/schema/ukrdc/Types/CF_EDTA_PRD.xsd +++ b/schema/ukrdc/Types/CF_EDTA_PRD.xsd @@ -1705,6 +1705,51 @@ Glomerulonephritis - No Histology + + + Focal segmental glomerulosclerosis (FSGS) secondary to HIV + + + + + Focal segmental glomerulosclerosis (FSGS) secondary to lithium + + + + + Focal segmental glomerulosclerosis (FSGS) secondary to sickle cell + + + + + Renal papillary necrosis caused by diabetes + + + + + Renal papillary necrosis caused by analgesics + + + + + Renal papillary necrosis caused by sickle cell + + + + + Kidney stones due to ARPT deficiency + + + + + Infiltration by lymphoma - histologically proven + + + + + Nephropathy due to pre-eclampsia + + Systemic vasculitis - ANCA negative - no histology @@ -2857,7 +2902,7 @@ -  Chronic kidney disease following excision of renal neoplasm (disorder) + Chronic kidney disease following excision of renal neoplasm (disorder) diff --git a/schema/ukrdc/Types/CF_RR7_Discharge.xsd b/schema/ukrdc/Types/CF_RR7_Discharge.xsd index f7f12d5..7efef3b 100644 --- a/schema/ukrdc/Types/CF_RR7_Discharge.xsd +++ b/schema/ukrdc/Types/CF_RR7_Discharge.xsd @@ -63,7 +63,7 @@ - + diff --git a/schema/ukrdc/Types/CF_RR7_Treatment.xsd b/schema/ukrdc/Types/CF_RR7_Treatment.xsd index bdc3980..eca1478 100644 --- a/schema/ukrdc/Types/CF_RR7_Treatment.xsd +++ b/schema/ukrdc/Types/CF_RR7_Treatment.xsd @@ -106,18 +106,16 @@ Acute Kidney Injury - Peritoneal Dialysis - + - Acute Kidney Injury - RRT not provided by renal service + Acute Kidney Injury receiving RRT not by renal service - First Assessment by Renal Service - Conservative Management - Mutual decision not to offer RRT @@ -163,6 +161,26 @@ CKD (Not on RRT) + + + Patient - ESKD with no RRT + + + + + Patient - CKD-advanced MDT clinic + + + + + Patient - CKD-clinic follow-up + + + + + Patient - CKD-remote monitoring + + @@ -255,7 +273,7 @@ - + diff --git a/schema/ukrdc/Types/DiagnosisCodeType.xsd b/schema/ukrdc/Types/DiagnosisCodeType.xsd new file mode 100644 index 0000000..41496d4 --- /dev/null +++ b/schema/ukrdc/Types/DiagnosisCodeType.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schema/ukrdc/Types/RRTypes.xsd b/schema/ukrdc/Types/RRTypes.xsd index 825859a..2b6cb89 100644 --- a/schema/ukrdc/Types/RRTypes.xsd +++ b/schema/ukrdc/Types/RRTypes.xsd @@ -1,5 +1,14 @@ + + + UKRDC Schema Version in 0.0.0 Format + + + + + + diff --git a/schema/ukrdc/Types/SendingFacility.xsd b/schema/ukrdc/Types/SendingFacility.xsd new file mode 100644 index 0000000..c04bb1c --- /dev/null +++ b/schema/ukrdc/Types/SendingFacility.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + This should be a reference for the System / Version which generated the file. The intended purpose is to allow us to identify, or temporarily rectify, issues with what a particular extract is generating. + + + + + This should be the time that the extract was generated. + + + + + This should be the version (from the XSD Schema) that the extract has been written against. This is to allow us to process incoming files accordingly as well as track which Units are submitting which version. Note that the RDA Schema version is unrelated to the UKRR Dataset version. + + + + + The batch number as used in the filenames. This should be incremented each time the extract is run, not per-patient + + + + + + \ No newline at end of file diff --git a/schema/ukrdc/UKRDC.xsd b/schema/ukrdc/UKRDC.xsd index 15648fe..4f86a46 100644 --- a/schema/ukrdc/UKRDC.xsd +++ b/schema/ukrdc/UKRDC.xsd @@ -1,12 +1,13 @@ - + + - + @@ -23,52 +24,70 @@ + + - - - - - - + - - - - - - - - - - + + + + ALL + + + The value of this element is the Site or System responsible for the data being sent. + + + + + + + ALL + + + The type of data feed. This is used to enable different behaviour when the original source of data was something other than a UKRDC feed (i.e. when "PV XML" is converted to "RDA XML" it is given a SendingExtract of "PV"). Unless told otherwise the value should be set to "UKRDC". + + - + - The extract process within the facility which produced this file. + + ALL + + Patient Demographics - - + - Lab Orders. These are measurements taken about a patient that have been processed by a Laboratory. Our EHR structure requires that all test results are associated with a lab order. If the details of the lab order are not received by the renal system then a generic lab order should be created to contain all results with a common sample time. + + UKRRv4,UKRRv5,PKB,RADAR + Test + + Lab Orders - + - Other Health Related Behaviours. + + NONE + + Other Health Related Behaviours - + - This is used to record information about conditions diagnosed in the Patient's relatives. This element should not be submitted without prior discussion with the UKRR + + NONE + + Family Histories @@ -78,12 +97,22 @@ - Observations. These are measurements taken about a patient that do not involve a Laboratory. + + UKRRv4,UKRRv5,PKB,RADAR + + + Observations. These are measurements taken about a patient that do not involve a Laboratory. + - Allergies + + NONE + + + Allergies. + @@ -96,18 +125,26 @@ + + UKRRv4,UKRRv5,PKB,RADAR + Co-Morbidities - + + + UKRRv4,UKRRv5,RADAR + Cause of Death - + - Primary Renal Diagnosis. These should be used to record the Primary Renal Disease (defined in the ERA-EDTA PRD spreadsheet, notes for users, sections: 'Description of PRD' and 'Selection of the most appropriate PRD' http://www.era-edta-reg.org/prd.jsp ) for analysis by the UKRR, SRR and ERA. In order for the data to be comparable across countries it needs to be coded in using the EDTA code lists. Consequently we expect that some conditions may appear both as PRD objects and as generic diagnoses coded in SNOMED. Patients who started RRT after 01/01/2014 should be coded using the 2012 "EDTA2" code list. Patients who started before then can continue to be submitted using the older EDTA list. Systems should not automatically convert the older codes to the newer ones as this results in a loss of accuracy. - + + UKRRv4,UKRRv5,PKB,RADAR + + Renal Diagnoses @@ -115,7 +152,10 @@ - Medications. All recorded medications should be submitted whether or not prescribed for the purposes of renal care. + + UKRRv4,UKRRv5,PKB,RADAR + + Medications @@ -125,6 +165,9 @@ + + UKRRv5 + Dialysis Prescriptions @@ -141,19 +184,35 @@ - - + + + NONE + + Procedures (not otherwise Specified) + + + + + + UKRRv4,UKRRv5 + Dialysis Sessions - Transplant Procedures.These should be used to record any Transplants. A single Procedure should be recorded for each organ being transplanted, with multiple organ transplants being identified by multiple transplants occurring on the same day. The record also contains information about the source donor for each transplant. + + UKRRv4,UKRRv5,PKB + + Transplant Procedures + + UKRRv4 + Vascular Access Constructions @@ -162,6 +221,9 @@ + + PKB + Documents @@ -175,16 +237,25 @@ + + PKB + This is used to record the duration of something other than a Treatment. This element should not be submitted without prior discussion with the UKRR. + + UKRRv4,UKRRv5,PKB + This is used to record the duration a Patient received a particular type of Care/Treatment at a particular Treatment Facility. It is similar in concept to the UKRR TXT records however at the end of the period it should be end-dated rather than an additional record being sent. It is possible for treatment records to overlap if a patient has multiple treatments (such as post-transplant dialysis). A treatment record should exist for any period of time where they would be considered a patient (so for example code 900 record for pre-RRT CKD and a code 94 record for post-RRT Conservative care). Details of Transplants themselves should be recorded as Procedures but Treatment records should be used to record periods of Transplant related Inpatient/Outpatient care. + + NHSBT + This is only for NHSBT supplied Transplant Waiting List data. @@ -193,7 +264,12 @@ - Program Memberships. These are used to record whether or not a patient wishes to participate in one of the UKRDC’s member projects. In the case of projects such as RADAR the Program Membership record should only be closed if the patient actively wishes to withdraw. It should not be end dated when they leave the unit or die. If a patient decides to leave a project and then re-joins a new Program Membership record should be created (with a different ExternalID) rather than re-opening the original one. + + NONE + + + Program Memberships. These are used to record whether or not a patient wishes to participate in one of the UKRDC’s member projects. In the case of projects such as RADAR the Program Membership record should only be closed if the patient actively wishes to withdraw. It should not be end dated when they leave the unit or die. If a patient decides to leave a project and then re-joins a new Program Membership record should be created (with a different ExternalID) rather than re-opening the original one. + @@ -203,6 +279,9 @@ + + UKRRv4,UKRRv5 + Opt-Outs @@ -213,6 +292,9 @@ + + NONE + This is used to record the relationship between a Patient and a Clinician or Care Facility. This element should not be submitted without prior discussion with the UKRR. @@ -223,6 +305,9 @@ + + NONE + Surveys @@ -231,9 +316,26 @@ + + + + NONE + + Assessments + + + + + + + - This is used internally to hold data items sent in PV XML files and should not be sent by external parties. + + PKB + + + This is used internally to hold data items sent in PV XML files and should not be sent by external parties. diff --git a/scripts/code_importer.py b/scripts/code_importer.py new file mode 100644 index 0000000..850e2e6 --- /dev/null +++ b/scripts/code_importer.py @@ -0,0 +1,236 @@ +import csv +import argparse +import sys +import os + +import psycopg2 + +from ukrdc.database import Connection + + +class CodeUpdater(object): + def upload(self): + for row in self.rows: + self.add_row(row) + self.connection.commit() + + @property + def connection(self): + return self._connection + + @connection.setter + def connection(self, connection): + self._connection = connection + self.cursor = connection.cursor() + + def insert(self, sql, row): + try: + self.cursor.execute(sql, (row)) + except psycopg2.IntegrityError as e: + self.connection.rollback() + print("Problem with integrity " + str(e)) + except Exception: + print(sql) + print(row) + raise + + def select(self, sql, row): + try: + self.cursor.execute(sql, (row)) + return list(self.cursor.fetchall()) + except psycopg2.Error as e: + print(e) + + +class CodeList(CodeUpdater): + def __init__(self): + self.rows = [] + + def truncate(self): + sqlstring = """ + TRUNCATE TABLE CODE_LIST + """ + self.cursor.execute(sqlstring) + self.connection.commit() + + def get_row(self, *args): + sql = """ + select + coding_standard, code, description, object_type + from + extract.code_list + where + coding_standard = %s and + code = %s and + description = %s and + object_type = %s + """ + return self.insert(sql, args) + + def update(self): + for row in self.rows: + results = self.get_row(row) + if results: + print("Yes we have that row") + else: + self.update_row(row[0], row[1], row) + + def add_row(self, row): + sqlstring = """ + INSERT INTO CODE_LIST + ( + CODING_STANDARD, + CODE, + DESCRIPTION, + OBJECT_TYPE, + UNITS + ) + VALUES (%s, %s, %s, %s, %s) + """ + self.insert(sqlstring, row) + + def read_csv(self): + base_folder = "conf/pv2_codes/code_lists/" + + for filename in os.listdir(base_folder): + print(f"Reading {filename}") + fp = os.path.join(base_folder, filename) + csvreader = csv.reader(open(fp, "r", encoding="utf-8")) + + for row in csvreader: + # Get Row to expected length + row = list(row)[:5] + diff_len = 5 - len(row) + if diff_len > 0: + row = row + [None] * diff_len + if row[0] == "": + print("Empty Row, continue") + continue + self.rows.append(row) + + +class CodeMap(CodeUpdater): + def __init__(self): + self.rows = [] + + def truncate(self): + + sqlstring = """ + TRUNCATE TABLE CODE_MAP + """ + self.cursor.execute(sqlstring) + self.connection.commit() + + def add_row(self, row): + sqlstring = """ + INSERT INTO CODE_MAP + ( + SOURCE_CODING_STANDARD, + SOURCE_CODE, + DESTINATION_CODING_STANDARD, + DESTINATION_CODE + ) + VALUES(%s, %s, %s, %s)""" + self.insert(sqlstring, row) + + def read_csv(self): + # Code Conv List + + base_folder = "conf/pv2_codes/code_conv_lists/" + + for filename in os.listdir(base_folder): + fp = os.path.join(base_folder, filename) + print(fp) + csvreader = csv.reader(open(fp, "r", encoding="utf-8")) + for row in csvreader: + self.rows.append(row) + + +class SatelliteMap(CodeUpdater): + def __init__(self): + self.rows = [] + + def truncate(self): + + sqlstring = """ + TRUNCATE TABLE SATELLITE_MAP + """ + self.cursor.execute(sqlstring) + self.connection.commit() + + def add_row(self, row): + sqlstring = """ + INSERT INTO SATELLITE_MAP + ( + SATELLITE_CODE, + MAIN_UNIT_CODE + ) + VALUES(%s, %s)""" + self.insert(sqlstring, row) + + def read_csv(self): + # Satellite Mapping List + + base_folder = "conf/pv2_codes/satellite_map/" + + for filename in os.listdir(base_folder): + + fp = os.path.join(base_folder, filename) + print(fp) + csvreader = csv.reader(open(fp, "r", encoding="utf-8")) + for row in csvreader: + self.rows.append(row) + + +def main(): + + servers = ["ukrdc_dev", "ukrdc_staging", "ukrdc_live"] + + parser = argparse.ArgumentParser(description="Update codes") + parser.add_argument("--server", nargs="+", default=servers) + parser.add_argument("--upload-codelist", action="store_true") + parser.add_argument("--upload-codemap", action="store_true") + parser.add_argument("--upload-satellitemap", action="store_true") + + if not len(sys.argv) > 1: + parser.print_help() + return + args = parser.parse_args() + if args.upload_codelist: + codelist = CodeList() + codelist.read_csv() + if args.upload_codemap: + codemap = CodeMap() + codemap.read_csv() + if args.upload_satellitemap: + satellitemap = SatelliteMap() + satellitemap.read_csv() + + for server in args.server: + print(f"server: {server}") + engine = Connection.get_engine_from_file(None, server) + connection = engine.raw_connection() + print("Connected") + if args.upload_codelist: + codelist.connection = connection + print("Truncating Code List") + codelist.truncate() + print("Populating Code List") + codelist.upload() + if args.upload_codemap: + codemap.connection = connection + print("Truncating Code Map") + codemap.truncate() + print("Populating Code Map") + codemap.upload() + if args.upload_satellitemap: + satellitemap.connection = connection + print("Truncating Satellite Map") + satellitemap.truncate() + print("Uploading Satellite Map") + satellitemap.upload() + connection.close() + + +if __name__ == "__main__": + main() diff --git a/scripts/code_writer.py b/scripts/code_writer.py new file mode 100644 index 0000000..8722128 --- /dev/null +++ b/scripts/code_writer.py @@ -0,0 +1,67 @@ +# This script converts Shaun's XLS document +# Into 3 CSV files to match the table structure + +import csv +import itertools + + +def main(): + # Code List + + csvreader = csv.reader(open("C:/Temp/PV2_Test_harmonisation.csv", "r")) + + code_list = list() + code_conv_list = list() + unit_conv_list = list() + + next(csvreader) + for row in csvreader: + + test_code = row[0] + unit_code = row[1] + correct_test_code = row[3] + correct_unit_code = row[4] + record_type = row[5] + + # creatinine,µmol/l,68,creatinine,micromol/L,result, + + code_list.append(("PV", correct_test_code, None, record_type)) + if correct_test_code not in ("", None): + code_conv_list.append(("PVMIGRATION", test_code, "PV", correct_test_code)) + if correct_unit_code not in ("", None): + unit_conv_list.append(("PVMIGRATION", unit_code, "PV", correct_unit_code)) + + # Code List + code_list.sort() + code_list = list(code_list for code_list, _ in itertools.groupby(code_list)) + + csvwriter = csv.writer(open("C:/Temp/CodeList.csv", "w", newline="")) + + for row in code_list: + csvwriter.writerow(row) + + # Code Conv List + code_conv_list.sort() + code_conv_list = list( + code_conv_list for code_conv_list, _ in itertools.groupby(code_conv_list) + ) + + csvwriter = csv.writer(open("C:/Temp/CodeConvList.csv", "w", newline="")) + + for row in code_conv_list: + csvwriter.writerow(row) + + # Unit Conv List + unit_conv_list.sort() + unit_conv_list = list( + unit_conv_list for unit_conv_list, _ in itertools.groupby(unit_conv_list) + ) + + csvwriter = csv.writer(open("C:/Temp/UnitConvList.csv", "w", newline="")) + + for row in unit_conv_list: + csvwriter.writerow(row) + + +if __name__ == "__main__": + main() diff --git a/scripts/redis_code_importer.py b/scripts/redis_code_importer.py new file mode 100644 index 0000000..dcc5a1f --- /dev/null +++ b/scripts/redis_code_importer.py @@ -0,0 +1,148 @@ +import csv +import json +import os +from typing import Optional + +import redis +from sshtunnel import SSHTunnelForwarder + +from ukrdc.services.codes import Codes + +UKRDC_INSTANCE = "live_app_ssh" + +code_conv_list_path = "conf/pv2_codes/code_conv_lists/" +code_list_path = "conf/pv2_codes/code_lists/" +code_exclusion_path = "conf/pv2_codes/code_exclusions/" +satellite_map_path = "conf/pv2_codes/satellite_map/satellite_map.csv" + + +def import_codes(host: str, port: int): + r = redis.Redis(host=host, port=port, db=0) + + # Clear Existing Data + r.flushall() + + # Code Map + for filename in os.listdir(code_conv_list_path): + csvreader = csv.reader( + open(code_conv_list_path + filename, "r", newline="", encoding="utf-8") + ) + + print(f"Importing {filename}") + for row in csvreader: + source_coding_standard = row[0] + source_code = row[1] + destination_coding_standard = row[2] + destination_code = row[3] + + Codes().set_code_mapping_item( + r, + source_coding_standard, + source_code, + destination_coding_standard, + destination_code, + ) + + # Code List + for filename in os.listdir(code_list_path): + csvreader = csv.reader( + open(code_list_path + filename, "r", newline="", encoding="utf-8") + ) + + print(f"Importing {filename}") + for row in csvreader: + coding_standard = row[0] + try: + code = row[1] + except Exception: + print(filename) + print(row) + raise + + if len(row) >= 3: + description: Optional[str] = row[2] + else: + description = None + + if len(row) >= 4: + code_type: Optional[str] = row[3] + else: + code_type = None + + if len(row) >= 5: + units: Optional[str] = row[4] + else: + units = None + + key = "CODE_LIST:" + key += coding_standard + ":" + key += code + + if description: + r.hset(key, "description", description) + else: + r.hset(key, "description", code) + + if code_type: + r.hset(key, "code_type", code_type) + + if units: + r.hset(key, "units", units) + + # Code Exclusions + for filename in os.listdir(code_exclusion_path): + csvreader = csv.reader( + open(code_exclusion_path + filename, "r", newline="", encoding="utf-8") + ) + + for row in csvreader: + + coding_standard = row[0] + code = row[1] + system = row[2] + + Codes().set_code_exclusion(r, coding_standard, code, system) + + # Satellite Map + + csvreader = csv.reader(open(satellite_map_path, "r", newline="", encoding="utf-8")) + + for row in csvreader: + satellite_code = row[0] + main_unit_code = row[1] + + key = "SATELLITE_LIST:" + key += satellite_code + + r.set(key, main_unit_code) + + +if __name__ == "__main__": + + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument("--local", action="store_true") + + local: bool = parser.parse_args().local + + if local: + import_codes("localhost", 6379) + + else: + + fname = os.path.expanduser("~/.config/ukrdc/services/db_conf.json") + print("Configuration File: ", fname) + with open(fname) as fhandle: + params = json.load(fhandle) + + with SSHTunnelForwarder( + (params[UKRDC_INSTANCE]["HOST"], 22), + ssh_password=params[UKRDC_INSTANCE]["PASSWORD"], + ssh_username=params[UKRDC_INSTANCE]["USER"], + remote_bind_address=("localhost", 6379), + # Make an SSH Tunnel to Redis on the chosen App Server + ) as ukrdc_redis_tunnel: + host = "localhost" + port = ukrdc_redis_tunnel.local_bind_port + import_codes(host, port) diff --git a/scripts/run_schema_report.sh b/scripts/run_schema_report.sh deleted file mode 100644 index 631e240..0000000 --- a/scripts/run_schema_report.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -x -ssh -f -N -M -S /tmp/ukrdc_resources_socket root@10.38.181.121 -L 6000:db.ukrdc.nhs.uk:5432 -source env/bin/activate -pip install ukrdc-services -pip install ukrdc.database -pip install xlwt -pip install lxml -python scripts/schema_report.py -ssh -S /tmp/ukrdc_resources_socket -O exit xxx -exit 0 diff --git a/scripts/schema_report.py b/scripts/schema_report.py deleted file mode 100644 index 7712d05..0000000 --- a/scripts/schema_report.py +++ /dev/null @@ -1,340 +0,0 @@ -"""Produces an XLS Report comparing the UKRDC Schema to -the Repository Database""" - -import csv -import os - -from lxml import etree -import xlwt - -from ukrdc.database import Connection - -# NOTE: This may assume a PostgreSQL DB - - -def get_db_table_list(session): - sqlstring = """ - SELECT DISTINCT - A.table_name - FROM - information_schema.columns A - LEFT JOIN information_schema.tables B - ON A.table_name = B.table_name AND - A.table_schema = B.table_schema - WHERE - A.table_schema = 'extract' AND - B.table_type <> 'VIEW' - """ - - return [row[0] for row in session.execute(sqlstring)] - - -def get_db_column_metadata(session, tablename): - sqlstring = """ - SELECT - tab_columns.column_name, - data_type, - character_maximum_length, - numeric_precision, - is_nullable, - tab_constraints.constraint_type, - col_constraints.constraint_name, - col_check_constraints.check_clause - FROM - information_schema.columns AS tab_columns - LEFT OUTER JOIN - information_schema.constraint_column_usage AS col_constraints ON - tab_columns.table_name = col_constraints.table_name AND - tab_columns.column_name = col_constraints.column_name - LEFT OUTER JOIN - information_schema.table_constraints AS tab_constraints ON - tab_constraints.constraint_name = col_constraints.constraint_name - LEFT OUTER JOIN - information_schema.check_constraints AS col_check_constraints ON - col_check_constraints.constraint_name = tab_constraints.constraint_name - WHERE - tab_columns.table_name = :table_name AND - tab_columns.table_schema = 'extract' - ORDER BY ordinal_position; - """ - - results = session.execute(sqlstring, {"table_name": tablename}) - return results - - -def get_field_contents_stats(session, table_name, column_name): - - # We could add MAX/MIN/AVG here but it wouldn't make much sense - # As ResultValue/ObservationValue will be across all tests - - sql_string = ( - """ - SELECT - COUNT(*) AS ROW_COUNT, - SUM(CASE WHEN """ - + column_name - + """ IS NOT NULL THEN 1 ELSE 0 END) AS VALUE_COUNT, - COUNT(DISTINCT """ - + column_name - + """) AS DISTINCT_VALUE_COUNT - FROM - """ - + table_name - ) - - result = session.execute(sql_string) - return result.fetchone() - - -def get_coded_fields(session): - - sql_string = """ - SELECT - tab_columns.table_name, - tab_columns.column_name - FROM - information_schema.columns AS tab_columns - WHERE - tab_columns.column_name LIKE :column_name_like AND - tab_columns.table_schema = 'extract' - """ - - results = session.execute(sql_string, {"column_name_like": "%codestd"}) - return results - - -def query_coded_fields(session, table_name, column_name): - - # codestd - base_name = column_name[:-7] - - code_std_field = column_name - desc_field = base_name + "desc" - code_field = base_name + "code" - - sql_string = ( - """ - - SELECT - '""" - + table_name - + """', - '""" - + code_std_field - + """', - """ - + code_std_field - + """, - '""" - + code_field - + """', - """ - + code_field - + """, - '""" - + desc_field - + """', - """ - + desc_field - + """, - COUNT(*) - FROM - """ - + table_name - + """ - GROUP BY - """ - + code_std_field - + """, - """ - + code_field - + """, - """ - + desc_field - ) - - results = session.execute(sql_string) - return results - - -class DBMetadata(object): - def __init__(self, session, xsdpath): - self.session = session - self.xsdpath = xsdpath - - def set_db_metadata(self): - - db_metadata = dict() - - session = self.session - table_names = get_db_table_list(session) - - for table_name in table_names: - print(table_name) - db_metadata[table_name] = dict() - for row in get_db_column_metadata(session, table_name): - column_name = row[0] - field_stats = get_field_contents_stats(session, table_name, column_name) - row = list(row) - row.extend(field_stats) - db_metadata[table_name][column_name] = row - - self.db_metadata = db_metadata - - def process_xsd_file(self, fh): - ns = "http://www.w3.org/2001/XMLSchema" - xml_doc = etree.parse(fh) - appinfo_nodes = xml_doc.xpath("//xs:appinfo", namespaces={"xs": ns}) - xml_metadata = self.xml_metadata - for appinfo_node in appinfo_nodes: - appinfo_text = appinfo_node.text - # Assume value in format: - # table_name.column_name - split_appinfo_text = appinfo_text.split(".") - table_name = split_appinfo_text[0] - column_name = split_appinfo_text[1] - - try: - documentation_node = appinfo_node.xpath( - "following-sibling::xs:documentation", namespaces={"xs": ns} - )[-1] - except: # noqa: E722 - print("Error with", table_name, column_name) - continue - - documentation_text = documentation_node.text - - # NOTE: Here we go "up" from the documentation tag looking - # for the first element which doesn't match exclusions - # This may not be necessary and we might just be able to look - # for xs:element nodes. - element_node = appinfo_node.xpath( - "ancestor::*[not(self::xs:annotation)]", namespaces={"xs": ns} - )[-1] - xml_element_name = element_node.attrib["name"] - - xml_element_type = element_node.attrib.get("type", None) - - # If not present minOccurs default is 1 - xml_element_minoccurs = element_node.attrib.get("minOccurs", "1") - - xml_element_maxoccurs = element_node.attrib.get("maxOccurs", None) - - if table_name not in xml_metadata: - xml_metadata[table_name] = dict() - - xml_metadata[table_name][column_name] = ( - xml_element_name, - xml_element_type, - xml_element_minoccurs, - xml_element_maxoccurs, - documentation_text, - ) - - def set_xml_metadata(self): - self.xml_metadata = dict() - for root, dirs, files in os.walk(self.xsdpath, topdown=False): - for name in files: - if not name.endswith(".xsd"): - continue - fp = os.path.join(root, name) - with open(fp) as fh: - self.process_xsd_file(fh) - - def run(self): - self.set_db_metadata() - self.set_xml_metadata() - xml_metadata = self.xml_metadata - db_metadata = self.db_metadata - xml_md_keys = xml_metadata.keys() - for table_name in db_metadata.keys(): - if table_name not in xml_metadata: - continue - xml_md_table_keys = xml_metadata[table_name].keys() - for column_name in db_metadata[table_name].keys(): - extra = all( - (table_name in xml_md_keys, column_name in xml_md_table_keys) - ) - if extra: - # Add the extra XML columns if there's a match - db_column_data = db_metadata[table_name][column_name] - xml_column_data = xml_metadata[table_name][column_name] - db_column_data.extend(xml_column_data) - db_metadata[table_name][column_name] = db_column_data - - -def make_report(db_metadata, filepath): - - work_book = xlwt.Workbook() - fields = ( - "Column Name", - "Data Type", - "Max Length", - "Numeric Precision", - "Is Nullable", - "Constraint Type", - "Constraint Name", - "Check Clause", - "Row Count", - "Value Count", - "Distinct Value Count", - "XML Element Name", - "XML Type", - "XML MinOccurs", - "XML MaxOccurs", - "XML Description", - ) - for table_name in db_metadata.keys(): - work_sheet = work_book.add_sheet(table_name) - row = work_sheet.row(0) - - for x, header in enumerate(fields): - row.write(x, header) - - y = 1 - for column_name in db_metadata[table_name]: - field_row = db_metadata[table_name][column_name] - row = work_sheet.row(y) - for x, value in enumerate(field_row): - row.write(x, value) - y += 1 - work_book.save(filepath) - - -def make_coded_field_report(session, filepath): - - csvwriter = csv.writer(open(filepath, "w", newline="", encoding="utf-8")) - - csvwriter.writerow( - ( - "Table Name", - "Coding Std Field", - "Coding Std Value", - "Code Field", - "Code Value", - "Desc Field", - "Desc", - ) - ) - - coded_fields = get_coded_fields(session) - - for table_name, column_name in coded_fields: - print(table_name, column_name) - results = query_coded_fields(session, table_name, column_name) - for row in results: - csvwriter.writerow(row) - - -def main(): - xsd_path = "schema/ukrdc/" - sessionmaker = Connection.get_sessionmaker_from_file(key="ukrdc_live") - session = sessionmaker() - dbm = DBMetadata(session, xsd_path) - dbm.run() - make_report(dbm.db_metadata, "dataset_report.xls") - make_coded_field_report(session, "coded_field_report.csv") - - -if __name__ == "__main__": - main() diff --git a/xsdata_build/build.sh b/xsdata_build/build.sh index db870fc..2f4d6a0 100755 --- a/xsdata_build/build.sh +++ b/xsdata_build/build.sh @@ -1,3 +1,6 @@ xsdata ../schema/ukrdc/UKRDC.xsd --config .xsdata.xml --package ukrdc_xsdata.ukrdc xsdata ../schema/pv2/PV_2_0.xsd --config .xsdata.xml --package ukrdc_xsdata.pv xsdata ../schema/rrtf/RRTF_4.xsd --config .xsdata.xml --package ukrdc_xsdata.rrtf + +# Add py.typed to top-level package to enable type checking +touch ukrdc_xsdata/py.typed diff --git a/xsdata_build/setup.py b/xsdata_build/setup.py index 411658d..3f33540 100644 --- a/xsdata_build/setup.py +++ b/xsdata_build/setup.py @@ -1,13 +1,13 @@ -from setuptools import setup -from setuptools import find_packages from pathlib import Path +from setuptools import find_packages +from setuptools import setup # Read the contents of the README file long_description = (Path(__file__).parent / "README.md").read_text() setup( name="ukrdc-xsdata", - version="3.4.5", + version="4.2.0", long_description=long_description, long_description_content_type='text/markdown', author="UK Renal Registry",