diff --git a/.Rbuildignore b/.Rbuildignore index 6fa6fcd9..dd9378b5 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,20 +1,22 @@ -^renv$ -^renv\.lock$ -^Capr\.Rproj$ -^\.Rproj\.user$ -.github -deploy.sh -compare_versions -^doc$ -^Meta$ -^_pkgdown\.yml$ -^docs$ -^extras$ -^man-roxygen$ -^scratch$ -^work$ -^README\.Rmd$ -^pkgdown$ -^cran-comments\.md$ -^CRAN-SUBMISSION$ -^LICENSE\.md$ +^requirements\.txt$ +^renv$ +^renv\.lock$ +^Capr\.Rproj$ +^\.Rproj\.user$ +.github +deploy.sh +compare_versions +^doc$ +^Meta$ +^_pkgdown\.yml$ +^docs$ +^extras$ +^man-roxygen$ +^scratch$ +^work$ +^README\.Rmd$ +^pkgdown$ +^cran-comments\.md$ +^CRAN-SUBMISSION$ +^LICENSE\.md$ +^data-raw$ diff --git a/.Rprofile b/.Rprofile index 6e0d4744..3d672d6c 100644 --- a/.Rprofile +++ b/.Rprofile @@ -10,5 +10,8 @@ if (any(list.files() == "renv")) { } else { message("No renv initialized, calling renv::init()") message("Please select to use only the DESCRIPTION file for dependency discovery if prompted, and next select 'Restore the project from the lockfile'") + if (!require("renv", quietly = TRUE)) { + utils::install.packages("renv") + } renv::init() } diff --git a/.gitignore b/.gitignore index ccfd0c62..8d4b32d4 100644 --- a/.gitignore +++ b/.gitignore @@ -12,22 +12,8 @@ scratch/ inst/doc # project-specific -inst/config/* -!inst/config/*-sample.yml - -inst/extdata/**/* - -!inst/extdata/phems_variable_list - -!inst/extdata/json -inst/extdata/json/* - -!inst/extdata/standard_concepts -inst/extdata/standard_concepts/* - -!inst/extdata/vocabularies -inst/extdata/vocabularies/* - -!*.gitkeep - -renv \ No newline at end of file +data-raw +*config.yml +renv/ +*.py +process_ucs.R \ No newline at end of file diff --git a/Capr-PHEMS.Rproj b/CaprPHEMS.Rproj similarity index 100% rename from Capr-PHEMS.Rproj rename to CaprPHEMS.Rproj diff --git a/DESCRIPTION b/DESCRIPTION index 2e4c1a1c..1078c17e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,4 +1,4 @@ -Package: Capr-PHEMS +Package: CaprPHEMS Title: Cohort Definition Application Programming - project specific for PHEMS Version: 2.0.8 Authors@R: c( @@ -67,9 +67,11 @@ Collate: 'exit.R' 'cohort.R' 'collectCodesetId.R' - 'conceptSets.R' 'countOccurrences.R' + 'data.R' 'isStandard.R' 'isStandardCS.R' + 'isStandardDB.R' 'table_linked_to_concept_field.R' 'utils.R' +LazyData: true diff --git a/NAMESPACE b/NAMESPACE index 32678998..d8ef0992 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,100 +1,106 @@ -# Generated by roxygen2: do not edit by hand - -S3method(compile,Cohort) -export("%>%") -export(age) -export(as.json) -export(atLeast) -export(atMost) -export(attrition) -export(bt) -export(censoringEvents) -export(cohort) -export(compile) -export(conceptSets) -export(conditionEra) -export(conditionOccurrence) -export(conditionType) -export(continuousObservation) -export(countOccurrences) -export(cs) -export(dateAdjustment) -export(daysOfSupply) -export(death) -export(descendants) -export(deviceExposure) -export(drugEra) -export(drugExit) -export(drugExposure) -export(drugQuantity) -export(drugRefills) -export(drugType) -export(duringInterval) -export(endDate) -export(entry) -export(eq) -export(era) -export(eventEnds) -export(eventStarts) -export(exactly) -export(exclude) -export(exit) -export(female) -export(firstOccurrence) -export(fixedExit) -export(getConceptSetDetails) -export(gt) -export(gte) -export(isStandard) -export(isStandardCS) -export(links) -export(lt) -export(lte) -export(makeCohortSet) -export(male) -export(mapped) -export(measurement) -export(measurementType) -export(nbt) -export(nestedWithAll) -export(nestedWithAny) -export(nestedWithAtLeast) -export(nestedWithAtMost) -export(observation) -export(observationExit) -export(observationType) -export(procedure) -export(procedureType) -export(rangeHigh) -export(rangeLow) -export(readConceptSet) -export(startDate) -export(toCirce) -export(unit) -export(valueAsNumber) -export(visit) -export(visitType) -export(withAll) -export(withAny) -export(withAtLeast) -export(withAtMost) -export(writeCohort) -export(writeConceptSet) -exportMethods("==") -exportMethods(collectGuid) -exportMethods(compile) -import(dplyr) -importFrom(DBI,dbGetQuery) -importFrom(dplyr,across) -importFrom(dplyr,filter) -importFrom(dplyr,inner_join) -importFrom(dplyr,mutate) -importFrom(dplyr,select) -importFrom(generics,compile) -importFrom(magrittr,"%>%") -importFrom(methods,"slot<-") -importFrom(readr,read_csv) -importFrom(readr,write_csv) -importFrom(rlang,"%||%") -importFrom(rlang,":=") -importFrom(rlang,.data) +# Generated by roxygen2: do not edit by hand + +S3method(compile,Cohort) +export("%>%") +export(age) +export(as.json) +export(atLeast) +export(atMost) +export(attrition) +export(bt) +export(censoringEvents) +export(cohort) +export(compile) +export(conditionEra) +export(conditionOccurrence) +export(conditionType) +export(continuousObservation) +export(countOccurrences) +export(cs) +export(dateAdjustment) +export(daysOfSupply) +export(death) +export(descendants) +export(deviceExposure) +export(drugEra) +export(drugExit) +export(drugExposure) +export(drugQuantity) +export(drugRefills) +export(drugType) +export(duringInterval) +export(endDate) +export(entry) +export(eq) +export(era) +export(eventEnds) +export(eventStarts) +export(exactly) +export(exclude) +export(exit) +export(female) +export(firstOccurrence) +export(fixedExit) +export(getConceptSetDetails) +export(gt) +export(gte) +export(isStandard) +export(isStandardCS) +export(isStandardDB) +export(links) +export(lt) +export(lte) +export(makeCohortSet) +export(male) +export(mapped) +export(measurement) +export(measurementType) +export(nbt) +export(nestedWithAll) +export(nestedWithAny) +export(nestedWithAtLeast) +export(nestedWithAtMost) +export(observation) +export(observationExit) +export(observationType) +export(procedure) +export(procedureType) +export(rangeHigh) +export(rangeLow) +export(readConceptSet) +export(startDate) +export(toCirce) +export(unit) +export(valueAsNumber) +export(visit) +export(visitType) +export(withAll) +export(withAny) +export(withAtLeast) +export(withAtMost) +export(writeCohort) +export(writeConceptSet) +exportMethods("==") +exportMethods(collectGuid) +exportMethods(compile) +import(dplyr) +importFrom(DatabaseConnector,connect) +importFrom(DatabaseConnector,disconnect) +importFrom(DatabaseConnector,querySql) +importFrom(SqlRender,render) +importFrom(SqlRender,translate) +importFrom(dplyr,across) +importFrom(dplyr,bind_rows) +importFrom(dplyr,filter) +importFrom(dplyr,inner_join) +importFrom(dplyr,mutate) +importFrom(dplyr,rename) +importFrom(dplyr,select) +importFrom(generics,compile) +importFrom(magrittr,"%>%") +importFrom(methods,"slot<-") +importFrom(readr,read_csv) +importFrom(readr,write_csv) +importFrom(rlang,"%||%") +importFrom(rlang,":=") +importFrom(rlang,.data) diff --git a/R/conceptSets.R b/R/conceptSets.R deleted file mode 100644 index e6ed904f..00000000 --- a/R/conceptSets.R +++ /dev/null @@ -1,568 +0,0 @@ -#' @name conceptSets -#' @title Medical Concept Sets Definition and Expansion -#' -#' @description -#' This script defines and expands various concept sets related to medical data. It utilizes the Capr library to fetch all descendant concepts -#' for each defined concept set, ensuring comprehensive coverage of related medical concepts. -#' -#' @details The script initializes by defining multiple concept sets within a list structure. Each concept set contains unique identifiers for medical concepts, -#' which are expanded to include all descendant concepts using the Capr library's functionality. The expanded concept sets are then stored in a new list within -#' the `conceptSets` object. Finally, the script outputs a confirmation message indicating successful sourcing and expansion of concept sets. -#' -#' @note This script requires the Capr library to be installed and loaded for proper execution. -#' @export - -library(Capr) - -## Define list of concepts to use for concept sets -conceptSets <- list( - concepts = list( - # 5.3 VIS score medications - visScoreMedications = c( - 1337720, # source: dobutamine /// concept: dobutamine - 1337860, # source: dopamine /// concept: dopamine - 1343916, # source: epinephrine /// concept: epinephrine - 1368671, # source: milrinone /// concept: milrinone - 1321341, # source: norepinephrin /// concept: norepinephrine - 1507835 # source: vasopressin /// concept: vasopressin (USP) - ), - - # 5.4 vasopressors and inotropes - vasopressors_inotropes = c( - 1337720, # source: Dobutamine /// concept: dobutamine - 1337860, # source: Dopamine /// concept: dopamine - 1143374, # source: Ephedrine /// concept: ephedrine - 1343916, # source: Epinephrine /// concept: epinephrine - 1183554, # source: Isoproterenol /// concept: isoproterenol - 40173184, # source: Levosimendan /// concept: levosimendan - 1368671, # source: Milrinone /// concept: milrinone - 1321341, # source: Norepinephrine /// concept: norepinephrine - 1135766, # source: Phenylephrine /// concept: phenylephrine - 19119253, # source: Terlipressin /// concept: terlipressin - 1507835 # source: Vasopressin /// concept: vasopressin (USP) - ), - - # 5.5 immunosuppressants - immunosuppressants = c( - 4273629, # source: Chemotherapy /// concept: Chemotherapy - 1518254, # source: Dexamethasone /// concept: dexamethasone - 975125, # source: Hydrocortisone /// concept: hydrocortisone - 1506270, # source: Methylprednisolone /// concept: methylprednisolone - 21603754, # source: Monoclonal Antibodies /// concept: Monoclonal antibodies - 1550557 # source: Prednisolone /// concept: prednisolone - ), - - # 5.6 antibiotic medications - antibiotics = c( - 1713332, # source: Amoxicillin /// concept: amoxicillin - 1759842, # source: Amoxicillin clavulanate /// concept: clavulanate - 1717327, # source: Ampicillin /// concept: ampicillin - 1734104, # source: Azithromycin /// concept: azithromycin - 1836430, # source: Trimethoprim-Sulfamethoxazole /// concept: sulfamethoxazole - 1705674, # source: Trimethoprim-Sulfamethoxazole /// concept: trimethoprim - 1836948, # source: Tetracycline /// concept: tetracycline - 902722, # source: Tobramycin /// concept: tobramycin - 1707687, # source: Vancomycin /// concept: vancomycin - 19010400, # source: Fusidic acid /// concept: fusidate - 45892419, # source: Gentamicin /// concept: gentamicin - 45892599, # source: Ceftolozane-Tazovactam /// concept: ceftolozane - 46221507, # source: Ceftazidime-Avibactam /// concept: avibactam - 1736887, # source: Linezolid /// concept: linezolid - 1748975, # source: Cefepime /// concept: cefepime - 1750500, # source: Clarithromycin /// concept: clarithromycin - 1769535, # source: Cefadroxil /// concept: cefadroxil - 1771162, # source: Cefazolin /// concept: cefazolin - 1774470, # source: Cefotaxime /// concept: cefotaxime - 1776684, # source: Ceftazidime /// concept: ceftazidime - 1778162, # source: Cefuroxime /// concept: cefuroxime - 1786617, # source: Daptomycin /// concept: daptomycin - 1797513, # source: Ciprofloxacin /// concept: ciprofloxacin - 997881, # source: Clindamycin /// concept: clindamycin - 901845, # source: Colistin /// concept: colistin - 1709170, # source: Meropenem /// concept: meropenem - 1717963, # source: Ertapenem /// concept: ertapenem - 1518254, # source: Dexamethasone /// concept: dexamethasone - 1741122, # source: Piperacillin-Tazobactam /// concept: tazobactam - 1746114, # source: Piperacillin-Tazobactam /// concept: piperacillin - 1746940, # source: Erythromycin /// concept: erythromycin - 951511, # source: Mupirocin /// concept: mupirocin - 956653, # source: Fosfomycin /// concept: fosfomycin - 975125, # source: Hydrocortisone /// concept: hydrocortisone - 1778262, # source: Imipenem /// concept: imipenem - 19078399, # source: Teicoplanin /// concept: teicoplanin - 1790868, # source: Amikacin /// concept: amikacin - 1506270, # source: Methylprednisolone /// concept: methylprednisolone - 920293, # source: Nitrofurantoin /// concept: nitrofurantoin - 1721543, # source: Norfloxacin /// concept: norfloxacin - 1724703, # source: Oxacillin /// concept: oxacillin - 1728416, # source: Penicillin /// concept: penicillin G - 1742253, # source: Levofloxacin /// concept: levofloxacin - 1550557, # source: Prednisolone /// concept: prednisolone - 1763204 # source: Rifampicin /// concept: rifampin - ), - - # 5.7 antifungal medications - antifungals = c( - 1714277, # source: Voriconazole /// concept: voriconazole - 35606695, # source: Isovuconazole /// concept: isavuconazole - 19018013, # source: Micafungin /// concept: micafungin - 19026450, # source: Andiulafungin /// concept: anidulafungin - 1754994 # source: Fluconazole /// concept: fluconazole - ), - - # 5.8 antibiotic resistance - antibioticResistance = c( - 4019195, # source: MRSA /// concept: Methicillin resistant Staphylococcus aureus - 4257547, # source: ESBL /// concept: Extended spectrum beta-lactamase producing bacteria - 37017134, # source: Drug-resistant /// concept: Multidrug-resistant bacteria - 1707687, # source: Vancomycin-resistant /// concept: vancomycin - 997881, # source: Clindamycin-resistant /// concept: clindamycin - 1746940 # source: Erythromycin-resistant /// concept: erythromycin - ), - - # 5.9 cardiac surgery - cardiacSurgery = c( - 4049734, # source: Application of band to pulmonary artery /// concept: Banding of pulmonary artery - 4019929, # source: Unspecified repair of tetralogy of fallot /// concept: Repair of tetralogy of Fallot - 4019932, # source: Repositioning of transposed great arteries /// concept: Arterial switch operation - 4017751, # source: Unspecified correction of total anomalous pulmonary venous connection /// concept: Repair of total anomalous pulmonary venous connection - 4020376, # source: Primary repair of defect of interatrial septum NEC/repair of defect of interatrial septum using pericardial patch /// concept: Closure of defect of interatrial septum using pericardial patch - 4020506, # source: Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec /// concept: Creation of valved conduit between right ventricle of heart and pulmonary artery - 4019950, # source: Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec /// concept: Revision of valved cardiac conduit - 4020508, # source: Correction of persistent sinus venosus /// concept: Repair of sinus venosus - 4018441, # source: Correction of partial anomalous pulmonary venous drainage /// concept: Repair of partial anomalous pulmonary venous connection - 4020520, # source: Open aortic valvotomy /// concept: Open aortic valvotomy - 4018747, # source: Repair of subaortic stenosis /// concept: Operations on the left ventricular outflow tract - 4019233, # source: Unspecified creation of shunt to pulmonary artery from subclavian artery using interposition tube pr /// concept: Creation of shunt from subclavian artery to pulmonary artery using interposition tube prosthesis - 4019237, # source: Creation of anastomosis to pulmonary artery from vena cava /// concept: Anastomosis of vena cava to pulmonary artery - 4018926, # source: Other specified : repair of pulmonary artery /// concept: Repair of pulmonary artery - 4021725, # source: Removal of band from pulmonary artery /// concept: Removal of band from pulmonary artery - 4019026, # source: Other specified: plastic repair of aorta /// concept: Plastic repair of aorta - 4020812, # source: Plastic repair of aorta and end to end anastomosis of aorta /// concept: Plastic repair of aorta and end-to-end anastomosis of aorta - 4019028, # source: Release of vascular ring of aorta /// concept: Release of vascular ring of aorta - 44790092, # source: Relief of left ventricular outflow tract obstruction /// concept: Relief of left ventricular outflow tract obstruction - 44789857, # source: Total cavopulmonary connection with extracardiac inferior caval vein topulmonary artery conduit /// concept: Total cavopulmonary connection with extracardiac inferior caval vein to pulmonary artery conduit - 4336751, # source: Unspecified other transplantation of heart/allotransplantation of heart NEC /// concept: Allotransplant of heart - 4049979, # source: Repair of double outlet right ventricle /// concept: Repair of double outlet right ventricle - 4050114, # source: Closure of patent ductus arteriosus NEC /// concept: Closure of ductus arteriosus with clip - 4052536, # source: Extracorporeal membrane oxygenation /// concept: Extracorporeal membrane oxygenation - 44790415, # source: Aortic root pulmonary valve autograft with right vent to pulmonary artery valved conduit/ aortic root pulmonary valve autograft with right vent to pulmonary artery aortoventriculoplasty /// concept: Aortic root replacement using pulmonary valve autograft with right ventricle to pulmonary artery valved conduit and aortoventriculoplasty - 4144921, # source: Implantation of cardiac pacemaker system NEC /// concept: Implantation of cardiac pacemaker - 4137127, # source: Unspecified other transplantation of heart/allotransplantation of heart NEC /// concept: Transplantation of heart - 44793133, # source: Aortopulmonary reconstruction with systemic to pulmonary arterial shunt /// concept: Aortopulmonary reconstruction with systemic to pulmonary arterial shunt - 4293619, # source: Tricuspid valve repair NEC /// concept: Repair of tricuspid valve - 4296790, # source: Transposition of coronary artery NEC /// concept: Transposition of coronary artery - 4139214, # source: Open implantation of ventricular assist device /// concept: Open implantation of cardiac ventricular assist device - 4178479, # source: Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec /// concept: Replacement of valved cardiac conduit - 40486525, # source: Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum /// concept: Primary repair of defect of atrioventricular septum - 4187380, # source: Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum /// concept: Repair of ostium primum defect - 4199899, # source: Unspecified repair of defect of interventricular septum /// concept: Closure of ventricular septal defect - 4203153, # source: Replacement of mitral valve NEC /// concept: Replacement of mitral valve - 4217615, # source: Plication of diaphragm /// concept: Plication of diaphragm - 4308136, # source: Repair of tetralogy of fallot using transannular patch /// concept: Complete repair of tetralogy of Fallot with transannular patch - 4312194, # source: Aortic valve repair NEC /// concept: Repair of heart valve - 4339184, # source: Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec /// concept: Replacement of pulmonary valve - 4232476 # source: Repair of defect of interventricular septum using prosthetic patch/unspecified repair of defect of interventricular septum /// concept: Repair of ventricular septal defect with prosthesis - ), - - # 5.10 cardiac radiology - cardiacRadiology = c( - 4019824, # source: US transoesophageal echocardiogram (toe) /// concept: Transesophageal echocardiography - 4032404, # source: IR bronchoscopy /// concept: Bronchoscopy - 4065416, # source: Exercise test (non-CPET) /// concept: Exercise tolerance test - 4345925, # source: FL video swallow /// concept: Videofluoroscopy swallow - 4083106, # source: US cranial contents /// concept: US scan of head - 4083108, # source: US neck /// concept: US scan of neck - 4082979, # source: MRI head /// concept: MRI of head - 4093436, # source: US thorax and pleural cavity /// concept: Ultrasonography of thorax - 4125350, # source: CT head /// concept: CT of head - 4125530, # source: US urinary tract /// concept: US urinary tract - 44802640, # source: MRI cardiac complex congenital /// concept: MRI study for cardiac congenital anomaly - 4163872, # source: XR chest /// concept: Plain chest X-ray - 4167029, # source: US doppler groin both /// concept: Ultrasonography of inguinal region - 4167052, # source: US doppler renal both /// concept: Doppler ultrasonography of kidney - 4305221, # source: US abdomen and pelvis/ US abdomen /// concept: US scan of abdomen and pelvis - 4303522, # source: US diaphragmatic region /// concept: US scan of diaphragm - 4306317, # source: CT heart with contrast/ CT cardiac angiogram coronary/ CT cardiac gated with contrast /// concept: CT angiography of coronary artery with contrast - 4169275, # source: XR chest and abdomen /// concept: X-ray of chest and abdomen - 4322380, # source: IR PICC line insertion /// concept: Insertion of peripherally inserted central catheter - 4140473, # source: 24h holter monitor /// concept: Holter extended electrocardiographic recording - 4329508, # source: US thorax and pleural cavity /// concept: Ultrasonography of pleural cavity - 4335392, # source: US doppler lower limb veins both /// concept: Doppler ultrasonography of vein of lower limb - 4203365, # source: Epicardial echocardiogram /// concept: Epicardial echocardiography - 4335825, # source: US transthoracic echocardiogram/ us transthoracic echocardiogram (pre- admission)/ US transthoracic echocardiogram (sedated) /// concept: Transthoracic echocardiography - 40482732, # source: IR tunnelled central venous line insertion /// concept: Insertion of tunneled venous catheter - 40489841, # source: US doppler jugular vein both /// concept: Doppler ultrasonography of jugular vein - 40492338, # source: Cardiopulmonary exercise test (CPET) /// concept: Cardiopulmonary exercise test - 40488431, # source: Pacemaker/ICD interrogation (in clinic)/ pacemaker/ICD interrogation (other) /// concept: Interrogation of cardiac pacemaker - 42873079, # source: IR tunnelled central venous line removal /// concept: Removal of tunneled central venous catheter - 4261497, # source: US abdomen and pelvis/ US abdomen /// concept: Ultrasonography of abdomen - 4205144, # source: EEG routine portable /// concept: Portable electroencephalogram - 4181917, # source: EEG routine /// concept: Electroencephalogram - 4264477, # source: XR abdomen /// concept: Diagnostic radiography of abdomen - 45764527, # source: 24h holter monitor /// concept: Electrocardiographic Holter analyzer - 45765560, # source: Event monitor /// concept: Cardiovascular monitor - 4327032, # source: CT thorax with contrast /// concept: CT of thorax with contrast - 35622931, # source: US doppler /// concept: Doppler ultrasound - 44813863, # source: US vocal cord /// concept: Ultrasonography of vocal cord - 4312208, # source: IR bronchogram /// concept: Contrast bronchogram - 4235141 # source: Pacemaker/ICD device check - remote patient initiated /// concept: Check artificial pacemaker - ), - - # 5.11 cardiac length of stay - cardiac_LOS = c( - 4123933, # source: ICU admission (start datetime and end datetime) /// concept: Admission to pediatric intensive care unit - 8715, # source: Total hospital admission (start datetime and end datetime) /// concept: Hospital admission - 4161811, # source: HDU admission (start datetime and end datetime) /// concept: Admission to high dependency unit - 36675203 # source: Cardiology ward admission (start datetime and end datetime) /// concept: Admission to pediatric cardiology department - ), - - # 5.12 additional variables - additional = c( - 4095105, # source: Base Excess /// concept: Base deficit measurement - 4123933, # source: Elective ICU admission /// concept: Admission to pediatric intensive care unit - 4234469, # source: Diagnoses /// concept: Diagnosis - 40493026, # source: Mechanical ventilation /// concept: Mechanical ventilator - 44803020, # source: Reason for ICU admission: (Main reason for ICU admission is not recovery from surgery or a procedure, Recovery from a bypass cardiac procedure, recovery from a non-bypass cardiac procedure, recovery from non-cardiac procedure) /// concept: Primary reason for admission - 4209008, # source: Pupillary reaction /// concept: Pupillary function - 260134, # source: Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder /// concept: Croup - 432571, # source: Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure /// concept: Malignant lymphoma - 4029498, # source: Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder /// concept: Seizure disorder - 317009, # source: Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder /// concept: Asthma - 201957, # source: High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) /// concept: Necrotizing enterocolitis in fetus OR newborn - 43530727, # source: High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) /// concept: Spontaneous cerebral hemorrhage - 29783, # source: Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure /// concept: Severe combined immunodeficiency disease - 321042, # source: Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure /// concept: Cardiac arrest - 4165112, # source: Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder /// concept: Bronchiolitis - 443727, # source: Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder /// concept: Diabetic ketoacidosis - 314383, # source: High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) /// concept: Myocarditis - 4245975, # source: Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure /// concept: Hepatic failure - 440207, # source: High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) /// concept: Hypoplastic left heart syndrome - 42537745, # source: Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure /// concept: Bone marrow transplant present - 442588, # source: Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder /// concept: Obstructive sleep apnea syndrome - 4213310, # source: High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) /// concept: Degenerative disease of the central nervous system - 321319, # source: High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) /// concept: Cardiomyopathy - 317510, # source: Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure /// concept: Leukemia - 5083, # source: Outpatient appointment type (telephone/ clinic visit etc.) /// concept: Telehealth - 42869590, # source: FiO2 /// concept: Oxygen/Gas total [Pure volume fraction] Inhaled gas - 3027946, # source: PaCO2 /// concept: Carbon dioxide [Partial pressure] in Arterial blood - 3004249 # source: Systolic blood pressure /// concept: Systolic blood pressure - ), - - # 5.13 laboratory tests - labTests = c( - 4298431, # source: Immature WBC Count /// concept: White blood cell count - 3007670, # source: Neutrophil Count /// concept: Neutrophil Ab [Units/volume] in Serum - 40762351, # source: Hemoglobin /// concept: Hemoglobin [Moles/volume] in Blood - 37393863, # source: Platelet Count /// concept: Platelet count - 3009542, # source: Hematocrit /// concept: Hematocrit [Volume Fraction] of Blood - 3034426, # source: INR Prothrombin Time /// concept: Prothrombin time (PT) - 3047181, # source: Lactate /// concept: Lactate [Moles/volume] in Blood - 3051825, # source: Creatinine /// concept: Creatinine [Mass/volume] in Blood - 3024561, # source: Albumin /// concept: Albumin [Mass/volume] in Serum or Plasma - 3024641, # source: Blood urea nitrogen /// concept: Urea nitrogen [Moles/volume] in Serum or Plasma - 3013826, # source: Glucose /// concept: Glucose [Moles/volume] in Serum or Plasma - 3006140, # source: Bilirubin /// concept: Bilirubin.total [Moles/volume] in Serum or Plasma - 3019550, # source: Sodium /// concept: Sodium [Moles/volume] in Serum or Plasma - 3005456, # source: Potassium /// concept: Potassium [Moles/volume] in Blood - 3033836, # source: Magnesium /// concept: Magnesium [Moles/volume] in Blood - 3018572, # source: Chloride /// concept: Chloride [Moles/volume] in Blood - 3015377, # source: Calcium /// concept: Calcium [Moles/volume] in Serum or Plasma - 3003458, # source: Phosphate /// concept: Phosphate [Moles/volume] in Serum or Plasma - 3020460, # source: CRP /// concept: C reactive protein [Mass/volume] in Serum or Plasma - 3006923, # source: ALT /// concept: Alanine aminotransferase [Enzymatic activity/volume] in Serum or Plasma - 3013721, # source: AST /// concept: Aspartate aminotransferase [Enzymatic activity/volume] in Serum or Plasma - 37392672, # source: pH (venous) /// concept: Blood venous pH - 37399161, # source: pH (arterial) /// concept: Blood arterial pH - 3021447, # source: pCO2 (venous) /// concept: Carbon dioxide [Partial pressure] in Venous blood - 3027946, # source: pCO2 (arterial) /// concept: Carbon dioxide [Partial pressure] in Arterial blood - 3024354, # source: pO2 (venous) /// concept: Oxygen [Partial pressure] in Venous blood - 3027801, # source: pO2 (arterial) /// concept: Oxygen [Partial pressure] in Arterial blood - 3027273, # source: Bicarbonate (venous) /// concept: Bicarbonate [Moles/volume] in Venous blood - 3008152 # source: Bicarbonate (arterial) /// concept: Bicarbonate [Moles/volume] in Arterial blood - ), - - # 5.14 cardiac complications - cardiacComplications = c( - 4051330, # source: LCOS - renal support (CVVH/ PD) /// concept: Continuous venovenous hemofiltration - 4123933, # source: ICU ward stay /// concept: Admission to pediatric intensive care unit - 4295705, # source: Surgical injury - Reexplore for bleeding /// concept: Exploratory incision - 377091, # source: Neurological injury - seizure /// concept: Seizure - 439847, # source: Neurological injury - intracranial haemmhorage/ intracranial bleeding /// concept: Intracranial hemorrhage - 4308537, # source: Surgical injury - Blood Loss /// concept: Injury to blood vessel during surgery - 321042, # source: LCOS - Cardiac arrest /// concept: Cardiac arrest - 443454, # source: Neurological injury - infarction /// concept: Cerebral infarction - 4185565, # source: Low cardiac output state (LCOS) - ECMO /// concept: Low cardiac output syndrome - 42537043, # source: CVL infections /// concept: CLABSI - central line associated bloodstream infection - 4306136 # source: Surgical injury - Chylothorax /// concept: Chylothorax - ), - - # 5.15 Vital signs - vitalSigns = c( - 3027018, # source: Age-dependent HR /// concept: Heart rate - 3024171, # source: Age-dependent RR /// concept: Respiratory rate - 3004249, # source: SBP (Systolic Blood Pressure) /// concept: Systolic blood pressure - 3012888, # source: DBP (Dyastolic Blood Pressure) /// concept: Diastolic blood pressure - 4020553 # source: SpO2 /// concept: Oxygen saturation measurement - ), - - # 5.16 HSJD clinical - HSJDClinical = c( - 3025315, # source: Weight /// concept: Body weight - 3036277, # source: Height /// concept: Body height - 4201235, # source: Body Surface Area (BSA) - Combination of weight and height /// concept: body surface area - 4275564 # source: Cardiac surgeries (Interventions) /// concept: Operation on heart - ), - - # 5.17 HSJD Surgery - HSJDSurgery = c( - 40490494, # source: STAT/EACTS score of surgery /// concept: Society of Thoracic Surgeons risk calculator - 4301351, # source: Surgery start datetime, end datetime /// concept: Surgical procedure - 4336464, # source: Cardiac bypass start datetime, end datetime /// concept: Coronary artery bypass graft - 4201547, # source: Cross-clamping start datetime, end datetime /// concept: Placement of arterial cross clamp - 37152781, # source: Deep hypothermic circulatory arrest start datetime, end datetime /// concept: Hypothermic circulatory arrest - 4272324, # source: Antegrade Cerebral Perfusion start datetime, end datetime /// concept: Cardiopulmonary bypass operation - 4150627 # source: Extubation event /// concept: Removal of endotracheal tube - ), - - # 5.18 HSJD Hospitalisations - HSJDHospitalisation = c( - 44803020, # source: Admission reason /// concept: Primary reason for admission - 42539650, # source: Vasoactive infusion start datetime, end datetime /// concept: Administration of intravenous vasoactive drug - 4179206, # source: Postop central venous catheter in/start datetime, out/end datetime /// concept: Central venous catheter - 37158404, # source: Invasive Mechanical Ventilation LOS /// concept: Invasive mechanical ventilation - 4177224 # source: Non-Invasive Mechanical Ventilation LOS /// concept: Non-invasive ventilation - ), - - # 5.19 HSJD Complications - HSJDcomplications = c( - 4202832, # source: intubation /// concept: Intubation - 4275564, # source: Cardiac surgeries (interventions) /// concept: Operation on heart - 4044892, # source: Sternum reopening (procedure undertaken) /// concept: Procedure on sternum - 4046868, # source: Vocal Cord Dysfunction /// concept: Vocal cord dysfunction - 4275136, # source: Diaphragmatic Paralysis /// concept: Paralysis of diaphragm - 253796, # source: Pneumothorax /// concept: Pneumothorax - 44783799, # source: Tracheostomy /// concept: Exteriorization of trachea - 44784217, # source: Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) /// concept: Cardiac arrhythmia - 315643, # source: Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) /// concept: Tachyarrhythmia - 4228448, # source: Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) /// concept: Bradyarrhythmia - 4068155, # source: Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) /// concept: Atrial arrhythmia - 4185572, # source: Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) /// concept: Ventricular arrhythmia - 46234437, # source: Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) /// concept: ivabradine - 1309944, # source: Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) /// concept: amiodarone - 1354860, # source: Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) /// concept: flecainide - 4353741, # source: Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing /// concept: Cardioversion - 4117045, # source: Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing /// concept: Atrial overdrive pacing - 4049398, # source: Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing /// concept: Temporary cardiac pacemaker procedure - 4051940, # source: Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing /// concept: Permanent cardiac pacemaker procedure - 609312 # source: Listed for heart transplantation /// concept: Awaiting transplantation of heart - ), - - # 5.21 healthcare use - healthcareUse = c( - 37174269, # source: Diagnosis of acute infection having the potential for progression to sepsis1+2 /// concept: At increased risk of sepsis - 4032243, # source: Dialysis /// concept: Dialysis procedure - 197320, # source: acute kidney injury /// concept: Acute kidney injury - 4074689, # source: "Chest opening, chest drainage" /// concept: Open drainage of pleural cavity - 4084670, # source: Surgical admission (non-urgent) /// concept: Non-urgent surgical admission - 4070667, # source: Urinary catheter /// concept: Urinary catheter - 44790095, # source: Invasive ventilation /// concept: Invasive ventilation - 4052536, # source: ECMO /// concept: Extracorporeal membrane oxygenation - 4051330, # source: Dialysis /// concept: Continuous venovenous hemofiltration - 44790567, # source: Origin (external) /// concept: Patient transfer from hospital to hospital - 133327, # source: viremia /// concept: Viremia - 4097216, # source: Endotracheal tube /// concept: Endotracheal tube - 4085730, # source: Antibiotics /// concept: Antibiotic therapy - 4123946, # source: Surgical admission (urgent) /// concept: Admission to surgical department - 4208341, # source: organ transplant /// concept: Solid organ transplant - 4193843, # source: Oxygenation index /// concept: Oxygenation index measurement - 4235043, # source: Ventricular assist device (VAD) /// concept: Ventricular assist device - 443392, # source: Cancer /// concept: Malignant neoplastic disease - 4181511, # source: Antineoplastics /// concept: Administration of antineoplastic agent - 4294886, # source: Origin (internal) /// concept: "Patient transfer, in-hospital" - 4301351, # source: Surgery previous to prediction time point /// concept: Surgical procedure - 4140762, # source: Antivirals /// concept: Antiviral therapy - 4177205, # source: Peripheral IV cannulas /// concept: Cannulation - 4177224, # source: Non-invasive ventilation /// concept: Non-invasive ventilation - 45758028, # source: Arterial blood pressure catheter /// concept: Arterial blood pressure catheter - 44803020, # source: Reason for admission /// concept: Primary reason for admission - 4179206, # source: Central venous catheter /// concept: Central venous catheter - 132736, # source: bacteremia /// concept: Bacteremia - 44783799, # source: Tracheostomy /// concept: Exteriorization of trachea - 45768671, # source: asplenia /// concept: Asplenia - 4324124, # source: Peritoneal dialysis /// concept: Peritoneal dialysis - 435785, # source: meningitis /// concept: Meningitis - 201820, # source: Diagnosis of chronic condition /// concept: Diabetes mellitus - 42538045, # source: Nasogastric/orogastric tube /// concept: Nasogastric/orogastric tube stylet - 37206601, # source: ECMO type /// concept: Venoarterial extracorporeal membrane oxygenation - 37206603, # source: ECMO type /// concept: Venovenous extracorporeal membrane oxygenation - 4314777, # source: Immunosuppressors /// concept: Immunosuppressive therapy - 604243, # source: neutropenia /// concept: Acquired neutropenia - 444187, # source: injury with open wound /// concept: Open wound - 22281, # source: sickle cell disease /// concept: Sickle cell-hemoglobin SS disease - 435613, # source: cellulitis /// concept: Cellulitis - 4134120, # source: cerebral palsy /// concept: Cerebral palsy - 444202, # source: Abcess /// concept: Abscess - 312723, # source: Diagnosis of chronic condition /// concept: Congenital heart disease - 255573, # source: Diagnosis of chronic condition /// concept: Chronic obstructive lung disease - 255848, # source: pneumonia /// concept: Pneumonia - 433740, # source: immunodeficiency /// concept: Immunodeficiency disorder - 4080011, # source: Diagnosis of organ system dysfunction /// concept: Organ dysfunction syndrome - 434821, # source: Diagnosis of SIRS /// concept: Systemic inflammatory response syndrome - 81539, # source: mitochondrial disease /// concept: Mitochondrial cytopathy - 4103588, # source: tuberculosis /// concept: Acute tuberculosis - 443783, # source: Diagnosis of chronic condition /// concept: Chronic disease - 4140977, # source: Diagnosis of condition producing immunodeficiency /// concept: Secondary immune deficiency disorder - 201606, # source: Crohn's disease /// concept: Crohn's disease - 4243475, # source: hepatitis /// concept: Acute hepatitis - 4300243, # source: surgical site inflammation /// concept: Postoperative complication - 439125, # source: Down's syndrome /// concept: Complete trisomy 21 syndrome - 321042, # source: cardiac arrest /// concept: Cardiac arrest - 4331815, # source: UTI /// concept: Acute urinary tract infection - 195212, # source: Cushing's disease /// concept: Hypercortisolism - 196152, # source: peritonitis /// concept: Peritonitis - 314383, # source: miocarditis /// concept: Myocarditis - 195314, # source: nephrotic syndrome /// concept: Nephrotic syndrome - 441589, # source: endocarditis /// concept: Endocarditis - 4271450, # source: Diagnosis of acute infection having the potential for progression to sepsis1+2 /// concept: Acute infectious disease - 81893, # source: ulcerative colitis /// concept: Ulcerative colitis - 80809, # source: rheumatoid arthritis /// concept: Rheumatoid arthritis - 4322814, # source: Meningo-encephalitis /// concept: Meningoencephalitis - 36716945, # source: renal insufficiency /// concept: Renal insufficiency - 440448, # source: appendicitis /// concept: Appendicitis - 433968, # source: candidiasis /// concept: Candidiasis - 44807226, # source: necrotizing enterocolitis /// concept: Necrotising enterocolitis - 132797, # source: Previous diagnosis of sepsis measure /// concept: Sepsis - 21602722, # source: Corticoids /// concept: CORTICOSTEROIDS FOR SYSTEMIC USE - 42869590, # source: FiO2 /// concept: Oxygen/Gas total [Pure volume fraction] Inhaled gas - 42527086, # source: Mean Airway Pressure (MAP) /// concept: Mean airway pressure - 1340204 # source: Previous diagnosis of sepsis measure /// concept: History of event - ), - - # 5.22 vital signs UC2 - vitalSignsUC2 = c( - 4096101, # source: SpO2 /// concept: Measurement of oxygen saturation at periphery - 3025315, # source: Weight /// concept: Body weight - 3020891, # source: Body temperature /// concept: Body temperature - 3012888, # source: DBP (Diastolic blood pressure) /// concept: Diastolic blood pressure - 3004249, # source: SBP (Systolic Blood Pressure) /// concept: Systolic blood pressure - 3014315, # source: Urine output /// concept: Urine output - 3024171, # source: RR /// concept: Respiratory rate - 3027018 # source: HR /// concept: Heart rate - ), - - # 5.23 physical examination signs - physicalExaminationSigns = c( - 4224504, # source: Central pulse /// concept: Pulse - 4314539, # source: Peripheral pulse (pressure) /// concept: Arterial pulse pressure - 21490963, # source: Pupillary reactivity (right) /// concept: Right pupil Pupillary response - 3032652, # source: GCS /// concept: Glasgow coma scale - 3045676, # source: Capillary refill time /// concept: Capillary refill [Time] - 21491763, # source: Pupillary reactivity (left) /// concept: Left pupil Pupillary response - 3021415, # source: Pupillary size (left) /// concept: Left pupil Diameter Auto - 3027214 # source: Pupillary size (right) /// concept: Right pupil Diameter Auto - ), - - # 5.24 lab tests UC2 - labTestsUC2 = c( - 37393605, # source: D-dimer /// concept: D-dimer level - 4017361, # source: Blood urea nitrogen /// concept: Blood urea nitrogen measurement - 4036356, # source: Bacterial pathogen detection /// concept: Detection of bacteria - 44789220, # source: Ionized calcium /// concept: Ionised calcium measurement - 4094436, # source: Fibrinogen /// concept: Fibrinogen measurement - 4118986, # source: Direct bilirubin /// concept: Bilirubin measurement - 4196268, # source: PCR panel /// concept: Polymerase chain reaction observation - 440029, # source: Viral pathogen detection /// concept: Viral disease - 4212899, # source: Leukocytes /// concept: Total white blood count - 4175016, # source: Thromboplastin time /// concept: Partial thromboplastin time, activated - 42536081, # source: MR-proADM /// concept: Adrenal medulla hormone - 4299649, # source: Quantification of colonies in culture /// concept: Quantitative microbial culture and measurement - 44806682, # source: Antibiotic resistance /// concept: Infection resistant to multiple antibiotics - 432545, # source: Name of bacterial pathogen detected /// concept: Bacterial infectious disease - 3013826, # source: Glucose /// concept: Glucose [Moles/volume] in Serum or Plasma - 3046279, # source: PCT /// concept: Procalcitonin [Mass/volume] in Serum or Plasma - 3033291 # source: Interleukin-6 /// concept: Interleukin 6 [Mass/volume] in Body fluid - ), - - # 5.25 arterial blood gas - arterialBloodGas = c( - 3003396, # source: Base excess /// concept: Base excess in Arterial blood by calculation - 3019977, # source: pH /// concept: pH of Arterial blood - 3008152, # source: HCO3 /// concept: Bicarbonate [Moles/volume] in Arterial blood - 3027946, # source: pCO2 /// concept: Carbon dioxide [Partial pressure] in Arterial blood - 3027801 # source: PaO2 /// concept: Oxygen [Partial pressure] in Arterial blood - ), - - # 5.26 venous blood gas - venousBloodGas = c( - 3009343, # source: pH /// concept: pH of Capillary blood - 3027273, # source: HCO3 /// concept: Bicarbonate [Moles/volume] in Venous blood - 3003129, # source: Base excess /// concept: Base excess in Capillary blood by calculation - 3002032, # source: Base excess /// concept: Base excess in Venous blood by calculation - 3015235, # source: HCO3 /// concept: Bicarbonate [Moles/volume] in Capillary blood - 3023024, # source: pCO2 /// concept: Carbon dioxide [Partial pressure] in Capillary blood - 3021447, # source: pCO2 /// concept: Carbon dioxide [Partial pressure] in Venous blood - 3028626, # source: PaO2 /// concept: Oxygen [Partial pressure] in Capillary blood - 3024354, # source: PaO2 /// concept: Oxygen [Partial pressure] in Venous blood - 3012544 # source: pH /// concept: pH of Venous blood - ), - - # 5.28 Patient characteristics - UC3PateintCharacteristics = c( - 434007, # source: hemophilia A diagnosis /// concept: hereditary factor VIII deficiency disease - 4094223, # source: hemophilia A subtype/ severity /// concept: mild hereditary factor VIII deficiency disease - 4140661, # source: hemophilia A subtype/ severity /// concept: moderate hereditary factor VIII deficiency disease - 4056830, # source: hemophilia A subtype/ severity /// concept: severe hereditary factor VIII deficiency disease - 3003694, # source: blood group /// concept: ABO and Rh group [Type] in Blood - 37393608, # source: factor VIII inhibitor status /// concept: factor VIII inhibitor activity - 4126681, # source: factor VIII inhibitor status /// concept: detected - 9190 # source: factor VIII inhibitor status /// concept: not detected - ), - - # 5.29 Lab Measurements - UC3LabMeasurements = c( - 3024942, # source: factor VIII inhibitor titer /// concept: coagulation factor VIII inhibitor [Units/volume] in platelet poor plasma by coagulation assay - 3022520, # source: factor VIII activity measurement /// concept: coagulation factor VIII activated [Units/volume] in platelet poor plasma by coagulation assay - 3011832, # source: factor VIII activity measurement /// concept: coagulation factor VIII activity [Units/volume] in platelet poor plasma by Chromogenic assay - 43534000, # source: Von Willebrand factor activity measurement /// concept: von Willebrand factor (vWf) activity [Units/volume] in platelet poor plasma by Immunoassay - 3002124, # source: Von Willebrand factor antigen measurement /// concept: von Willebrand factor (vWf) Ag [Units/volume] in platelet poor plasma by Immunoassay - 3023693, # source: Von Willebrand factor propeptide measurement /// concept: von Willebrand factor (vWf) multimers in platelet poor plasma by Immunoblot - 3042349, # source: Von Willebrand factor propeptide measurement /// concept: von Willebrand factor (vWf) cleaving protease inhibitor [Units/volume] in platelet poor plasma - 4175016, # source: activated partial thromboplastin time (APTT) /// concept: partial thromboplastin time, activated - 3034426, # source: Prothrombin time (PT) /// concept: prothrombin time (PT) - 4267147, # source: platelet count /// concept: platelet count - 3009542, # source: hematocrit /// concept: Hematocrit [Volume Fraction] of Blood - 3016407, # source: fibrinogen /// concept: fibrinogen [mass/volume] in platelet poor plasma by coagulation assay - 3006923, # source: ALT /// concept: alanine aminotransferase [enzymatic activity/volume] in serum or plasma - 3013721 # source: AST /// concept: aspartate aminotransferase [enzymatic activity/volume] in serum or plasma - ), - - # 5.30 Treatments - UC3Treatments = c( - 1352213, # source: factor VIII /// concept: factor VIII (umbrella term) - 793042, # source: factor VIII /// concept: emicizumab (umbrella term) - 40492862, # source: factor VIII dose is continuous infusion or bolus dose /// concept: mode of drug administration - 4129275, # source: factor VIII dose is continuous infusion or bolus dose /// concept: continuous infusion - 4265597, # source: factor VIII dose is continuous infusion or bolus dose /// concept: by bolus infusions - 1517070 # source: desmopressin /// concept: desmopressin - ), - - # 5.31 Surgery-specific parameters - UC3Surgery = c( - 4172515, # source: Medical/ surgical procedure /// concept: Therapeutic procedure - 967823, # source: NaCl administration during surgery /// concept: sodium chloride - 4028665, # source: plasma administration during surgery /// concept: plasma transfusion - 4160439, # source: datetime start anesthesia /// concept: Administration of anesthesia - 4308716, # source: blood loss during surgery /// concept: intraoperative hemorrhage - 37017589 # source: blood transfusion during surgery /// concept: Bleeding during surgery requiring transfusion - ) - ) -) - -## Extend with descendants -conceptSets$conceptSets <- list() -for (cs in names(conceptSets$concepts)) { - conceptSets$conceptSets[[cs]] <- cs(descendants(conceptSets$concepts[[cs]]), name = cs) -} - -cat("\nSourced concept sets\n") diff --git a/R/countOccurrences.R b/R/countOccurrences.R index 1b5ccfb2..e6c3b77d 100644 --- a/R/countOccurrences.R +++ b/R/countOccurrences.R @@ -1,111 +1,115 @@ -#' Count Occurrences of Values in Database Tables +#' Count Occurrences of Concept IDs in OMOP Database #' -#' This function counts the occurrences of specified concept ids within specified tables in a OMOP database, +#' This function counts the occurrences of specified concept IDs within specified tables in an OMOP database, #' including direct occurrences and occurrences through descendants, based on a provided cdm_schema and links. #' It returns a tibble summarizing the counts across persons and across records. #' -#' @param v A vector of concept_ids to count occurrences for. -#' @param tables A character vector of CDM table names to search within. -#' @param links A list linking each table to its respective concept_id field. #' @param db_connection A database connection object through which queries will be executed. #' @param cdm_schema The database cdm_schema in which the tables are located. #' @param vocab_schema The database vocab_schema in which the concept tables are located. -#' @param save_path The path to save the results to. If NULL, the results are not saved. +#' @param v A vector of concept_ids to count occurrences for. +#' @param tables A character vector of CDM table names to search within. +#' @param links A list linking each table to its respective concept_id field. +#' @param save_path The path to save the results to as a CSV file. If NULL, the results are not saved. #' -#' @return A tibble with columns for the number of times any concept from 'v' occurs: direct count of persons, -#' direct count of records, descendant count of persons, and descendant count of records. -#' The tibble also includes the concept names derived from `v` and is arranged by the total +#' @return A tibble with columns for the number of times any concept from 'v' occurs: direct count of persons, +#' direct count of records, descendant count of persons, and descendant count of records. +#' The tibble also includes the concept names and domain ids derived from `v` and is arranged by the total #' record count (direct + descendant). #' #' @examples #' # Assuming `db_connection` is a valid database connection, `cdm_schema` is set to "public", #' # `tables` contains the names of the tables to search, `links` defines the relevant fields, #' # and `v` contains the values to search for: -#' results <- countOccurrences(v = c(1, 2), tables = c("observation", "condition_occurrence"), -#' links = list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id", ...), -#' db_connection = db_connection, cdm_schema = "public") +#' results <- countOccurrences( +#' db_connection = db_connection, cdm_schema = "public", vocab_schema = "vocabulary", +#' v = c(1, 2), tables = c("observation", "condition_occurrence"), +#' links = list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id"), +#' save_path = NULL +#' ) #' #' @export -countOccurrences <- function(v, tables, links, db_connection, cdm_schema, vocab_schema, save_path = NULL) { - library(DBI) - library(dplyr) - library(tibble) +countOccurrences <- function(db_connection, cdm_schema, vocab_schema, v, tables, links, save_path) { + stopifnot("Error: No valid database connection provided." = DatabaseConnector::dbIsValid(db_connection)) + stopifnot("Error: v is not a valid vector. Please provide a vector of concept_ids." = is.vector(v)) + stopifnot("Error: tables is not a valid character vector. Please provide CDM table names." = is.character(tables) & is.vector(tables)) + stopifnot("Error: No links between tables and respective concept_id fields provided." = is.list(links)) + stopifnot("Error: No string provided as cdm_schema" = is.character(cdm_schema)) + stopifnot("Error: No string provided as save_path" = is.character(save_path)) - stopifnot(is.vector(v)) - stopifnot(is.character(tables) & is.vector(tables)) - stopifnot(is.list(links)) - stopifnot(is.character(cdm_schema)) - results <- list() - + + # Create a temporary table for concept IDs + temp_query <- "CREATE TEMPORARY TABLE temp_concepts (concept_id INTEGER)" + temp_query_translated <- SqlRender::translate(sql = temp_query, targetDialect = attr(db_connection, "dbms")) + DatabaseConnector::dbExecute(db_connection, temp_query_translated) + temp_query_insert <- sprintf("INSERT INTO temp_concepts (concept_id) VALUES %s", paste0("(", v, ")", collapse = ", ")) + temp_query_insert_translated <- SqlRender::translate(sql = temp_query_insert, targetDialect = attr(db_connection, "dbms")) + DatabaseConnector::dbExecute(db_connection, temp_query_insert_translated) + for (table in tables) { - concept_id_field <- links[[table]] - + concept_id_field <- links[[table]][1] + # Combined SQL query for direct and descendant counts combined_sql <- sprintf( - # WITH clause to define common table expressions (CTEs) "WITH direct_counts AS ( - -- Select the concept_id and count the distinct persons and total records for each concept_id SELECT %s AS concept_id, COUNT(DISTINCT person_id) AS count_persons, COUNT(*) AS count_records - -- From the cdm schema and the specified table FROM %s.%s - -- Where the concept_id is in the provided vector - WHERE %s IN (%s) - -- Group by the concept_id + WHERE %s IN (SELECT concept_id FROM temp_concepts) GROUP BY %s - -- Define the second expression for descendants ), desc_counts AS ( - -- Select the ancestor_concept_id and count the distinct persons and total records for each concept_id SELECT b.ancestor_concept_id AS concept_id, COUNT(DISTINCT a.person_id) AS desc_count_person, COUNT(*) AS desc_count_record - -- From the vocab schema and concept ancestor table (vocab schema must contain concept_ancestor table; this can be the same schema as the cdm) FROM %s.%s a - -- Join the concept_ancestor table to get the ancestor_concept_id JOIN %s.concept_ancestor b ON a.%s = b.descendant_concept_id - -- Where the descendant_concept_id is in the provided vector - WHERE b.ancestor_concept_id IN (%s) - -- Group by the ancestor_concept_id + WHERE b.ancestor_concept_id IN (SELECT concept_id FROM temp_concepts) GROUP BY b.ancestor_concept_id ) - -- Combine the direct and descendant counts into one result set - SELECT coalesce(d.concept_id, dc.concept_id) AS concept_id, coalesce(count_persons, 0) AS count_persons, coalesce(count_records, 0) AS count_records, coalesce(desc_count_person, 0) AS desc_count_person, coalesce(desc_count_record, 0) AS desc_count_record - FROM direct_counts d - FULL OUTER JOIN desc_counts dc ON d.concept_id = dc.concept_id", - concept_id_field, cdm_schema, table, concept_id_field, paste(v, collapse = ","), concept_id_field, - cdm_schema, table, vocab_schema, concept_id_field, paste(v, collapse = ",") + SELECT c.concept_id, coalesce(d.count_persons, 0) AS count_persons, coalesce(d.count_records, 0) AS count_records, coalesce(dc.desc_count_person, 0) AS desc_count_person, coalesce(dc.desc_count_record, 0) AS desc_count_record, + coalesce(concept.concept_name, '') AS concept_name, coalesce(concept.domain_id, '') AS domain_id + FROM temp_concepts c + LEFT JOIN direct_counts d ON c.concept_id = d.concept_id + LEFT JOIN desc_counts dc ON c.concept_id = dc.concept_id + LEFT JOIN %s.concept concept ON c.concept_id = concept.concept_id", + concept_id_field, cdm_schema, table, concept_id_field, concept_id_field, + cdm_schema, table, vocab_schema, concept_id_field, + vocab_schema ) - combined_res <- dbGetQuery(db_connection, combined_sql) + sql_translated <- SqlRender::translate(sql = combined_sql, targetDialect = attr(db_connection, "dbms")) + combined_res <- DatabaseConnector::dbGetQuery(db_connection, sql_translated) - not_in_data <- v[!(v %in% combined_res$concept_id)] + ind_not_in_data <- which(!(v %in% combined_res$concept_id)) combined_res <- combined_res |> - bind_rows(tibble( - concept_id = not_in_data, + dplyr::bind_rows(tibble::tibble( + concept_id = v[ind_not_in_data], + concept_name = "Unknown; concept_id not found in data", + domain_id = "Unknown; concept_id not found in data", count_persons = 0, count_records = 0, desc_count_person = 0, desc_count_record = 0 - )) - + )) |> + dplyr::filter(!is.na(concept_id)) + # Append results results[[table]] <- combined_res } - + # Combine all results into a single data frame and transform - final_res <- bind_rows(results) %>% - group_by(concept_id) %>% - summarise( + final_res <- dplyr::bind_rows(results) |> + dplyr::group_by(concept_id, concept_name, domain_id) |> + dplyr::summarise( count_persons = sum(count_persons), count_records = sum(count_records), desc_count_person = sum(desc_count_person), desc_count_record = sum(desc_count_record) - ) %>% - ungroup() %>% - mutate(concept_name = names(v)[match(concept_id, v)]) %>% - arrange(desc(count_records + desc_count_record)) + ) |> + dplyr::ungroup() |> + dplyr::arrange(desc(desc_count_record)) + + if (!is.null(save_path)) { + readr::write_csv(final_res, paste0(save_path, "/", "count_occurrences.csv")) + } - if (!is.null(save_path)) { - readr::write_csv(final_res, paste0(save_path, '/', 'count_occurrences.csv')) - } - return(final_res) -} \ No newline at end of file +} diff --git a/R/data.R b/R/data.R new file mode 100644 index 00000000..79fff79c --- /dev/null +++ b/R/data.R @@ -0,0 +1,14 @@ +#' @name conceptSets +#' @title Concept set definitions by use case +#' +#' @description +#' ConceptSets related to PHEMS variables are defined in ./data_raw/conceptSetsPHEMS.R. The base Capr library is used to fetch all descendant concepts +#' for each defined concept set, ensuring comprehensive coverage of related medical concepts. +#' +#' @details The script initializes by defining multiple concept sets within a list structure. Each concept set contains unique identifiers for medical concepts, +#' which are expanded to include all descendant concepts using the Capr library's functionality. The expanded concept sets are then stored in a new list within +#' the `conceptSets` object. Finally, the script outputs a confirmation message indicating successful sourcing and expansion of concept sets. +#' +#' @note This script requires the Capr library to be installed and loaded for proper execution. +#' @note Duplicated concepts within the same UC have been removed; keeping the first occurrence. +"conceptSets" \ No newline at end of file diff --git a/R/isStandard.R b/R/isStandard.R index 1afa16fc..3aad27bb 100644 --- a/R/isStandard.R +++ b/R/isStandard.R @@ -19,27 +19,35 @@ #' #' @importFrom readr read_csv write_csv #' @importFrom dplyr mutate across filter select inner_join -#' @importFrom DBI dbGetQuery +#' @importFrom DatabaseConnector connect disconnect querySql #' @export isStandard <- function(db_connection, data_concepts_path, vocab_schema, save_path = NULL) { - library(readr) - library(dplyr) - library(DBI) - + stopifnot("Error: No or invalid database connection" = DatabaseConnector::dbIsValid(db_connection)) + stopifnot("Error: No string provided as data_concepts_path. Please point to a directory of CSVs with fields 'conceptId' and 'source_code'" = is.character(data_concepts_path)) + stopifnot("Error: No string provided as vocab_schema" = is.character(vocab_schema)) + # Read concept table from SQL database - concept_table_query <- paste0( - "SELECT concept_id, concept_name, standard_concept FROM ", vocab_schema, ".concept" - ) - concept_table <- dbGetQuery(db_connection, concept_table_query) %>% - mutate(concept_id = as.character(concept_id)) %>% - mutate(concept_id = tolower(trimws(concept_id))) + concept_table_query <- SqlRender::render( + "SELECT concept_id, CONCEPT_NAME, standard_concept FROM @vocab_schema.concept", + vocab_schema = vocab_schema + ) + + concept_table_query_translated <- SqlRender::translate( + sql = concept_table_query, + targetDialect = attr(db_connection, "dbms") + ) + + concept_table <- DatabaseConnector::querySql(db_connection, concept_table_query_translated) |> + dplyr::rename(concept_id = CONCEPT_ID) |> + dplyr::mutate(concept_id = as.character(concept_id)) |> + dplyr::mutate(concept_id = tolower(trimws(concept_id))) # Initialize vectors for non-standard concepts nonStandard <- c() conceptNameNonStandard <- c() sourceCodeNonStandard <- c() sourceTableNonStandard <- c() - standardness <- c() + standard_concept <- c() # Get tables from data_concepts_path tables <- list.files(path = data_concepts_path, pattern = "\\.csv$", full.names = TRUE) @@ -48,58 +56,69 @@ isStandard <- function(db_connection, data_concepts_path, vocab_schema, save_pat if (length(tables) == 0) { stop("No CSV files found in the specified directory.") } - + + empty_tables <- c() for (table_path in tables) { table_name <- basename(table_path) # Read and prepare table tb <- - readr::read_csv(table_path, col_types = cols(sourceCode = col_character(), concept_id = col_character())) %>% - mutate(across(c(sourceCode, concept_id), ~gsub("\u00A0", " ", .))) %>% - mutate(across(c(sourceCode, concept_id), ~trimws(.))) %>% - filter(!is.na(sourceCode), !is.na(concept_id)) %>% - mutate(concept_id = tolower(concept_id), - concept_id = as.character(concept_id)) %>% - select(sourceCode, concept_id) + readr::read_csv(table_path, col_types = readr::cols( + sourceCode = readr::col_character(), + concept_id = readr::col_character() + )) |> + dplyr::mutate(across(c(sourceCode, concept_id), ~ gsub("\u00A0", " ", .))) |> + dplyr::mutate(dplyr::across(c(sourceCode, concept_id), ~ trimws(.))) |> + dplyr::filter(!is.na(sourceCode), !is.na(concept_id)) |> + dplyr::mutate( + concept_id = tolower(concept_id), + concept_id = as.character(concept_id) + ) |> + dplyr::select(sourceCode, concept_id) # Join tables - joined <- inner_join(concept_table, tb, by = "concept_id") + joined <- dplyr::inner_join(concept_table, tb, by = "concept_id")|> + dplyr::rename(standard_concept = STANDARD_CONCEPT, concept_name = CONCEPT_NAME) |> + dplyr::mutate(standard_concept = ifelse(is.na(standard_concept), 'Non-standard', standard_concept)) |> + dplyr::mutate(standard_concept = dplyr::recode( + standard_concept, + "S" = "Standard" + )) |> + dplyr::filter(!(standard_concept == "Standard")) # Add non-standard concept info to vectors - ind <- which(!(joined$standard_concept %in% c('S'))) + ind <- which(!(joined$standard_concept %in% c("S"))) nonStandard <- append(nonStandard, joined$concept_id[ind]) conceptNameNonStandard <- append(conceptNameNonStandard, joined$concept_name[ind]) sourceCodeNonStandard <- append(sourceCodeNonStandard, joined$sourceCode[ind]) - sourceTableNonStandard <- append(sourceTableNonStandard, - replicate(length(ind), table_name, simplify="vector")) - standardness <- append(standardness, joined$standard_concept[ind]) - - if (length(ind) == 0) { - message("No non-standard concepts found in list of concepts: ", table_name) - } else { - message(paste("Found ", length(ind), " non-standard concepts in list of concepts: ", table_name)) - } + sourceTableNonStandard <- append( + sourceTableNonStandard, + replicate(length(ind), table_name, simplify = "vector") + ) + standard_concept <- append(standard_concept, joined$standard_concept[ind]) # Save if not empty and save_path is provided if (!is.null(save_path) && nrow(joined) > 0) { - message(paste0("saving file: ", table_name)) - readr::write_csv(joined, paste0(save_path, "/", table_name)) + message(paste0("saving file: ./isStandard_", table_name)) + readr::write_csv(joined, paste0(save_path, "/isStandard_", table_name)) } else if (is.null(save_path)) { next } else { - message(paste("No matches found for concept set.\n")) + empty_tables <- append(empty_tables, table_name) + message(paste0("No matches found for file: ", data_concepts_path, "/", table_name, ".\n")) } } - - # NA == non-standard - standardness[is.na(standardness)] <- "Non-standard" + message(paste0("A file with the names of tables/files without non-standard concepts is saved here: ", + save_path, "/isStandard_OnlyStandard.txt")) + readr::write_file(paste(empty_tables, collapse="\n"), paste0(save_path, "/isStandard_OnlyStandard.txt")) + # Create table of non-standard concepts res <- tibble::tibble( concept_id = nonStandard, concept_name = conceptNameNonStandard, source_code = sourceCodeNonStandard, source_table = unlist(sourceTableNonStandard), - standardness = standardness + standard_concept = standard_concept ) message(paste0("Finished checking for non-standard concepts.\n", nrow(res), " non-standard concepts found across tables.")) diff --git a/R/isStandardCS.R b/R/isStandardCS.R index 322109f9..e24f4b3e 100644 --- a/R/isStandardCS.R +++ b/R/isStandardCS.R @@ -2,72 +2,72 @@ #' #' This function examines a concept set for non-standard concepts by comparing them against a standard concepts table in a SQL database. It identifies non-standard concepts and optionally saves the details of these non-standard concepts to a specified path. #' -#' @param db_connection A DBI database connection object to the SQL database containing the standard concepts table. This parameter is currently not used in the function but intended for future use where database queries might be necessary. #' @param conceptSet An object representing a set of concepts, containing details such as concept ID, concept name, and whether it is a standard concept. The structure of this object should support `@Expression` to access the individual concepts and their properties. #' @param save_path (Optional) The file path where the details of non-standard concepts should be saved as a CSV file. If not provided, the information will not be saved but will still be checked for non-standard concepts. #' -#' @return A tibble containing the columns `concept_name`, `concept_id`, `concept_set`, and `standard`, which represent the concept name, concept ID, the name of the concept set, and the standard status for each concept found to be non-standard or not classified as standard. +#' @return A tibble containing the columns `concept_name`, `concept_id`, `concept_set`, and `standard_concept`, which represent the concept name, concept ID, the name of the concept set, and the standard status for each concept found to be non-standard or not classified as standard. #' -#' @details The function processes a given concept set to identify non-standard concepts. Non-standard concepts are those not marked as 'S' (Standard) or 'C' (Classification) in their `standard_concept` attribute. The function creates a data frame with concept details, filters out standard and classification concepts, and if a `save_path` is provided, saves this information to a CSV file. If no non-standard concepts are found, appropriate messages are displayed. +#' @details The function processes a given concept set to identify non-standard concepts. Non-standard concepts are those not marked as 'S' (Standard) or 'C' (Classification) in their `standard_concept` attribute. The function creates a data frame with concept details, replaces empty `standard_concept` values with "Non-standard", filters out standard and classification concepts, and if a `save_path` is provided, saves this information to a CSV file. If no non-standard concepts are found, appropriate messages are displayed. #' #' @examples #' # Assuming you have a concept set `conceptSet`: -#' non_standard_concepts <- isStandardCS(db_conn, conceptSet, "path/to/save_standard_AND_non_standard/") +#' non_standard_concepts <- isStandardCS(conceptSet, "path/to/save_standard_AND_non_standard/") #' #' @export -isStandardCS <- function(db_connection, conceptSet, save_path = NULL) { - library(readr) - library(dplyr) - library(DBI) - +isStandardCS <- function(conceptSet, save_path = NULL) { + stopifnot("Error: No valid Capr concept set provided. Ensure the class of your conceptSet is 'ConceptSet' from the Capr package" = !is.null(conceptSet) && class(conceptSet) == "ConceptSet") + stopifnot("Error: save_path is not a string" = is.null(save_path) | is.character(save_path)) + # Initialize vectors for non-standard concepts nonStandard <- c() conceptNameNonStandard <- c() sourceCodeNonStandard <- c() sourceTableNonStandard <- c() - standardness <- c() + standard_concept <- c() # Get concept set details cs <- conceptSet@Expression # initialize vectors - concept_name = c() - concept_id = c() - concept_set = c() - standardness = c() + concept_name <- c() + concept_id <- c() + concept_set <- c() + standard_concept <- c() for (concept in cs) { concept_name <- append(concept_name, concept@Concept@concept_name) concept_id <- append(concept_id, concept@Concept@concept_id) - standardness <- append(standardness, concept@Concept@standard_concept) + standard_concept <- append(standard_concept, concept@Concept@standard_concept) } cs_name <- conceptSet@Name concept_set <- rep.int(cs_name, length(concept_id)) - + # Replace NAs with non-standard - standardness[is.na(standardness)] <- "Non-standard" + standard_concept[standard_concept == ""] <- "Non-standard" # Filter out standard and classification concepts; keep non-standard and NA df <- data.frame( concept_name, concept_id, concept_set, - standardness + standard_concept ) # Save if not empty and save_path is provided if (!is.null(save_path) && nrow(df) > 0) { - message(paste0("saving file: CONCEPTSET_", cs_name)) - write_csv(df, paste0(save_path, "/CONCEPTSET_", cs_name, ".csv")) + message(paste0("saving file: isStandardCS_", cs_name)) + readr::write_csv(df, paste0(save_path, "/isStandardCS_", cs_name, ".csv")) } else if (is.null(save_path)) { message("No save path specified; returning non-standard concepts\n") } else { - message(paste0("No matches found for concept set: ", table_name, "\n")) + message(paste0("No matches found for concept set: ", cs_name, "\n")) } # NonStandard concepts - res <- df %>% filter(standardness != "S" | is.na(standardness)) %>% tibble::tibble() + res <- df |> + dplyr::filter(standard_concept != "S" | is.na(standard_concept)) |> + tibble::tibble() if (nrow(res) == 0) { message("No non-standard concepts found in concept set: ", cs_name) } else { diff --git a/R/isStandardDB.R b/R/isStandardDB.R new file mode 100644 index 00000000..4118f849 --- /dev/null +++ b/R/isStandardDB.R @@ -0,0 +1,100 @@ +#' Identify Non-Standard Concepts in Database +#' +#' This function checks a set of tables for non-standard concepts by comparing them against the concept table in a SQL database. It identifies non-standard concepts and optionally saves the joined tables containing these non-standard concepts. +#' +#' @param db_connection A DBI database connection object to the SQL database containing the standard concepts table. +#' @param cdm_schema The schema name of the Common Data Model (CDM) database containing the source tables. +#' @param vocab_schema The schema name of the vocabulary database containing the standard concepts table. +#' @param links A named list where each name is a table name and each value is a vector of two strings: the column names for `concept_id` and `source_code` in that table. +#' @param save_path (Optional) The file path where the joined tables containing non-standard concepts should be saved. If not provided, the tables will not be saved but will still be checked for non-standard concepts. +#' +#' @return A tibble containing the columns `concept_id`, `concept_name`, `source_code`, and `source_table`, representing the concept ID, concept name, source code, and source table name for each non-standard concept found. +#' +#' @details The function first queries the `concept` table from the provided SQL database to retrieve the standard concepts. It then reads each specified table, preparing and joining it with the standard concepts table based on the concept ID. Non-standard concepts are identified based on the `standard_concept` column being `NA`. Information about these non-standard concepts is collected and returned as a tibble. The function also adds a `source_table` column to indicate the source table name. +#' +#' If a `save_path` is provided, each joined table (including both standard and non-standard concepts) is saved to the specified directory with the same name as the original table file. +#' +#' @examples +#' # Assuming you have a valid DBI connection `db_conn` and your tables are specified in the `links` list: +#' links <- list( +#' "table1" = c("concept_id_col1", "source_code_col1"), +#' "table2" = c("concept_id_col2", "source_code_col2") +#' ) +#' non_standard_concepts <- isStandardDB(db_conn, "cdm_schema", "vocab_schema", links, "path/to/save_non_standard/") +#' +#' @importFrom readr read_csv write_csv +#' @importFrom dplyr mutate filter rename bind_rows +#' @importFrom DatabaseConnector querySql +#' @importFrom SqlRender render translate +#' @export +isStandardDB <- function(db_connection, cdm_schema, vocab_schema, links, save_path) { + stopifnot("Error: No or invalid database connection" = DatabaseConnector::dbIsValid(db_connection)) + stopifnot("Error: No string provided as cdm_schema" = is.character(cdm_schema)) + stopifnot("Error: No string provided as vocab_schema" = is.character(vocab_schema)) + stopifnot("Error: No valid links between tables and concept id fields provided" = is.list(links)) + stopifnot("Error: No string provided as save path" = is.null(save_path) | is.character(save_path)) + + # get tables + tables <- names(links) + + empty_tables <- c() + for (table in tables) { + # Read concept table from SQL database + concept_table_query <- SqlRender::render(sprintf( + " + WITH source_table AS ( + -- Select the unique concept_id and source code from the specified source table + SELECT DISTINCT %s AS concept_id, %s AS source_code + FROM %s.%s + ) + SELECT a.concept_id, a.concept_name, source_table.source_code, a.standard_concept + FROM %s.concept a + JOIN source_table ON a.concept_id = source_table.concept_id + ORDER BY source_table.concept_id + ", + links[[table]][1], links[[table]][2], cdm_schema, table, vocab_schema) + ) + + concept_table_query_translated <- SqlRender::translate( + sql = concept_table_query, + targetDialect = attr(db_connection, "dbms") + ) + + concept_table <- DatabaseConnector::querySql(db_connection, concept_table_query_translated) |> + dplyr::rename( + concept_id = CONCEPT_ID, + concept_name = CONCEPT_NAME, + source_code = SOURCE_CODE, + standard_concept = STANDARD_CONCEPT) |> + dplyr::mutate(concept_id = as.character(concept_id)) |> + dplyr::mutate(concept_id = tolower(trimws(concept_id))) + concept_table["source_table"] <- rep.int(table, nrow(concept_table)) + nonStandardDF <- concept_table |> dplyr::filter(is.na(standard_concept)) + + # Initialize res on first loop iteration + if (!exists("res")) { + res <- nonStandardDF + } else { + res <- dplyr::bind_rows(res, nonStandardDF) + } + + # Save if not empty and save_path is provided + if (!is.null(save_path) && nrow(res) > 0) { + readr::write_csv(concept_table, paste0(save_path, "/isStandardDB_", table)) + message(paste0("Saved results to ", save_path, "/isStandardDB_", table, "\n")) + } else if (is.null(save_path)) { + message("No save path provided, only returning non-standard concepts DF") + } else if (nrow(res) == 0) { + empty_tables <- append(empty_tables, table) + message("No non-standard concepts found in DB; not saving any file.\n") + } + } + + # Save file with empty tables + message(paste0("A file with the names of tables/files without non-standard concepts is saved here: ", + save_path, "/isStandardDB_OnlyStandard.txt")) + readr::write_file(paste(empty_tables, collapse=""), paste0(save_path, "/isStandardDB_AllStandard.txt")) + + message(paste0("Finished checking for non-standard concepts.\n", nrow(res), " non-standard concepts found across tables.")) + return(res) +} diff --git a/R/table_linked_to_concept_field.R b/R/table_linked_to_concept_field.R index 21e8ab84..9ddcaf79 100644 --- a/R/table_linked_to_concept_field.R +++ b/R/table_linked_to_concept_field.R @@ -31,15 +31,15 @@ #' #' @export links <- list( - condition_occurrence = "condition_concept_id", - death = "cause_concept_id", - device_exposure = "device_concept_id", - drug_exposure = "drug_concept_id", - measurement = "measurement_concept_id", - observation = "observation_concept_id", - procedure_occurrence = "procedure_concept_id", - specimen = "specimen_concept_id", - visit_occurrence = "visit_concept_id" + condition_occurrence = c("condition_concept_id", "condition_source_value"), + death = c("cause_concept_id", "cause_source_value"), + device_exposure = c("device_concept_id", "device_source_value"), + drug_exposure = c("drug_concept_id", "drug_source_value"), + measurement = c("measurement_concept_id", "measurement_source_value"), + observation = c("observation_concept_id", "observation_source_value"), + procedure_occurrence = c("procedure_concept_id", "procedure_source_value"), + specimen = c("specimen_concept_id", "specimen_source_value"), + visit_occurrence = c("visit_concept_id", "visit_source_value") ) -cat("Sourced links object") \ No newline at end of file +cat("Sourced links object\n") \ No newline at end of file diff --git a/README.md b/README.md index fd2f4d64..79f8d1a6 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,16 @@ For Capr-PHEMS, it is recommended to clone the repo and work from the template s Please make sure you have the following: - R version >= 4.4.0 - RStudio >= 2024.04.2 -- (CRAN library) renv >= 1.0.7 -1. Clone the repo: +1a. Clone the repo: ``` git clone https://github.com/thehyve/Capr-PHEMS.git ``` +1b. Install CaprPHEMS: +``` +devtools::install_local(") +``` 2. Navigate to ./inst/config/. Here you will find two sample configuration files; config-sample.yml and connection_config-sample.yml @@ -56,11 +59,14 @@ and fill in your configuration details. 4a. Open RStudio and verify renv >= 1.0.7 is installed by calling packageVersion("renv"). If not installed, call install.packages("renv) -4b. In the top-right "Project" dropdown menu, select "Open Project" and open ./Capr-PHEMS.Rproj +4b. In the top-right "Project" dropdown menu, select "Open Project" and open ./CaprPHEMS.Rproj 4c. .Rprofile will be sourced when opening the project; this will trigger renv::init() to initialize the environment. When prompted whether to use a DESCRIPTION file for dependency discovery, select option 1 to use the DESCRIPTION file. Next, you may be prompted the project already has a lockfile with another set of options. Here also select option 1 to restore the project from the lockfile. This will install all required packages to the environment. Your renv is now activated. -5. A template script is provided under ./inst/templates/ as both an R script and .Rmd file. The code between these files is identical. It is recommended to start by using the .Rmd file, so chunks of code can easily be run at will. These chunks of code are self-explanatory. These templates serve as examples of how Capr and Capr-PHEMS can be used and it is encouraged to modify them locally as you see fit. +5. Run inst/scripts/main.R. This will save all the by The Hyve requested files to your device under inst/extdata/standardness for non-standard concept checks or inst/extdata/countoccurrences for the countOccurrences function. Please confirm these saved results may be shared prior to sharing. + + +To better understand the functions and what they require and produce, the user may take a look at extras/Capr-PHEMS_examples.Rmd (or extras/pdf_vignettes/Capr-PHEMS_examples.Rmd). Examples with sample data are provided along with executable code in this MD script. # User Documentation diff --git a/data/conceptSets.rda b/data/conceptSets.rda new file mode 100644 index 00000000..e552939d Binary files /dev/null and b/data/conceptSets.rda differ diff --git a/inst/templates/cohortCapr_md.Rmd b/extras/Capr-PHEMS_examples.Rmd similarity index 57% rename from inst/templates/cohortCapr_md.Rmd rename to extras/Capr-PHEMS_examples.Rmd index 27eee34a..1debcc2f 100644 --- a/inst/templates/cohortCapr_md.Rmd +++ b/extras/Capr-PHEMS_examples.Rmd @@ -1,17 +1,17 @@ --- -title: "cohortCapr markdown" +title: "CaprPHEMS example usage" author: "Guus @TheHyve" -date: "2024-07-17" +date: "2024-08-29" output: pdf_document --- -## Set-up knitr +## Set-up ```{r knitr, include=FALSE} knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) knitr::opts_chunk$set(echo = TRUE) # knitr::purl( -# input = './inst/templates/cohortCapr_md.Rmd', +# input = './inst/templates/cohortCapr_examples.Rmd', # output = './inst/templates/cohortCapr.R' # ) ``` @@ -32,7 +32,10 @@ library(CirceR) library(Capr) ``` -## Connect to DB +## Create connection details +Here we specify our connection details. In this case, we use a yml configuration file +to specify our connection details. Alternatively, strings may be used directly to assign +the function arguments. These details will allow us to connect to the DB / OMOP CDM instance. ```{r connect to database, eval=TRUE, include=TRUE} # Use connection details from configuration connectionDetails <- createConnectionDetails( @@ -47,17 +50,22 @@ connectionDetails <- createConnectionDetails( ``` ## Concept sets -Define a measurement concept set using Capr and include all descendants +Concept sets have been defined per use case in ./R/conceptSets.R. +Here we collect the details for all concept ids in all created concept sets +using the Capr::getConceptSetDetails() function. This can only be done for +concepts that exist within the concept set; not for descendants of these concepts. +This function can be applied to any concept set and returns the concept_name, +standardness, the domain, the source vocabulary and code, and more. ```{r concept sets, echo=TRUE} ## Concept sets -source("./R/conceptSets.R") +data(conceptSets) # Establish connection con <- connect(connectionDetails) conceptSets$conceptSets <- conceptSets$conceptSets %>% # Add details for all concepts (excl. descendants) - lapply(FUN = getConceptSetDetails, + lapply(FUN = Capr::getConceptSetDetails, con = con, vocabularyDatabaseSchema = connectionConfig$vocabulary_schema) @@ -66,10 +74,12 @@ disconnect(con) ``` ## Concept counts -Retrieve counts for a concept set +Retrieve counts for all concepts in a concept set. +Return the counts on the person (1) and record (2) level for each concept expli- +citly in the concept set and on the person (3) and record (4) level including +all descendants of concepts in the conceptSet. ```{r count occurences} ## Count occurrences of each concept in data - # Establish connection con <- connect(connectionDetails) @@ -79,14 +89,14 @@ source("./R/countOccurrences.R") # Get links between tables and fields as input source("./R/table_linked_to_concept_field.R") -additionalVarsCounts <- +uc1Counts <- countOccurrences( - conceptSets$concepts$additional, - c("condition_occurrence", "procedure_occurrence", "measurement", "observation"), - links, - con, - connectionConfig$cdm_schema, - connectionConfig$vocabulary_schema, + v = conceptSets$concepts$uc1, + tables = names(links), # Query all CDM tables + links = links, # Links between tables and concept_id fields (cdm_table:field) + db_connection = con, + cdm_schema = connectionConfig$cdm_schema, + vocab_schema = connectionConfig$vocabulary_schema, save_path = config_oth$save_path_counts ) %>% print() @@ -94,9 +104,26 @@ additionalVarsCounts <- disconnect(con) ``` +## Standard and non-standard concepts given a database connection +The isStandardDB function checks for every concept used in a CDM instance whether it is standard or not. It works by joining the CDM tables to the concept table in the vocabulary schema on the concept_id. The function returns a table of non-standard concepts. +```{r Standardness check DB} +# Connect to DB +con <- connect(connectionDetails) + +# Return table of non-standard concepts +source('./R/isStandardDB.R') +nonStandardDB <- isStandardDB( + db_connection = con, + cdm_schema = connectionConfig$cdm_schema, + vocab_schema = connectionConfig$vocabulary_schema, + links = links, # Links between tables and concept_id fields (cdm_table:field) + save_path = config_oth$save_path_isStandard +) %>% print() +``` + ## Standard and non-standard concepts given a list of concept IDs -To check for each concept in a list of concept_ids and source codes, the "isStandard.R" function -can be used. This takes as input a list of concept_ids and source codes and returns a table of non-standard concepts. +To check for each concept in a list of concept_ids and source codes, the "isStandard.R" function is used. This function takes as input a list of concept_ids and source codes and returns a table of non-standard concepts. Saved results include all concepts regardless +of standardness. See inst/extdata/phems-variable-list for examples of CSVs tables in the expected format. ```{r Standard non-standard check} # Connect to DB @@ -121,19 +148,18 @@ nonStandard ``` ## Standard and non-standard concepts given a concept set -Similarly to isStandard(), isStandardCS() can be used to check the standardness of concepts, but rather given a concept set than a list. +Similarly to isStandard(), isStandardCS() can be used to check the standardness of concepts, but rather given a concept set than a list. The function returns a table of non-standard concepts. Saved results include all concepts regardless of standardness. ```{r Standard non-standard check concept set} # connect to DB con <- connect(connectionDetails) -# run for labTests conceptSet -labTests <- conceptSets$conceptSets$labTests +# run for uc2 conceptSet +uc2 <- conceptSets$conceptSets$uc2 # check standardness across concept set source('./R/isStandardCS.R') nonStandardCS <- isStandardCS( - db_connection = con, - conceptSet = conceptSets$conceptSets$labTests, + conceptSet = conceptSets$conceptSets$uc2, # (optional) Save the results (with standard and non-standard concepts) save_path = config_oth$save_path_isStandard ) @@ -145,43 +171,48 @@ disconnect(con) nonStandardCS ``` - ## Initial event cohort -People having any of the following: -any of the lab test measurements -limit to first/earliest occurrence of any of the above measurements (+descendants) per person +NOTE: the cohort defined in this chunk serves solely as an example. +Here we define a cohort for UC1. ```{r Cohort definition} ## Cohort definition # Create cohort definition ch <- cohort( entry = entry( - # enter patients who have had cardiac surgery - procedure(conceptSets$conceptSets$cardiacSurgery), + # enter patients with conditions that would be in UC1 + conditionOccurrence(conceptSets$conceptSets$uc1), observationWindow = continuousObservation(0, 0), primaryCriteriaLimit = "All" ), attrition = attrition( - withAny( - # include all cardiac complications - atLeast( - x = 1, - # include all cardiac complications represented by condition concepts - query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications) + # keep patients with all criteria matched: + withAll( + # criteria 1 is defined by this withAny clause: + # keep patients with any of the following: + withAny( + # include patients with at least 1 cardiac complication... + atLeast( + x = 1, + # with cardiac complications represented by condition concepts and... + query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications) + ), + atLeast( + x = 1, + # with cardiac complications represented by procedure concepts. + query = procedure(conceptSets$conceptSets$cardiacComplications) + ) ), - atLeast( - x = 1, - # include all cardiac complications represented by procedure concepts - query = procedure(conceptSets$conceptSets$cardiacComplications) - ) - ), - withAny( - atLeast( - x = 1, - # include patients who have had laboratory measurements - query = measurement(conceptSets$conceptSets$labTests) + # criteria 2 is defined by the second withAny clause: + # include patients who have had at least 1 laboratory measurement + withAny( + atLeast( + x = 1, + query = measurement(conceptSets$conceptSets$labTests) + ) ) ) ), + # end of cohort at end of observation period exit = exit( endStrategy = observationExit() ) @@ -189,6 +220,7 @@ ch <- cohort( ``` ## Write json expressions and sql queries +json expressions can be used to save the cohort definitions and to generate SQL queries ```{r json and sql} ## Cohort json and sql # Generate json for cohort @@ -204,6 +236,7 @@ sql <- CirceR::buildCohortQuery( ) ``` +## Save cohort and concept set jsons Save the cohort and concept set jsons; these can be imported into ATLAS ```{r Save cohort and concept set json} write(chJson, paste0(config_oth$save_path_json, "/cohort.json")) @@ -215,6 +248,7 @@ for (cs in names(conceptSets$conceptSets)) { } ``` +## Query the cohorts using the SQL query ```{r Create and generate cohorts} # Establish connection con <- connect(connectionDetails) @@ -231,7 +265,7 @@ cohortTableNames <- CohortGenerator::getCohortTableNames(cohortTable = "cohort") CohortGenerator::createCohortTables( connectionDetails = connectionDetails, cohortDatabaseSchema = "cohort", - cohortTableNames = cohortTableNames, + cohortTableNames = cohortTableNames ) # Generate the cohorts @@ -252,9 +286,6 @@ cohortCounts <- CohortGenerator::getCohortCounts( # Disconnect disconnect(con) - - -cohortCounts ``` ## Number of people in db diff --git a/extras/pdf_vignette/Capr-PHEMS_examples.pdf b/extras/pdf_vignette/Capr-PHEMS_examples.pdf new file mode 100644 index 00000000..a76d702c Binary files /dev/null and b/extras/pdf_vignette/Capr-PHEMS_examples.pdf differ diff --git a/inst/config/config-sample.yml b/inst/config/config-sample.yml index 93cffcbf..dd61f00f 100644 --- a/inst/config/config-sample.yml +++ b/inst/config/config-sample.yml @@ -1,15 +1,21 @@ --- +# 1. Copy this file using [cp ./config/config-sample.yml ./config/config.yml] +# 2. In the new file, add the paths under the `config` key; changes in default values will have no effect. + +#========================================================================================================= ## Default configuration values # Default values are necessary for the `config` CRAN library, not used in package otherwise # No need to change these values default: - concepts_path: 'inst/extdata/phems_variable_list' # required for isStandard() function; specifies path to concept list directory with sourceCode and concept_id - save_path_isStandard: 'inst/extdata/phems_variable_list/is_standard' # (optional) if saving standard concept check results. Point to existing directory. - save_path_json: 'inst/extdata/json' # (optional) if saving cohort and/or concept set as json). Point to existing directory + concepts_path: './inst/extdata/phems_variables/' # required for isStandard() function; specifies path to concept list directory with sourceCode and concept_id + save_path_isStandard: './inst/extdata/standardness' # (optional) if saving standard concept check results. Point to existing directory. + save_path_json: './inst/extdata/json' # (optional) if saving cohort and/or concept set as json). Point to existing directory + save_path_counts: './inst/extdata/countoccurrences' # where to save results from countOccurrences() ## Paths for CSVs of concepts and saves -# Replace with your paths +# Add your paths here config: concepts_path: '' save_path_isStandard: '' - save_path_json: '' \ No newline at end of file + save_path_json: '' + save_path_counts: '' \ No newline at end of file diff --git a/inst/config/connection_config-sample.yml b/inst/config/connection_config-sample.yml index 1e2bc71e..ac8a1d54 100644 --- a/inst/config/connection_config-sample.yml +++ b/inst/config/connection_config-sample.yml @@ -1,18 +1,22 @@ --- +# 1. Copy this file using [cp ./config/connection_config-sample.yml ./config/connection_config.yml] +# 2. In the new file, add your connection details under the `config` key; changes in default values will have no effect. + +#=============================================================================================== ## Default configuration values # Default values are necessary for the `config` CRAN library, not used in package otherwise # No need to change these values; they are unused default: dbms: 'postgres' # Database management system - user: 'postgres' - password: null - server: localhost/omop_db - port: 5432 - oracleDriver: null - pathToDriver: '~/jdbc/' - cdm_schema: 'cdm' - vocabulary_schema: 'vocab' - cohort_schema: 'cohort' + user: 'postgres' # username + password: null # password + server: localhost/omop_db # server + port: 5432 # port + oracleDriver: null # Oracle driver + pathToDriver: '~/jdbc/' # path to driver + cdm_schema: 'cdm' # schema where the OMOP CDM is stored + vocabulary_schema: 'vocab' # schema where the vocabulary tables are stored + cohort_schema: 'cohort' # schema where the cohort tables are stored (may be left empty if not using cohorts for now) ## Connection details # Replace with your connection details @@ -22,7 +26,7 @@ default: # as not all of these details may be required. # cdm_schema should point to the OMOP CDM schema # vocabulary_schema should point to the schema where the vocabulary tables are stored -# cohort_schema should point to the schema where the cohort tables are stored +# cohort_schema should point to the schema where the cohort tables are stored; this is only necessary to provide if you are using cohorts # All schemas should be EXISTING in the database config: dbms: '' diff --git a/inst/extdata/countoccurrences/.gitignore b/inst/extdata/countoccurrences/.gitignore new file mode 100644 index 00000000..444668a5 --- /dev/null +++ b/inst/extdata/countoccurrences/.gitignore @@ -0,0 +1,2 @@ +!.gitignore +* \ No newline at end of file diff --git a/inst/extdata/json/.gitkeep b/inst/extdata/json/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/inst/extdata/phems_variable_list/5.25_arterial_blood_gas.csv b/inst/extdata/phems_variable_list/5.25_arterial_blood_gas.csv deleted file mode 100644 index 9db01561..00000000 --- a/inst/extdata/phems_variable_list/5.25_arterial_blood_gas.csv +++ /dev/null @@ -1,87 +0,0 @@ -sourceCode,concept_id -pH ,3019977  -pCO2 ,3027946  -pCO2 ,44777602  -pCO2 ,8876  -PaO2 ,3027801  -PaO2 ,44777602  -PaO2 ,8876  -HCO3 ,3008152  -HCO3 ,8753  -Base excess ,3003396  -Base excess ,8753  -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, diff --git a/inst/extdata/phems_variable_list/5.26_venous_blood_gas.csv b/inst/extdata/phems_variable_list/5.26_venous_blood_gas.csv deleted file mode 100644 index 610e92e9..00000000 --- a/inst/extdata/phems_variable_list/5.26_venous_blood_gas.csv +++ /dev/null @@ -1,87 +0,0 @@ -sourceCode,concept_id, -pH ,3012544 , -pH ,3009343 , -pCO2 ,3021447 , -pCO2 ,3023024 , -pCO2 ,44777602 , -pCO2 ,8876 , -PaO2 ,3024354 , -PaO2 ,3028626 , -PaO2 ,44777602 , -PaO2 ,8876 , -HCO3 ,3027273 , -HCO3 ,3015235 , -HCO3 ,8753 , -Base excess,3002032 , -Base excess,3003129 , -Base excess,8753 , -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, diff --git a/inst/extdata/phems_variable_list/5.28_patient_characteristics.csv b/inst/extdata/phems_variable_list/5.28_patient_characteristics.csv deleted file mode 100644 index ee0ddb64..00000000 --- a/inst/extdata/phems_variable_list/5.28_patient_characteristics.csv +++ /dev/null @@ -1,87 +0,0 @@ -sourceCode,concept_id, -body weight ,3025315 , -body weight ,9529 , -body weight ,8504 , -height ,3036277 , -height ,8582 , -height ,9546 , -hemophilia A diagnosis ,434007 , -hemophilia A subtype/ severity ,4094223 , -hemophilia A subtype/ severity ,4140661 , -hemophilia A subtype/ severity ,4056830 , -blood group ,3003694 , -factor VIII inhibitor status ,37393608 , -factor VIII inhibitor status ,4126681 , -factor VIII inhibitor status ,9190 , -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, diff --git a/inst/extdata/phems_variable_list/5.29_lab_measurements_uc3.csv b/inst/extdata/phems_variable_list/5.29_lab_measurements_uc3.csv deleted file mode 100644 index 8da65eab..00000000 --- a/inst/extdata/phems_variable_list/5.29_lab_measurements_uc3.csv +++ /dev/null @@ -1,37 +0,0 @@ -sourceCode,concept_id -factor VIII inhibitor titer ,3024942  -factor VIII inhibitor titer ,44777562  -factor VIII activity measurement ,3022520  -factor VIII activity measurement ,3011832  -factor VIII activity measurement ,8985  -factor VIII activity measurement ,9332  -factor VIII activity measurement ,8554  -Von Willebrand factor activity measurement ,43534000  -Von Willebrand factor activity measurement ,8985  -Von Willebrand factor activity measurement ,9332  -Von Willebrand factor activity measurement ,8554  -Von Willebrand factor antigen measurement ,3002124  -Von Willebrand factor antigen measurement ,8985  -Von Willebrand factor antigen measurement ,9332  -Von Willebrand factor antigen measurement ,8554  -Von Willebrand factor propeptide measurement ,3023693  -Von Willebrand factor propeptide measurement ,3042349  -Von Willebrand factor propeptide measurement ,8763  -activated partial thromboplastin time (APTT) ,4175016   -activated partial thromboplastin time (APTT) ,8555  -activated partial thromboplastin time (APTT) ,8523  -Prothrombin time (PT) ,3034426  -Prothrombin time (PT) ,8555  -Prothrombin time (PT) ,8523  -Prothrombin time (PT) ,8554  -platelet count ,4267147 -platelet count ,44777588  -hematocrit ,3009542  -hematocrit ,44777604  -hematocrit ,8554 -fibrinogen ,3016407  -fibrinogen ,8636  -ALT ,3006923  -ALT ,8645  -AST ,3013721  -AST ,8645  diff --git a/inst/extdata/phems_variable_list/5.30_treatments.csv b/inst/extdata/phems_variable_list/5.30_treatments.csv deleted file mode 100644 index 0dafecd2..00000000 --- a/inst/extdata/phems_variable_list/5.30_treatments.csv +++ /dev/null @@ -1,85 +0,0 @@ -sourceCode,concept_id, -factor VIII  ,35766745 , -factor VIII  ,21154209 , -factor VIII  ,35831239 , -factor VIII  ,40745282 , -factor VIII  ,8985 , -factor VIII dose is continuous infusion or bolus dose ,40492862 , -factor VIII dose is continuous infusion or bolus dose ,4129275 , -factor VIII dose is continuous infusion or bolus dose ,4265597 , -desmopressin ,1517070 , -desmopressin ,9655 , -desmopressin ,8576 , -desmopressin ,9662 , -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, diff --git a/inst/extdata/phems_variable_list/5.31_surgery_specific_parameters.csv b/inst/extdata/phems_variable_list/5.31_surgery_specific_parameters.csv deleted file mode 100644 index 50ae5fb3..00000000 --- a/inst/extdata/phems_variable_list/5.31_surgery_specific_parameters.csv +++ /dev/null @@ -1,85 +0,0 @@ -sourceCode,concept_id, -Medical/ surgical procedure ,45888085 , -NaCl administration during surgery ,967823 , -,8587 , -plasma administration during surgery ,4028665 , -datetime start anesthesia ,45888867 , -blood loss during surgery ,4308716 , -blood transfusion during surgery ,37017589 , -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, -,, diff --git a/inst/extdata/phems_variable_list/is_standard/5.10_cardiac_radiology.csv b/inst/extdata/phems_variable_list/is_standard/5.10_cardiac_radiology.csv deleted file mode 100644 index 133cfabd..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.10_cardiac_radiology.csv +++ /dev/null @@ -1,43 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4019824,Transesophageal echocardiography,S,US transoesophageal echocardiogram (toe) -4032404,Bronchoscopy,S,IR bronchoscopy -4065416,Exercise tolerance test,S,Exercise test (non-CPET) -4345925,Videofluoroscopy swallow,S,FL video swallow -4083106,US scan of head,S,US cranial contents -4083108,US scan of neck,S,US neck -4082979,MRI of head,S,MRI head -4093436,Ultrasonography of thorax,S,US thorax and pleural cavity -4125350,CT of head,S,CT head -4125530,US urinary tract,S,US urinary tract -44802640,MRI study for cardiac congenital anomaly,S,MRI cardiac complex congenital -4163872,Plain chest X-ray,S,XR chest -4167029,Ultrasonography of inguinal region,S,US doppler groin both -4167052,Doppler ultrasonography of kidney,S,US doppler renal both -4305221,US scan of abdomen and pelvis,S,US abdomen and pelvis/ US abdomen -4303522,US scan of diaphragm,S,US diaphragmatic region -4306317,CT angiography of coronary artery with contrast,S,CT heart with contrast/ CT cardiac angiogram coronary/ CT cardiac gated with contrast -4169275,X-ray of chest and abdomen,S,XR chest and abdomen -4322380,Insertion of peripherally inserted central catheter,S,IR PICC line insertion -4140473,Holter extended electrocardiographic recording,S,24h holter monitor -4329508,Ultrasonography of pleural cavity,S,US thorax and pleural cavity -4335392,Doppler ultrasonography of vein of lower limb,S,US doppler lower limb veins both -4203365,Epicardial echocardiography,S,Epicardial echocardiogram -4335825,Transthoracic echocardiography,S,US transthoracic echocardiogram/ us transthoracic echocardiogram (pre- admission)/ US transthoracic echocardiogram (sedated) -40482732,Insertion of tunneled venous catheter,S,IR tunnelled central venous line insertion -40489841,Doppler ultrasonography of jugular vein,S,US doppler jugular vein both -40492338,Cardiopulmonary exercise test,S,Cardiopulmonary exercise test (CPET) -40488431,Interrogation of cardiac pacemaker,S,Pacemaker/ICD interrogation (in clinic)/ pacemaker/ICD interrogation (other) -42873079,Removal of tunneled central venous catheter,S,IR tunnelled central venous line removal -4261497,Ultrasonography of abdomen,S,US abdomen and pelvis/ US abdomen -4205144,Portable electroencephalogram,S,EEG routine portable -4181917,Electroencephalogram,S,EEG routine -4264477,Diagnostic radiography of abdomen,S,XR abdomen -45764527,Electrocardiographic Holter analyzer,S,24h holter monitor -45765560,Cardiovascular monitor,S,Event monitor -4327032,CT of thorax with contrast,S,CT thorax with contrast -35622931,Doppler ultrasound,S,US doppler groin both -35622931,Doppler ultrasound,S,US doppler -44813863,Ultrasonography of vocal cord,S,US vocal cord -4312208,Contrast bronchogram,S,IR bronchogram -4235141,Check artificial pacemaker,S,Pacemaker/ICD device check - remote patient initiated -4235141,Check artificial pacemaker,S,Pacemaker/ICD device check - remote device initiated diff --git a/inst/extdata/phems_variable_list/is_standard/5.11_cardiac_los.csv b/inst/extdata/phems_variable_list/is_standard/5.11_cardiac_los.csv deleted file mode 100644 index 1c4e01ec..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.11_cardiac_los.csv +++ /dev/null @@ -1,5 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4123933,Admission to pediatric intensive care unit,S,ICU admission (start datetime and end datetime) -8715,Hospital admission,S,Total hospital admission (start datetime and end datetime) -4161811,Admission to high dependency unit,S,HDU admission (start datetime and end datetime) -36675203,Admission to pediatric cardiology department,S,Cardiology ward admission (start datetime and end datetime) diff --git a/inst/extdata/phems_variable_list/is_standard/5.12_additional.csv b/inst/extdata/phems_variable_list/is_standard/5.12_additional.csv deleted file mode 100644 index 0948628d..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.12_additional.csv +++ /dev/null @@ -1,36 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4124462,None,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -4095105,Base deficit measurement,S,Base Excess -4123933,Admission to pediatric intensive care unit,S,Elective ICU admission -4234469,Diagnosis,S,Diagnoses -40493026,Mechanical ventilator,S,Mechanical ventilation -44803020,Primary reason for admission,S,"Reason for ICU admission: (Main reason for ICU admission is not recovery from surgery or a procedure, Recovery from a bypass cardiac procedure, recovery from a non-bypass cardiac procedure, recovery from non-cardiac procedure)" -4209008,Pupillary function,S,Pupillary reaction -260134,Croup,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -432571,Malignant lymphoma,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -4029498,Seizure disorder,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -317009,Asthma,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -201957,Necrotizing enterocolitis in fetus OR newborn,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -43530727,Spontaneous cerebral hemorrhage,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -29783,Severe combined immunodeficiency disease,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -321042,Cardiac arrest,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -4165112,Bronchiolitis,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -443727,Diabetic ketoacidosis,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -314383,Myocarditis,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -4245975,Hepatic failure,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -440207,Hypoplastic left heart syndrome,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -42537745,Bone marrow transplant present,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -442588,Obstructive sleep apnea syndrome,S,"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder" -4213310,Degenerative disease of the central nervous system,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -321319,Cardiomyopathy,S,"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis)" -317510,Leukemia,S,"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure" -44777602,kilopascal,S,PaCO2 -9202,Outpatient Visit,S,"Outpatient appointments start datetime, end datetime" -8554,percent,S,FiO2 -8876,millimeter mercury column,S,Systolic blood pressure -8876,millimeter mercury column,S,PaCO2 -8753,millimole per liter,S,Base Excess -5083,Telehealth,S,Outpatient appointment type (telephone/ clinic visit etc.) -42869590,Oxygen/Gas total [Pure volume fraction] Inhaled gas,S,FiO2 -3027946,Carbon dioxide [Partial pressure] in Arterial blood,S,PaCO2 -3004249,Systolic blood pressure,S,Systolic blood pressure diff --git a/inst/extdata/phems_variable_list/is_standard/5.13_laboratory_tests.csv b/inst/extdata/phems_variable_list/is_standard/5.13_laboratory_tests.csv deleted file mode 100644 index b3cf6426..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.13_laboratory_tests.csv +++ /dev/null @@ -1,61 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -37399161,Blood arterial pH,S,pH (arterial) -37392672,Blood venous pH,S,pH (venous) -4267147,Platelet count,S,Platelet count -4298431,White blood cell count,S,Immature WBC count -8713,gram per deciliter,S,Hemoglobin -8713,gram per deciliter,S,Albumin -8636,gram per liter,S,Hemoglobin -8636,gram per liter,S,Albumin -44777602,kilopascal,S,pCO2 (venous) -8751,milligram per liter,S,CRP -8554,percent,S,Hematocrit -8840,milligram per deciliter,S,Creatinine -8876,millimeter mercury column,S,pCO2 (venous) -8876,millimeter mercury column,S,pCO2 (arterial) -8876,millimeter mercury column,S,pO2 (venous) -8876,millimeter mercury column,S,pO2 (arterial) -8753,millimole per liter,S,Lactate -8753,millimole per liter,S,Blood urea nitrogen -8753,millimole per liter,S,Glucose -8753,millimole per liter,S,Sodium -8753,millimole per liter,S,Potassium -8753,millimole per liter,S,Magnesium -8753,millimole per liter,S,Chloride -8753,millimole per liter,S,Calcium -8753,millimole per liter,S,Phosphate -8753,millimole per liter,S,Bicarbonate (venous) -8753,millimole per liter,S,Bicarbonate (arterial) -8555,second,S,INR prothrombin time -8647,per microliter,S,Immature WBC count -8647,per microliter,S,Neutrophil count -8647,per microliter,S,Platelet count -8645,unit per liter,S,ALT -8645,unit per liter,S,AST -8749,micromole per liter,S,Creatinine -8749,micromole per liter,S,Bilirubin -3005456,Potassium [Moles/volume] in Blood,S,Potassium -3018572,Chloride [Moles/volume] in Blood,S,Chloride -3051825,Creatinine [Mass/volume] in Blood,S,Creatinine -3027273,Bicarbonate [Moles/volume] in Venous blood,S,Bicarbonate (venous) -3006140,Bilirubin.total [Moles/volume] in Serum or Plasma,S,Bilirubin -3013826,Glucose [Moles/volume] in Serum or Plasma,S,Glucose -3003458,Phosphate [Moles/volume] in Serum or Plasma,S,Phosphate -3024641,Urea nitrogen [Moles/volume] in Serum or Plasma,S,Blood urea nitrogen -3006923,Alanine aminotransferase [Enzymatic activity/volume] in Serum or Plasma,S,ALT -3024561,Albumin [Mass/volume] in Serum or Plasma,S,Albumin -3013721,Aspartate aminotransferase [Enzymatic activity/volume] in Serum or Plasma,S,AST -3008152,Bicarbonate [Moles/volume] in Arterial blood,S,Bicarbonate (arterial) -3020460,C reactive protein [Mass/volume] in Serum or Plasma,S,CRP -3015377,Calcium [Moles/volume] in Serum or Plasma,S,Calcium -3027946,Carbon dioxide [Partial pressure] in Arterial blood,S,pCO2 (arterial) -3021447,Carbon dioxide [Partial pressure] in Venous blood,S,pCO2 (venous) -3009542,Hematocrit [Volume Fraction] of Blood,S,Hematocrit -3033836,Magnesium [Moles/volume] in Blood,S,Magnesium -3027801,Oxygen [Partial pressure] in Arterial blood,S,pO2 (arterial) -3024354,Oxygen [Partial pressure] in Venous blood,S,pO2 (venous) -3019550,Sodium [Moles/volume] in Serum or Plasma,S,Sodium -3047181,Lactate [Moles/volume] in Blood,S,Lactate -3007670,Neutrophil Ab [Units/volume] in Serum,S,Neutrophil count -3034426,Prothrombin time (PT),S,INR prothrombin time -40762351,Hemoglobin [Moles/volume] in Blood,S,Hemoglobin diff --git a/inst/extdata/phems_variable_list/is_standard/5.14_cardiac_complications.csv b/inst/extdata/phems_variable_list/is_standard/5.14_cardiac_complications.csv deleted file mode 100644 index da4a9fc2..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.14_cardiac_complications.csv +++ /dev/null @@ -1,13 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4051330,Continuous venovenous hemofiltration,S,LCOS - renal support (CVVH/ PD) -4123933,Admission to pediatric intensive care unit,S,ICU ward stay -4295705,Exploratory incision,S,Surgical injury - Reexplore for bleeding -377091,Seizure,S,Neurological injury - seizure -439847,Intracranial hemorrhage,S,Neurological injury - intracranial haemmhorage/ intracranial bleeding -4308537,Injury to blood vessel during surgery,S,Surgical injury - Blood Loss -321042,Cardiac arrest,S,LCOS - Cardiac arrest -443454,Cerebral infarction,S,Neurological injury - infarction -4185565,Low cardiac output syndrome,S,Low cardiac output state (LCOS) - ECMO -4185565,Low cardiac output syndrome,S,LCOS - NEC requiring treatment -42537043,CLABSI - central line associated bloodstream infection,S,CVL infections -4306136,Chylothorax,S,Surgical injury - Chylothorax diff --git a/inst/extdata/phems_variable_list/is_standard/5.15_vital_signs.csv b/inst/extdata/phems_variable_list/is_standard/5.15_vital_signs.csv deleted file mode 100644 index e44116e2..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.15_vital_signs.csv +++ /dev/null @@ -1,11 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4096101,Measurement of oxygen saturation at periphery,S,SpO2 -8483,counts per minute,S,Age-dependent HR -8483,counts per minute,S,Age-dependent RR -8554,percent,S,SpO2 -8876,millimeter mercury column,S,SBP (Systolic Blood Pressure) -8876,millimeter mercury column,S,DBP (Dyastolic Blood Pressure) -3027018,Heart rate,S,Age-dependent HR -3012888,Diastolic blood pressure,S,DBP (Dyastolic Blood Pressure) -3004249,Systolic blood pressure,S,SBP (Systolic Blood Pressure) -3024171,Respiratory rate,S,Age-dependent RR diff --git a/inst/extdata/phems_variable_list/is_standard/5.16_hsjd_clinical.csv b/inst/extdata/phems_variable_list/is_standard/5.16_hsjd_clinical.csv deleted file mode 100644 index 86440027..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.16_hsjd_clinical.csv +++ /dev/null @@ -1,9 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4201235,Body surface area,S,Body Surface Area (BSA) - Combination of weight and height -4275564,Operation on heart,S,Cardiac surgeries (Interventions) -8582,centimeter,S,Height -9529,kilogram,S,Weight -8617,square meter,S,Body Surface Area (BSA) - Combination of weight and height -3025315,Body weight,S,Weight -3036277,Body height,S,Height -0,No matching concept,NA,Extracardiac anomalies - diagnoses diff --git a/inst/extdata/phems_variable_list/is_standard/5.17_hsjd_surgery.csv b/inst/extdata/phems_variable_list/is_standard/5.17_hsjd_surgery.csv deleted file mode 100644 index 2b0734ad..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.17_hsjd_surgery.csv +++ /dev/null @@ -1,9 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -44790138,Induced circulatory arrest,S,"Deep hypothermic circulatory arrest start datetime, end datetime" -4336464,Coronary artery bypass graft,S,"Cardiac bypass start datetime, end datetime" -4150627,Removal of endotracheal tube,S,Extubation event -4201547,Placement of arterial cross clamp,S,"Cross-clamping start datetime, end datetime" -4301351,Surgical procedure,S,"Surgery start datetime, end datetime" -40490494,Society of Thoracic Surgeons risk calculator,S,STAT/EACTS score of surgery -4272324,Cardiopulmonary bypass operation,S,"Antegrade Cerebral Perfusion start datetime, end datetime" -0,No matching concept,NA,Aristotle's score of surgery diff --git a/inst/extdata/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv b/inst/extdata/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv deleted file mode 100644 index db64d22f..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.18_hsjd_hospitalisation.csv +++ /dev/null @@ -1,11 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -37158404,Invasive mechanical ventilation,S,Invasive Mechanical Ventilation LOS -4177224,Non-invasive ventilation,S,Non-Invasive Mechanical Ventilation LOS -44803020,Primary reason for admission,S,Admission reason -4179206,Central venous catheter,S,"Postop central venous catheter in/start datetime, out/ end datetime" -42539650,Administration of intravenous vasoactive drug,S,"Vasoactive infusion start datetime, end datetime" -0,No matching concept,NA,ventilation -0,No matching concept,NA,Type of vasoactive infusion -0,No matching concept,NA,VIS score of vasoactive infusion -0,No matching concept,NA,"Total ventilation start datetime, end datetime" -794078,vasoactive intestinal peptide,S,Dose of vasoactive infusion (rate - mcg/kg/hr) diff --git a/inst/extdata/phems_variable_list/is_standard/5.19_hsjd_complication.csv b/inst/extdata/phems_variable_list/is_standard/5.19_hsjd_complication.csv deleted file mode 100644 index 99ee99f5..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.19_hsjd_complication.csv +++ /dev/null @@ -1,21 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4044892,Procedure on sternum,S,Sternum reopening (procedure undertaken) -4046868,Vocal cord dysfunction,S,Vocal Cord Dysfunction -4049398,Temporary cardiac pacemaker procedure,S,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" -4051940,Permanent cardiac pacemaker procedure,S,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" -4353741,Cardioversion,S,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" -4117045,Atrial overdrive pacing,S,"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing)" -253796,Pneumothorax,S,Pneumothorax -609312,Awaiting transplantation of heart,S,Listed for heart transplantation -4202832,Intubation,S,intubation -315643,Tachyarrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4275564,Operation on heart,S,Cardiac surgeries (interventions) -44783799,Exteriorization of trachea,S,Tracheostomy -44784217,Cardiac arrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4068155,Atrial arrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4228448,Bradyarrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4185572,Ventricular arrhythmia,S,"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.)" -4275136,Paralysis of diaphragm,S,Diaphragmatic Paralysis -46234437,ivabradine,S,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" -1354860,flecainide,S,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" -1309944,amiodarone,S,"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide)" diff --git a/inst/extdata/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv b/inst/extdata/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv deleted file mode 100644 index 0bb6e4c3..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.21_healthcare_use_diagnoses_procedures_current_eps.csv +++ /dev/null @@ -1,87 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -37174269,At increased risk of sepsis,S,Diagnosis of acute infection having the potential for progression to sepsis1+2 -4032243,Dialysis procedure,S,Dialysis -197320,Acute kidney injury,S,acute kidney injury -4074689,Open drainage of pleural cavity,S,"Chest opening, chest drainage" -4084670,Non-urgent surgical admission,S,Surgical admission (non-urgent) -4070667,Urinary catheter,S,Urinary catheter -44790095,Invasive ventilation,S,Invasive ventilation -4052536,Extracorporeal membrane oxygenation,S,ECMO -4051330,Continuous venovenous hemofiltration,S,Dialysis -44790567,Patient transfer from hospital to hospital,S,Origin (external) -133327,Viremia,S,viremia -4097216,Endotracheal tube,S,Endotracheal tube -4085730,Antibiotic therapy,S,Antibiotics -4123946,Admission to surgical department,S,Surgical admission (urgent) -4208341,Solid organ transplant,S,organ transplant -4193843,Oxygenation index measurement,S,Oxygenation index -4235043,Ventricular assist device,S,Ventricular assist device (VAD) -443392,Malignant neoplastic disease,S,Cancer -4181511,Administration of antineoplastic agent,S,Antineoplastics -4294886,"Patient transfer, in-hospital",S,Origin (internal) -4301351,Surgical procedure,S,Surgery previous to prediction time point -4140762,Antiviral therapy,S,Antivirals -4177205,Cannulation,S,Peripheral IV cannulas -4177224,Non-invasive ventilation,S,Non-invasive ventilation -45758028,Arterial blood pressure catheter,S,Arterial blood pressure catheter -44803020,Primary reason for admission,S,Reason for admission -4179206,Central venous catheter,S,Central venous catheter -132736,Bacteremia,S,bacteremia -44783799,Exteriorization of trachea,S,Tracheostomy -45768671,Asplenia,S,asplenia -4324124,Peritoneal dialysis,S,Peritoneal dialysis -435785,Meningitis,S,meningitis -201820,Diabetes mellitus,S,Diagnosis of chronic condition -42538045,Nasogastric/orogastric tube stylet,S,Nasogastric/orogastric tube -37206601,Venoarterial extracorporeal membrane oxygenation,S,ECMO type -37206603,Venovenous extracorporeal membrane oxygenation,S,ECMO type -4314777,Immunosuppressive therapy,S,Immunosuppressors -604243,Acquired neutropenia,S,neutropenia -444187,Open wound,S,injury with open wound -22281,Sickle cell-hemoglobin SS disease,S,sickle cell disease -435613,Cellulitis,S,cellulitis -4134120,Cerebral palsy,S,cerebral palsy -444202,Abscess,S,Abcess -312723,Congenital heart disease,S,Diagnosis of chronic condition -255573,Chronic obstructive lung disease,S,Diagnosis of chronic condition -255848,Pneumonia,S,pneumonia -433740,Immunodeficiency disorder,S,immunodeficiency -4080011,Organ dysfunction syndrome,S,Diagnosis of organ system dysfunction -434821,Systemic inflammatory response syndrome,S,Diagnosis of SIRS -81539,Mitochondrial cytopathy,S,mitochondrial disease -4103588,Acute tuberculosis,S,tuberculosis -443783,Chronic disease,S,Diagnosis of chronic condition -4140977,Secondary immune deficiency disorder,S,Diagnosis of condition producing immunodeficiency -201606,Crohn's disease,S,Crohn's disease -4243475,Acute hepatitis,S,hepatitis -4300243,Postoperative complication,S,surgical site inflammation -439125,Complete trisomy 21 syndrome,S,Down's syndrome -321042,Cardiac arrest,S,cardiac arrest -4331815,Acute urinary tract infection,S,UTI -195212,Hypercortisolism,S,Cushing's disease -196152,Peritonitis,S,peritonitis -314383,Myocarditis,S,miocarditis -195314,Nephrotic syndrome,S,nephrotic syndrome -441589,Endocarditis,S,endocarditis -4271450,Acute infectious disease,S,Diagnosis of acute infection having the potential for progression to sepsis1+2 -81893,Ulcerative colitis,S,ulcerative colitis -80809,Rheumatoid arthritis,S,rheumatoid arthritis -4322814,Meningoencephalitis,S,Meningo-encephalitis -36716945,Renal insufficiency,S,renal insufficiency -440448,Appendicitis,S,appendicitis -433968,Candidiasis,S,candidiasis -44807226,Necrotising enterocolitis,S,necrotizing enterocolitis -132797,Sepsis,S,Previous diagnosis of sepsis measure -44777590,centimeter watercolumn,S,Mean Airway Pressure (MAP) -44777602,kilopascal,S,Mean Airway Pressure (MAP) -8510,unit,S,FiO2 -8554,percent,S,FiO2 -720868,fraction,S,FiO2 -8529,index,S,Oxygenation index -8876,millimeter mercury column,S,Mean Airway Pressure (MAP) -21602722,CORTICOSTEROIDS FOR SYSTEMIC USE,C,Corticoids -42869590,Oxygen/Gas total [Pure volume fraction] Inhaled gas,S,FiO2 -42527086,Mean airway pressure,S,Mean Airway Pressure (MAP) -0,No matching concept,NA,Non-surgical admission -0,No matching concept,NA,Oxygenation index -1340204,History of event,S,Previous diagnosis of sepsis measure diff --git a/inst/extdata/phems_variable_list/is_standard/5.22_vital_signs.csv b/inst/extdata/phems_variable_list/is_standard/5.22_vital_signs.csv deleted file mode 100644 index a7b3fb88..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.22_vital_signs.csv +++ /dev/null @@ -1,21 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4096101,Measurement of oxygen saturation at periphery,S,SpO2 -8483,counts per minute,S,HR -8483,counts per minute,S,RR -9529,kilogram,S,Weight -8554,percent,S,SpO2 -586323,degree Celsius,S,Body temperature -8504,gram,S,Weight -8587,milliliter,S,Urine output -44777613,milliliter per hour,S,Urine output -33014,milliliter per kilogram per 24 hours,S,Urine output -8876,millimeter mercury column,S,SBP (Systolic Blood Pressure) -8876,millimeter mercury column,S,DBP (Diastolic blood pressure) -3025315,Body weight,S,Weight -3020891,Body temperature,S,Body temperature -3012888,Diastolic blood pressure,S,DBP (Diastolic blood pressure) -3004249,Systolic blood pressure,S,SBP (Systolic Blood Pressure) -3014315,Urine output,S,Urine output -3024171,Respiratory rate,S,RR -1004025,Heart rate,C,HR -0,No matching concept,NA,Urine output diff --git a/inst/extdata/phems_variable_list/is_standard/5.23_physical_examination_signs.csv b/inst/extdata/phems_variable_list/is_standard/5.23_physical_examination_signs.csv deleted file mode 100644 index a66fcfeb..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.23_physical_examination_signs.csv +++ /dev/null @@ -1,36 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4069590,Normal,S,Pupillary reactivity (right) -4069590,Normal,S,Pupillary reactivity (left) -4116857,Medium,S,Pupillary size (right) -4116857,Medium,S,Pupillary size (left) -4124461,Weak,S,Peripheral pulse (pressure) -4124461,Weak,S,Central pulse -4132135,Absent,S,Peripheral pulse (pressure) -4132135,Absent,S,Central pulse -4188539,Yes,S,Pupillary reactivity (right) -4188539,Yes,S,Pupillary reactivity (left) -4188540,No,S,Pupillary reactivity (right) -4188540,No,S,Pupillary reactivity (left) -4181412,Present,S,Peripheral pulse (pressure) -4181412,Present,S,Central pulse -4224504,Pulse,S,Central pulse -4314539,Arterial pulse pressure,S,Peripheral pulse (pressure) -8483,counts per minute,S,Peripheral pulse (pressure) -8483,counts per minute,S,Central pulse -8588,millimeter,S,Pupillary size (right) -8588,millimeter,S,Pupillary size (left) -8555,second,S,Capillary refill time -21490963,Right pupil Pupillary response,S,Pupillary reactivity (right) -45879546,Sluggish,S,Pupillary reactivity (right) -45879546,Sluggish,S,Pupillary reactivity (left) -21499034,Dilated,S,Pupillary size (right) -21499034,Dilated,S,Pupillary size (left) -36310446,Constricted,S,Pupillary size (right) -36310446,Constricted,S,Pupillary size (left) -45880051,Unresponsive,S,Pupillary reactivity (right) -45880051,Unresponsive,S,Pupillary reactivity (left) -3032652,Glasgow coma scale,S,GCS -3045676,Capillary refill [Time],S,Capillary refill time -21491763,Left pupil Pupillary response,S,Pupillary reactivity (left) -3021415,Left pupil Diameter Auto,S,Pupillary size (left) -3027214,Right pupil Diameter Auto,S,Pupillary size (right) diff --git a/inst/extdata/phems_variable_list/is_standard/5.24_laboratory_test_results_uc2.csv b/inst/extdata/phems_variable_list/is_standard/5.24_laboratory_test_results_uc2.csv deleted file mode 100644 index a323de0e..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.24_laboratory_test_results_uc2.csv +++ /dev/null @@ -1,41 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -37393605,D-dimer level,S,D-dimer -4017361,Blood urea nitrogen measurement,S,Blood urea nitrogen -4036356,Detection of bacteria,S,Bacterial pathogen detection -44789220,Ionised calcium measurement,S,Ionized calcium -4094436,Fibrinogen measurement,S,Fibrinogen -4118986,Bilirubin measurement,S,Direct bilirubin -4196268,Polymerase chain reaction observation,S,PCR panel -4196268,Polymerase chain reaction observation,S,PCR panel -440029,Viral disease,S,Viral pathogen detection -4212899,Total white blood count,S,Leukocytes -4175016,"Partial thromboplastin time, activated",S,Thromboplastin time -42536081,Adrenal medulla hormone,S,MR-proADM -4299649,Quantitative microbial culture and measurement,S,Quantification of colonies in culture -44806682,Infection resistant to multiple antibiotics,S,Antibiotic resistance -432545,Bacterial infectious disease,S,Name of bacterial pathogen detected -8636,gram per liter,S,Fibrinogen -8751,milligram per liter,S,D-dimer -8845,picogram per milliliter,S,Interleukin-6 -9278,colony forming unit,S,Quantification of colonies in culture -9278,colony forming unit,S,Leukocytes -8840,milligram per deciliter,S,Blood urea nitrogen -8840,milligram per deciliter,S,Glucose -8840,milligram per deciliter,S,Direct bilirubin -8753,millimole per liter,S,D-dimer -8753,millimole per liter,S,Fibrinogen -8753,millimole per liter,S,Blood urea nitrogen -8753,millimole per liter,S,Glucose -8753,millimole per liter,S,Direct bilirubin -8753,millimole per liter,S,Ionized calcium -8725,nanogram per liter,S,PCT -8842,nanogram per milliliter,S,PCT -8736,nanomole per liter,S,MR-proADM -8523,ratio,S,Thromboplastin time -8555,second,S,Thromboplastin time -8748,microgram per liter,S,PCT -8749,micromole per liter,S,Direct bilirubin -3013826,Glucose [Moles/volume] in Serum or Plasma,S,Glucose -3046279,Procalcitonin [Mass/volume] in Serum or Plasma,S,PCT -3033291,Interleukin 6 [Mass/volume] in Body fluid,S,Interleukin-6 -0,No matching concept,NA,Leukocytes diff --git a/inst/extdata/phems_variable_list/is_standard/5.25_arterial_blood_gas.csv b/inst/extdata/phems_variable_list/is_standard/5.25_arterial_blood_gas.csv deleted file mode 100644 index f2107887..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.25_arterial_blood_gas.csv +++ /dev/null @@ -1,12 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -44777602,kilopascal,S,pCO2 -44777602,kilopascal,S,PaO2 -8876,millimeter mercury column,S,pCO2 -8876,millimeter mercury column,S,PaO2 -8753,millimole per liter,S,HCO3 -8753,millimole per liter,S,Base excess -3003396,Base excess in Arterial blood by calculation,S,Base excess -3019977,pH of Arterial blood,S,pH -3008152,Bicarbonate [Moles/volume] in Arterial blood,S,HCO3 -3027946,Carbon dioxide [Partial pressure] in Arterial blood,S,pCO2 -3027801,Oxygen [Partial pressure] in Arterial blood,S,PaO2 diff --git a/inst/extdata/phems_variable_list/is_standard/5.26_venous_blood_gas.csv b/inst/extdata/phems_variable_list/is_standard/5.26_venous_blood_gas.csv deleted file mode 100644 index 24d44bb9..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.26_venous_blood_gas.csv +++ /dev/null @@ -1,17 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -44777602,kilopascal,S,pCO2 -44777602,kilopascal,S,PaO2 -8876,millimeter mercury column,S,pCO2 -8876,millimeter mercury column,S,PaO2 -8753,millimole per liter,S,HCO3 -8753,millimole per liter,S,Base excess -3009343,pH of Capillary blood,S,pH -3027273,Bicarbonate [Moles/volume] in Venous blood,S,HCO3 -3003129,Base excess in Capillary blood by calculation,S,Base excess -3002032,Base excess in Venous blood by calculation,S,Base excess -3015235,Bicarbonate [Moles/volume] in Capillary blood,S,HCO3 -3023024,Carbon dioxide [Partial pressure] in Capillary blood,S,pCO2 -3021447,Carbon dioxide [Partial pressure] in Venous blood,S,pCO2 -3028626,Oxygen [Partial pressure] in Capillary blood,S,PaO2 -3024354,Oxygen [Partial pressure] in Venous blood,S,PaO2 -3012544,pH of Venous blood,S,pH diff --git a/inst/extdata/phems_variable_list/is_standard/5.28_patient_characteristics.csv b/inst/extdata/phems_variable_list/is_standard/5.28_patient_characteristics.csv deleted file mode 100644 index 0a307ec2..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.28_patient_characteristics.csv +++ /dev/null @@ -1,15 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -37393608,Factor VIII inhibitor activity,S,factor VIII inhibitor status -4126681,Detected,S,factor VIII inhibitor status -9190,Not detected,S,factor VIII inhibitor status -4056830,Severe hereditary factor VIII deficiency disease,S,hemophilia A subtype/ severity -4094223,Mild hereditary factor VIII deficiency disease,S,hemophilia A subtype/ severity -434007,Hereditary factor VIII deficiency disease,S,hemophilia A diagnosis -4140661,Moderate hereditary factor VIII deficiency disease,S,hemophilia A subtype/ severity -8582,centimeter,S,height -9529,kilogram,S,body weight -8504,gram,S,body weight -9546,meter,S,height -3025315,Body weight,S,body weight -3036277,Body height,S,height -3003694,ABO and Rh group [Type] in Blood,S,blood group diff --git a/inst/extdata/phems_variable_list/is_standard/5.29_lab_measurements_uc3.csv b/inst/extdata/phems_variable_list/is_standard/5.29_lab_measurements_uc3.csv deleted file mode 100644 index f5b3ed55..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.29_lab_measurements_uc3.csv +++ /dev/null @@ -1,37 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4175016,"Partial thromboplastin time, activated",S,activated partial thromboplastin time (APTT) -4267147,Platelet count,S,platelet count -8636,gram per liter,S,fibrinogen -44777604,liter per liter,S,hematocrit -8554,percent,S,factor VIII activity measurement -8554,percent,S,Von Willebrand factor activity measurement -8554,percent,S,Von Willebrand factor antigen measurement -8554,percent,S,Prothrombin time (PT) -8554,percent,S,hematocrit -44777588,billion cells per liter,S,platelet count -44777562,Bethesda unit per milliliter,S,factor VIII inhibitor titer -9332,international unit per deciliter,S,factor VIII activity measurement -9332,international unit per deciliter,S,Von Willebrand factor activity measurement -9332,international unit per deciliter,S,Von Willebrand factor antigen measurement -8985,international unit per milliliter,S,factor VIII activity measurement -8985,international unit per milliliter,S,Von Willebrand factor activity measurement -8985,international unit per milliliter,S,Von Willebrand factor antigen measurement -8523,ratio,S,activated partial thromboplastin time (APTT) -8523,ratio,S,Prothrombin time (PT) -8555,second,S,activated partial thromboplastin time (APTT) -8555,second,S,Prothrombin time (PT) -8645,unit per liter,S,ALT -8645,unit per liter,S,AST -8763,unit per milliliter,S,Von Willebrand factor propeptide measurement -3024942,Coagulation factor VIII inhibitor [Units/volume] in Platelet poor plasma by Coagulation assay,S,factor VIII inhibitor titer -3011832,Coagulation factor VIII activity [Units/volume] in Platelet poor plasma by Chromogenic method,S,factor VIII activity measurement -3006923,Alanine aminotransferase [Enzymatic activity/volume] in Serum or Plasma,S,ALT -3013721,Aspartate aminotransferase [Enzymatic activity/volume] in Serum or Plasma,S,AST -3009542,Hematocrit [Volume Fraction] of Blood,S,hematocrit -3022520,Coagulation factor VIII activated [Units/volume] in Platelet poor plasma by Coagulation assay,S,factor VIII activity measurement -3016407,Fibrinogen [Mass/volume] in Platelet poor plasma by Coagulation assay,S,fibrinogen -3042349,von Willebrand factor (vWf) cleaving protease inhibitor [Units/volume] in Platelet poor plasma,S,Von Willebrand factor propeptide measurement -3034426,Prothrombin time (PT),S,Prothrombin time (PT) -3002124,von Willebrand factor (vWf) Ag [Units/volume] in Platelet poor plasma by Immunoassay,S,Von Willebrand factor antigen measurement -3023693,von Willebrand factor (vWf) multimers in Platelet poor plasma by Immunoblot,S,Von Willebrand factor propeptide measurement -43534000,von Willebrand factor (vWf).activity [Units/volume] in Platelet poor plasma by Immunoassay,S,Von Willebrand factor activity measurement diff --git a/inst/extdata/phems_variable_list/is_standard/5.30_treatments.csv b/inst/extdata/phems_variable_list/is_standard/5.30_treatments.csv deleted file mode 100644 index 4bbe00a5..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.30_treatments.csv +++ /dev/null @@ -1,13 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4129275,Continuous infusion,S,factor VIII dose is continuous infusion or bolus dose -4265597,Single bolus,S,factor VIII dose is continuous infusion or bolus dose -40492862,Method of drug administration,S,factor VIII dose is continuous infusion or bolus dose -9655,microgram,S,desmopressin -8985,international unit per milliliter,S,factor VIII -8576,milligram,S,desmopressin -9662,microgram per kilogram,S,desmopressin -1517070,desmopressin,S,desmopressin -21154209,Factor VIII 2000 UNT Injection [Kogenate Bayer],S,factor VIII -35766745,Factor VIII 250 UNT Injection [Advate],S,factor VIII -40745282,emicizumab 150 MG/ML Injectable Solution [Hemlibra],S,factor VIII -35831239,factor VII 250 UNT Injection [Eloctate],S,factor VIII diff --git a/inst/extdata/phems_variable_list/is_standard/5.31_surgery_specific_parameters.csv b/inst/extdata/phems_variable_list/is_standard/5.31_surgery_specific_parameters.csv deleted file mode 100644 index 60a64e1a..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.31_surgery_specific_parameters.csv +++ /dev/null @@ -1,5 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4028665,Transfusion of plasma,S,plasma administration during surgery -4308716,Intraoperative hemorrhage,S,blood loss during surgery -37017589,Bleeding during surgery requiring transfusion,S,blood transfusion during surgery -967823,sodium chloride,S,NaCl administration during surgery diff --git a/inst/extdata/phems_variable_list/is_standard/5.3_vis_score_medications.csv b/inst/extdata/phems_variable_list/is_standard/5.3_vis_score_medications.csv deleted file mode 100644 index 6671e328..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.3_vis_score_medications.csv +++ /dev/null @@ -1,7 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -1507835,vasopressin (USP),S,vasopressin -1337720,dobutamine,S,dobutamine -1337860,dopamine,S,dopamine -1343916,epinephrine,S,epinephrine -1368671,milrinone,S,milrinone -1321341,norepinephrine,S,norepinephrin diff --git a/inst/extdata/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv b/inst/extdata/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv deleted file mode 100644 index 2cf1ddc7..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.4_vasopressors_inotropes.csv +++ /dev/null @@ -1,12 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -1507835,vasopressin (USP),S,Vasopressin -1337720,dobutamine,S,Dobutamine -1337860,dopamine,S,Dopamine -1143374,ephedrine,S,Ephedrine -1343916,epinephrine,S,Epinephrine -1368671,milrinone,S,Milrinone -19119253,terlipressin,S,Terlipressin -1183554,isoproterenol,S,Isoproterenol -40173184,levosimendan,S,Levosimendan -1321341,norepinephrine,S,Norepinephrine -1135766,phenylephrine,S,Phenylephrine diff --git a/inst/extdata/phems_variable_list/is_standard/5.5_immunosuppressants.csv b/inst/extdata/phems_variable_list/is_standard/5.5_immunosuppressants.csv deleted file mode 100644 index bc826410..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.5_immunosuppressants.csv +++ /dev/null @@ -1,7 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4273629,Chemotherapy,S,Chemotherapy -21603754,Monoclonal antibodies,C,Monoclonal Antibodies -1518254,dexamethasone,S,Dexamethasone -975125,hydrocortisone,S,Hydrocortisone -1506270,methylprednisolone,S,Methylprednisolone -1550557,prednisolone,S,Prednisolone diff --git a/inst/extdata/phems_variable_list/is_standard/5.6_antibiotic_medication.csv b/inst/extdata/phems_variable_list/is_standard/5.6_antibiotic_medication.csv deleted file mode 100644 index d589492b..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.6_antibiotic_medication.csv +++ /dev/null @@ -1,51 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4273629,Chemotherapy,S,Chemotherapy -21603754,Monoclonal antibodies,C,Monoclonal Antibodies -1836430,sulfamethoxazole,S,Trimethoprim-Sulfamethoxazole -1836948,tetracycline,S,Tetracycline -902722,tobramycin,S,Tobramycin -1705674,trimethoprim,S,Trimethoprim-Sulfamethoxazole -1707687,vancomycin,S,Vancomycin -19010400,fusidate,S,Fusidic acid -45892419,gentamicin,S,Gentamicin -45892599,ceftolozane,S,Ceftolozane-Tazovactam -46221507,avibactam,S,Ceftazidime-Avibactam -1734104,azithromycin,S,Azithromycin -1736887,linezolid,S,Linezolid -1748975,cefepime,S,Cefepime -1750500,clarithromycin,S,Clarithromycin -1769535,cefadroxil,S,Cefadroxil -1771162,cefazolin,S,Cefazolin -1774470,cefotaxime,S,Cefotaxime -1776684,ceftazidime,S,Ceftazidime -1776684,ceftazidime,S,Ceftazidime-Avibactam -1778162,cefuroxime,S,Cefuroxime -1786617,daptomycin,S,Daptomycin -1797513,ciprofloxacin,S,Ciprofloxacin -997881,clindamycin,S,Clindamycin -901845,colistin,S,Colistin -1709170,meropenem,S,Meropenem -1717963,ertapenem,S,Ertapenem -1518254,dexamethasone,S,Dexamethasone -1741122,tazobactam,S,Piperacillin-Tazobactam -1741122,tazobactam,S,Ceftolozane-Tazovactam -1746940,erythromycin,S,Erythromycin -951511,mupirocin,S,Mupirocin -956653,fosfomycin,S,Fosfomycin -1759842,clavulanate,S,Amoxicillin clavulanate -975125,hydrocortisone,S,Hydrocortisone -1778262,imipenem,S,Imipenem -19078399,teicoplanin,S,Teicoplanin -1790868,amikacin,S,Amikacin -1506270,methylprednisolone,S,Methylprednisolone -1713332,amoxicillin,S,Amoxicillin clavulanate -1713332,amoxicillin,S,Amoxicillin -1717327,ampicillin,S,Ampicillin -920293,nitrofurantoin,S,Nitrofurantoin -1721543,norfloxacin,S,Norfloxacin -1724703,oxacillin,S,Oxacillin -1728416,penicillin G,S,Penicillin -1742253,levofloxacin,S,Levofloxacin -1746114,piperacillin,S,Piperacillin-Tazobactam -1550557,prednisolone,S,Prednisolone -1763204,rifampin,S,Rifampicin diff --git a/inst/extdata/phems_variable_list/is_standard/5.7_antifungals.csv b/inst/extdata/phems_variable_list/is_standard/5.7_antifungals.csv deleted file mode 100644 index 4dc0c783..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.7_antifungals.csv +++ /dev/null @@ -1,6 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -1714277,voriconazole,S,Voriconazole -35606695,isavuconazole,S,Isovuconazole -19018013,micafungin,S,Micafungin -19026450,anidulafungin,S,Andiulafungin -1754994,fluconazole,S,Fluconazole diff --git a/inst/extdata/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv b/inst/extdata/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv deleted file mode 100644 index d36affad..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.8_antibiotic_resistance.csv +++ /dev/null @@ -1,11 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4019195,Methicillin resistant Staphylococcus aureus,S,MRSA -4257547,Extended spectrum beta-lactamase producing bacteria,S,ESBL -37017134,Multidrug-resistant bacteria,S,Drug-resistant -37017134,Multidrug-resistant bacteria,S,Multidrug-resistant -37017134,Multidrug-resistant bacteria,S,Clindamycin-resistant -37017134,Multidrug-resistant bacteria,S,Vancomycin-resistant -37017134,Multidrug-resistant bacteria,S,Erythromycin-resistant -1707687,vancomycin,S,Vancomycin-resistant -997881,clindamycin,S,Clindamycin-resistant -1746940,erythromycin,S,Erythromycin-resistant diff --git a/inst/extdata/phems_variable_list/is_standard/5.9_cardiac_surgery.csv b/inst/extdata/phems_variable_list/is_standard/5.9_cardiac_surgery.csv deleted file mode 100644 index e50f982c..00000000 --- a/inst/extdata/phems_variable_list/is_standard/5.9_cardiac_surgery.csv +++ /dev/null @@ -1,42 +0,0 @@ -concept_id,concept_name,standard_concept,sourceCode -4049734,Banding of pulmonary artery,S,Application of band to pulmonary artery -4019929,Repair of tetralogy of Fallot,S,Unspecified repair of tetralogy of fallot -4019932,Arterial switch operation,S,Repositioning of transposed great arteries -4017751,Repair of total anomalous pulmonary venous connection,S,Unspecified correction of total anomalous pulmonary  venous connection -4020376,Closure of defect of interatrial septum using pericardial patch,S,Primary repair of defect of interatrial septum NEC/repair of defect of interatrial septum using pericardial patch -4020506,Creation of valved conduit between right ventricle of heart and pulmonary artery,S,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec -4019950,Revision of valved cardiac conduit,S,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec -4020508,Repair of sinus venosus,S,Correction of persistent sinus venosus -4018441,Repair of partial anomalous pulmonary venous connection,S,Correction of partial anomalous pulmonary venous drainage -4020520,Open aortic valvotomy,S,Open aortic valvotomy -4018747,Operations on the left ventricular outflow tract,S,Repair of subaortic stenosis -4019233,Creation of shunt from subclavian artery to pulmonary artery using interposition tube prosthesis,S,Unspecified creation of shunt to pulmonary artery from subclavian artery using interposition tube pr -4019237,Anastomosis of vena cava to pulmonary artery,S,Creation of anastomosis to pulmonary artery from vena cava -4018926,Repair of pulmonary artery,S,Other specified : repair of pulmonary artery -4021725,Removal of band from pulmonary artery,S,Removal of band from pulmonary artery -4019026,Plastic repair of aorta,S,Other specified: plastic repair of aorta -4020812,Plastic repair of aorta and end-to-end anastomosis of aorta,S,Plastic repair of aorta and end to end anastomosis of aorta -4019028,Release of vascular ring of aorta,S,Release of vascular ring of aorta -44790092,Relief of left ventricular outflow tract obstruction,S,Relief of left ventricular outflow tract obstruction -44789857,Total cavopulmonary connection with extracardiac inferior caval vein to pulmonary artery conduit,S,Total cavopulmonary connection with extracardiac inferior caval vein topulmonary artery conduit -4336751,Allotransplant of heart,S,Unspecified other transplantation of heart/allotransplantation of heart NEC -4049979,Repair of double outlet right ventricle,S,Repair of double outlet right ventricle -4050114,Closure of ductus arteriosus with clip,S,Closure of patent ductus arteriosus NEC -4052536,Extracorporeal membrane oxygenation,S,Extracorporeal membrane oxygenation -44790415,Aortic root replacement using pulmonary valve autograft with right ventricle to pulmonary artery valved conduit and aortoventriculoplasty,S,Aortic root pulmonary valve autograft with right vent to pulmonary artery valved conduit/ aortic root pulmonary valve autograft with right vent to pulmonary artery aortoventriculoplasty -4144921,Implantation of cardiac pacemaker,S,Implantation of cardiac pacemaker system NEC -4137127,Transplantation of heart,S,Unspecified other transplantation of heart/allotransplantation of heart NEC -44793133,Aortopulmonary reconstruction with systemic to pulmonary arterial shunt,S,Aortopulmonary reconstruction with systemic to pulmonary arterial shunt -4293619,Repair of tricuspid valve,S,Tricuspid valve repair NEC -4296790,Transposition of coronary artery,S,Transposition of coronary artery NEC -4139214,Open implantation of cardiac ventricular assist device,S,Open implantation of ventricular assist device -4178479,Replacement of valved cardiac conduit,S,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec -40486525,Primary repair of defect of atrioventricular septum,S,Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum -4187380,Repair of ostium primum defect,S,Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum -4199899,Closure of ventricular septal defect,S,Unspecified repair of defect of interventricular septum -4203153,Replacement of mitral valve,S,Replacement of mitral valve NEC -4217615,Plication of diaphragm,S,Plication of diaphragm -4308136,Complete repair of tetralogy of Fallot with transannular patch,S,Repair of tetralogy of fallot using transannular patch -4312194,Repair of heart valve,S,Aortic valve repair NEC -4339184,Replacement of pulmonary valve,S,Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec -4232476,Repair of ventricular septal defect with prosthesis,S,Repair of defect of interventricular septum using prosthetic patch/unspecified repair of defect of interventricular septum diff --git a/inst/extdata/phems_variable_list/5.10_cardiac_radiology.csv b/inst/extdata/phems_variables/original_tables/5.10_cardiac_radiology.csv similarity index 97% rename from inst/extdata/phems_variable_list/5.10_cardiac_radiology.csv rename to inst/extdata/phems_variables/original_tables/5.10_cardiac_radiology.csv index 4627a379..86917bc5 100644 --- a/inst/extdata/phems_variable_list/5.10_cardiac_radiology.csv +++ b/inst/extdata/phems_variables/original_tables/5.10_cardiac_radiology.csv @@ -1,43 +1,43 @@ -sourceCode,concept_id -24h holter monitor ,45764527  -24h holter monitor ,4140473  -CT head ,4125350  -CT heart with contrast/ CT cardiac angiogram coronary/ CT cardiac gated with contrast ,4306317  -CT thorax with contrast ,4327032  -Cardiopulmonary exercise test (CPET) ,40492338  -EEG routine ,4181917  -EEG routine portable ,4205144  -Epicardial echocardiogram ,4203365  -Event monitor ,45765560  -Exercise test (non-CPET) ,4065416  -FL video swallow ,4345925  -IR PICC line insertion ,4322380  -IR bronchogram ,4312208  -IR bronchoscopy ,4032404  -IR tunnelled central venous line insertion ,40482732  -IR tunnelled central venous line removal ,42873079  -MRI cardiac complex congenital ,44802640  -MRI head ,4082979  -Pacemaker/ICD device check - remote patient initiated ,4235141  -Pacemaker/ICD device check - remote device initiated ,4235141  -Pacemaker/ICD interrogation (in clinic)/ pacemaker/ICD interrogation (other) ,40488431  -US abdomen and pelvis/ US abdomen ,4261497  -US abdomen and pelvis/ US abdomen ,4305221  -US cranial contents ,4083106  -US diaphragmatic region ,4303522  -US doppler ,35622931  -US doppler groin both ,35622931  -US doppler groin both ,4167029  -US doppler jugular vein both ,40489841  -US doppler lower limb veins both ,4335392  -US doppler renal both ,4167052  -US neck ,4083108  -US thorax and pleural cavity ,4329508  -US thorax and pleural cavity ,4093436  -US transoesophageal echocardiogram (toe) ,4019824  -US transthoracic echocardiogram/ us transthoracic echocardiogram (pre- admission)/ US transthoracic echocardiogram (sedated) ,4335825  -US urinary tract ,4125530  -US vocal cord ,44813863  -XR abdomen ,4264477  -XR chest ,4163872  -XR chest and abdomen ,4169275  +sourceCode,concept_id +24h holter monitor ,45764527  +24h holter monitor ,4140473  +CT head ,4125350  +CT heart with contrast/ CT cardiac angiogram coronary/ CT cardiac gated with contrast ,4306317  +CT thorax with contrast ,4327032  +Cardiopulmonary exercise test (CPET) ,40492338  +EEG routine ,4181917  +EEG routine portable ,4205144  +Epicardial echocardiogram ,4203365  +Event monitor ,45765560  +Exercise test (non-CPET) ,4065416  +FL video swallow ,4345925  +IR PICC line insertion ,4322380  +IR bronchogram ,4312208  +IR bronchoscopy ,4032404  +IR tunnelled central venous line insertion ,40482732  +IR tunnelled central venous line removal ,42873079  +MRI cardiac complex congenital ,44802640  +MRI head ,4082979  +Pacemaker/ICD device check - remote patient initiated ,4235141  +Pacemaker/ICD device check - remote device initiated ,4235141  +Pacemaker/ICD interrogation (in clinic)/ pacemaker/ICD interrogation (other) ,40488431  +US abdomen and pelvis/ US abdomen ,4261497  +US abdomen and pelvis/ US abdomen ,4305221  +US cranial contents ,4083106  +US diaphragmatic region ,4303522  +US doppler ,35622931  +US doppler groin both ,35622931  +US doppler groin both ,4167029  +US doppler jugular vein both ,40489841  +US doppler lower limb veins both ,4335392  +US doppler renal both ,4167052  +US neck ,4083108  +US thorax and pleural cavity ,4329508  +US thorax and pleural cavity ,4093436  +US transoesophageal echocardiogram (toe) ,4019824  +US transthoracic echocardiogram/ us transthoracic echocardiogram (pre- admission)/ US transthoracic echocardiogram (sedated) ,4335825  +US urinary tract ,4125530  +US vocal cord ,44813863  +XR abdomen ,4264477  +XR chest ,4163872  +XR chest and abdomen ,4169275  diff --git a/inst/extdata/phems_variable_list/5.11_cardiac_los.csv b/inst/extdata/phems_variables/original_tables/5.11_cardiac_los.csv similarity index 98% rename from inst/extdata/phems_variable_list/5.11_cardiac_los.csv rename to inst/extdata/phems_variables/original_tables/5.11_cardiac_los.csv index 3039e92e..36a8d620 100644 --- a/inst/extdata/phems_variable_list/5.11_cardiac_los.csv +++ b/inst/extdata/phems_variables/original_tables/5.11_cardiac_los.csv @@ -1,5 +1,5 @@ -sourceCode,concept_id -Cardiology ward admission (start datetime and end datetime) ,36675203  -HDU admission (start datetime and end datetime) ,4161811  -ICU admission (start datetime and end datetime) ,4123933  -Total hospital admission (start datetime and end datetime) ,8715  +sourceCode,concept_id +Cardiology ward admission (start datetime and end datetime) ,36675203  +HDU admission (start datetime and end datetime) ,4161811  +ICU admission (start datetime and end datetime) ,4123933  +Total hospital admission (start datetime and end datetime) ,8715  diff --git a/inst/extdata/phems_variable_list/5.12_additional.csv b/inst/extdata/phems_variables/original_tables/5.12_additional.csv similarity index 99% rename from inst/extdata/phems_variable_list/5.12_additional.csv rename to inst/extdata/phems_variables/original_tables/5.12_additional.csv index c235dccf..a7ed53ef 100644 --- a/inst/extdata/phems_variable_list/5.12_additional.csv +++ b/inst/extdata/phems_variables/original_tables/5.12_additional.csv @@ -1,37 +1,37 @@ -sourceCode,concept_id -Base Excess ,8753  -Base Excess ,4095105  -Diagnoses ,4234469  -Elective ICU admission ,4123933  -FiO2 ,42869590  -FiO2 ,8554  -"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",43530727  -"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",440207  -"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",4213310  -"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",201957  -"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",314383  -"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",321319  -"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",260134  -"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",4165112  -"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",442588  -"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",4029498  -"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",443727  -"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",317009  -Mechanical ventilation ,40493026  -Outpatient appointment type (telephone/ clinic visit etc.) ,5083  -"Outpatient appointments start datetime, end datetime ",9202  -Outpatient specialty ,32577  -PaCO2 ,44777602  -PaCO2 ,3027946  -PaCO2 ,8876  -Pupillary reaction ,4209008  -"Reason for ICU admission: (Main reason for ICU admission is not recovery from surgery or a procedure, Recovery from a bypass cardiac procedure, recovery from a non-bypass cardiac procedure, recovery from non-cardiac procedure) ",44803020  -Systolic blood pressure ,8876  -Systolic blood pressure ,3004249  -"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",42537745  -"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",432571  -"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",4124462  -"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",321042  -"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",317510  -"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",29783  -"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",4245975  +sourceCode,concept_id +Base Excess ,8753  +Base Excess ,4095105  +Diagnoses ,4234469  +Elective ICU admission ,4123933  +FiO2 ,42869590  +FiO2 ,8554  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",43530727  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",440207  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",4213310  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",201957  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",314383  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",321319  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",260134  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",4165112  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",442588  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",4029498  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",443727  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",317009  +Mechanical ventilation ,40493026  +Outpatient appointment type (telephone/ clinic visit etc.) ,5083  +"Outpatient appointments start datetime, end datetime ",9202  +Outpatient specialty ,32577  +PaCO2 ,44777602  +PaCO2 ,3027946  +PaCO2 ,8876  +Pupillary reaction ,4209008  +"Reason for ICU admission: (Main reason for ICU admission is not recovery from surgery or a procedure, Recovery from a bypass cardiac procedure, recovery from a non-bypass cardiac procedure, recovery from non-cardiac procedure) ",44803020  +Systolic blood pressure ,8876  +Systolic blood pressure ,3004249  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",42537745  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",432571  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",4124462  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",321042  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",317510  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",29783  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",4245975  diff --git a/inst/extdata/phems_variable_list/5.13_laboratory_tests.csv b/inst/extdata/phems_variables/original_tables/5.13_laboratory_tests.csv similarity index 95% rename from inst/extdata/phems_variable_list/5.13_laboratory_tests.csv rename to inst/extdata/phems_variables/original_tables/5.13_laboratory_tests.csv index 555203c6..899721fc 100644 --- a/inst/extdata/phems_variable_list/5.13_laboratory_tests.csv +++ b/inst/extdata/phems_variables/original_tables/5.13_laboratory_tests.csv @@ -1,61 +1,61 @@ -sourceCode,concept_id -ALT ,3006923  -ALT ,8645  -AST ,3013721  -AST ,8645  -Albumin ,8713  -Albumin ,3024561  -Albumin ,8636  -Bicarbonate (arterial) ,8753  -Bicarbonate (arterial) ,3008152  -Bicarbonate (venous) ,8753  -Bicarbonate (venous) ,3027273  -Bilirubin ,3006140  -Bilirubin ,8749  -Blood urea nitrogen ,3024641  -Blood urea nitrogen ,8753  -CRP ,8751  -CRP ,3020460  -Calcium ,8753  -Calcium ,3015377  -Chloride ,8753  -Chloride ,3018572  -Creatinine ,8749  -Creatinine ,8840  -Creatinine ,3051825  -Glucose ,3013826  -Glucose ,8753  -Hematocrit ,3009542  -Hematocrit ,8554  -Hemoglobin ,8713  -Hemoglobin ,8636  -Hemoglobin ,40762351  -INR prothrombin time ,3034426  -INR prothrombin time ,8555  -Immature WBC count ,4298431  -Immature WBC count ,8647  -Lactate ,3047181  -Lactate ,8753  -Magnesium ,8753  -Magnesium ,3033836  -Neutrophil count ,3007670  -Neutrophil count ,8647  -Phosphate ,3003458  -Phosphate ,8753  -Platelet count ,8647  -Platelet count ,4267147  -Potassium ,8753  -Potassium ,3005456  -Sodium ,3019550  -Sodium ,8753  -pCO2 (arterial) ,3027946  -pCO2 (arterial) ,8876  -pCO2 (venous) ,44777602  -pCO2 (venous) ,3021447  -pCO2 (venous) ,8876  -pH (arterial) ,37399161  -pH (venous) ,37392672  -pO2 (arterial) ,3027801  -pO2 (arterial) ,8876  -pO2 (venous) ,3024354  -pO2 (venous) ,8876  +sourceCode,concept_id +ALT ,3006923  +ALT ,8645  +AST ,3013721  +AST ,8645  +Albumin ,8713  +Albumin ,3024561  +Albumin ,8636  +Bicarbonate (arterial) ,8753  +Bicarbonate (arterial) ,3008152  +Bicarbonate (venous) ,8753  +Bicarbonate (venous) ,3027273  +Bilirubin ,3006140  +Bilirubin ,8749  +Blood urea nitrogen ,3024641  +Blood urea nitrogen ,8753  +CRP ,8751  +CRP ,3020460  +Calcium ,8753  +Calcium ,3015377  +Chloride ,8753  +Chloride ,3018572  +Creatinine ,8749  +Creatinine ,8840  +Creatinine ,3051825  +Glucose ,3013826  +Glucose ,8753  +Hematocrit ,3009542  +Hematocrit ,8554  +Hemoglobin ,8713  +Hemoglobin ,8636  +Hemoglobin ,40762351  +INR prothrombin time ,3034426  +INR prothrombin time ,8555  +Immature WBC count ,4298431  +Immature WBC count ,8647  +Lactate ,3047181  +Lactate ,8753  +Magnesium ,8753  +Magnesium ,3033836  +Neutrophil count ,3007670  +Neutrophil count ,8647  +Phosphate ,3003458  +Phosphate ,8753  +Platelet count ,8647  +Platelet count ,4267147  +Potassium ,8753  +Potassium ,3005456  +Sodium ,3019550  +Sodium ,8753  +pCO2 (arterial) ,3027946  +pCO2 (arterial) ,8876  +pCO2 (venous) ,44777602  +pCO2 (venous) ,3021447  +pCO2 (venous) ,8876  +pH (arterial) ,37399161  +pH (venous) ,37392672  +pO2 (arterial) ,3027801  +pO2 (arterial) ,8876  +pO2 (venous) ,3024354  +pO2 (venous) ,8876  diff --git a/inst/extdata/phems_variable_list/5.14_cardiac_complications.csv b/inst/extdata/phems_variables/original_tables/5.14_cardiac_complications.csv similarity index 97% rename from inst/extdata/phems_variable_list/5.14_cardiac_complications.csv rename to inst/extdata/phems_variables/original_tables/5.14_cardiac_complications.csv index a6e81993..f27a7cf8 100644 --- a/inst/extdata/phems_variable_list/5.14_cardiac_complications.csv +++ b/inst/extdata/phems_variables/original_tables/5.14_cardiac_complications.csv @@ -1,18 +1,18 @@ -sourceCode,concept_id -CVL infections ,42537043  -Extracorporeal membrane oxygenation,4052536  -ICU ward stay ,4123933  -LCOS - Cardiac arrest ,321042  -LCOS - NEC requiring treatment ,4185565  -LCOS - renal support (CVVH/ PD),4324124  -LCOS - renal support (CVVH/ PD) ,4051330  -Low cardiac output state (LCOS) - ECMO,4185565 -Low cardiac output state (LCOS) - ECMO ,4185565  -Neurological injury - intracranial haemmhorage/ intracranial bleeding ,439847  -Neurological injury - infarction ,443454  -Neurological injury - seizure ,377091  -Surgical injury - Blood Loss ,4308537  -Surgical injury - Chylothorax ,4306136  -Surgical injury - Reexplore for bleeding,437312  -Surgical injury - Reexplore for bleeding,442019  -Surgical injury - Reexplore for bleeding ,4295705  +sourceCode,concept_id +CVL infections ,42537043  +Extracorporeal membrane oxygenation,4052536  +ICU ward stay ,4123933  +LCOS - Cardiac arrest ,321042  +LCOS - NEC requiring treatment ,4185565  +LCOS - renal support (CVVH/ PD),4324124  +LCOS - renal support (CVVH/ PD) ,4051330  +Low cardiac output state (LCOS) - ECMO,4185565 +Low cardiac output state (LCOS) - ECMO ,4185565  +Neurological injury - intracranial haemmhorage/ intracranial bleeding ,439847  +Neurological injury - infarction ,443454  +Neurological injury - seizure ,377091  +Surgical injury - Blood Loss ,4308537  +Surgical injury - Chylothorax ,4306136  +Surgical injury - Reexplore for bleeding,437312  +Surgical injury - Reexplore for bleeding,442019  +Surgical injury - Reexplore for bleeding ,4295705  diff --git a/inst/extdata/phems_variable_list/5.15_vital_signs.csv b/inst/extdata/phems_variables/original_tables/5.15_vital_signs.csv similarity index 89% rename from inst/extdata/phems_variable_list/5.15_vital_signs.csv rename to inst/extdata/phems_variables/original_tables/5.15_vital_signs.csv index 2e27e1de..51438932 100644 --- a/inst/extdata/phems_variable_list/5.15_vital_signs.csv +++ b/inst/extdata/phems_variables/original_tables/5.15_vital_signs.csv @@ -1,11 +1,11 @@ -sourceCode,concept_id -Age-dependent HR ,3027018 -Age-dependent HR ,8483  -Age-dependent RR ,3024171 -Age-dependent RR ,8483  -SBP (Systolic Blood Pressure) ,3004249 -SBP (Systolic Blood Pressure) ,8876  -DBP (Dyastolic Blood Pressure) ,3012888 -DBP (Dyastolic Blood Pressure) ,8876  -SpO2 ,4096101  -SpO2 ,8554  +sourceCode,concept_id +Age-dependent HR ,3027018 +Age-dependent HR ,8483  +Age-dependent RR ,3024171 +Age-dependent RR ,8483  +SBP (Systolic Blood Pressure) ,3004249 +SBP (Systolic Blood Pressure) ,8876  +DBP (Dyastolic Blood Pressure) ,3012888 +DBP (Dyastolic Blood Pressure) ,8876  +SpO2 ,4096101  +SpO2 ,8554  diff --git a/inst/extdata/phems_variable_list/5.16_hsjd_clinical.csv b/inst/extdata/phems_variables/original_tables/5.16_hsjd_clinical.csv similarity index 97% rename from inst/extdata/phems_variable_list/5.16_hsjd_clinical.csv rename to inst/extdata/phems_variables/original_tables/5.16_hsjd_clinical.csv index 6b3822b4..37f42bdf 100644 --- a/inst/extdata/phems_variable_list/5.16_hsjd_clinical.csv +++ b/inst/extdata/phems_variables/original_tables/5.16_hsjd_clinical.csv @@ -1,9 +1,9 @@ -sourceCode,concept_id -Body Surface Area (BSA) - Combination of weight and height ,4201235  -Body Surface Area (BSA) - Combination of weight and height ,8617  -Cardiac surgeries (Interventions) ,4275564  -Extracardiac anomalies - diagnoses ,0  -Height ,607590  -Height ,8582  -Weight ,3025315  -Weight ,9529  +sourceCode,concept_id +Body Surface Area (BSA) - Combination of weight and height ,4201235  +Body Surface Area (BSA) - Combination of weight and height ,8617  +Cardiac surgeries (Interventions) ,4275564  +Extracardiac anomalies - diagnoses ,0  +Height ,607590  +Height ,8582  +Weight ,3025315  +Weight ,9529  diff --git a/inst/extdata/phems_variable_list/5.17_hsjd_surgery.csv b/inst/extdata/phems_variables/original_tables/5.17_hsjd_surgery.csv similarity index 100% rename from inst/extdata/phems_variable_list/5.17_hsjd_surgery.csv rename to inst/extdata/phems_variables/original_tables/5.17_hsjd_surgery.csv diff --git a/inst/extdata/phems_variable_list/5.18_hsjd_hospitalisation.csv b/inst/extdata/phems_variables/original_tables/5.18_hsjd_hospitalisation.csv similarity index 100% rename from inst/extdata/phems_variable_list/5.18_hsjd_hospitalisation.csv rename to inst/extdata/phems_variables/original_tables/5.18_hsjd_hospitalisation.csv diff --git a/inst/extdata/phems_variable_list/5.19_hsjd_complication.csv b/inst/extdata/phems_variables/original_tables/5.19_hsjd_complication.csv similarity index 98% rename from inst/extdata/phems_variable_list/5.19_hsjd_complication.csv rename to inst/extdata/phems_variables/original_tables/5.19_hsjd_complication.csv index f54c4c87..eea4d04f 100644 --- a/inst/extdata/phems_variable_list/5.19_hsjd_complication.csv +++ b/inst/extdata/phems_variables/original_tables/5.19_hsjd_complication.csv @@ -1,21 +1,21 @@ -sourceCode,concept_id -"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",44784217  -"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",315643  -"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4068155  -"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4228448  -"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4185572  -"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4117045  -"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4353741  -"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4049398  -"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4051940  -Cardiac surgeries (interventions) ,4275564  -Diaphragmatic Paralysis ,4275136  -"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",1309944  -"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",46234437  -"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",1354860  -Listed for heart transplantation ,609312  -Pneumothorax ,253796  -Sternum reopening (procedure undertaken) ,4044892  -Tracheostomy ,44783799  -Vocal Cord Dysfunction ,4046868  -intubation ,4202832  +sourceCode,concept_id +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",44784217  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",315643  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4068155  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4228448  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4185572  +"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4117045  +"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4353741  +"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4049398  +"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4051940  +Cardiac surgeries (interventions) ,4275564  +Diaphragmatic Paralysis ,4275136  +"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",1309944  +"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",46234437  +"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",1354860  +Listed for heart transplantation ,609312  +Pneumothorax ,253796  +Sternum reopening (procedure undertaken) ,4044892  +Tracheostomy ,44783799  +Vocal Cord Dysfunction ,4046868  +intubation ,4202832  diff --git a/inst/extdata/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv b/inst/extdata/phems_variables/original_tables/5.21_healthcare_use.csv similarity index 95% rename from inst/extdata/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv rename to inst/extdata/phems_variables/original_tables/5.21_healthcare_use.csv index 056df727..40617434 100644 --- a/inst/extdata/phems_variable_list/5.21_healthcare_use_diagnoses_procedures_current_eps.csv +++ b/inst/extdata/phems_variables/original_tables/5.21_healthcare_use.csv @@ -1,88 +1,88 @@ -sourceCode,concept_id -Previous diagnosis of sepsis measure ,1340204  -Previous diagnosis of sepsis measure ,132797  -Origin (external) ,44790567  -Origin (internal) ,4294886  -Reason for admission ,44803020  -Surgical admission (non-urgent) ,4084670  -Surgical admission (urgent) ,4123946   -Non-surgical admission ,0  -Central venous catheter ,4179206  -Diagnosis of chronic condition ,443783  -Diagnosis of chronic condition ,312723  -Diagnosis of chronic condition ,201820  -Diagnosis of chronic condition ,255573  -Diagnosis of acute infection having the potential for progression to sepsis1+2 ,37174269  -Diagnosis of acute infection having the potential for progression to sepsis1+2 ,4271450  -Meningo-encephalitis ,4322814  -hepatitis ,4243475  -pneumonia ,255848  -meningitis ,435785  -bacteremia ,132736  -viremia ,133327  -UTI ,4331815  -tuberculosis ,4103588  -candidiasis ,433968  -Diagnosis of SIRS ,434821  -Diagnosis of condition producing immunodeficiency ,4140977  -Abcess ,444202  -appendicitis ,440448  -, -peritonitis ,196152  -cellulitis ,435613  -surgical site inflammation ,4300243  -injury with open wound ,444187  -renal insufficiency ,36716945  -endocarditis ,441589  -miocarditis ,314383  -necrotizing enterocolitis ,44807226  -Cancer ,443392  -cardiac arrest ,321042  -organ transplant ,4208341  -acute kidney injury ,197320  -immunodeficiency ,433740  -asplenia ,45768671  -cerebral palsy ,4134120  -rheumatoid arthritis ,80809  -sickle cell disease ,22281  -ulcerative colitis ,81893  -Crohn's disease ,201606  -Cushing's disease ,195212  -Down's syndrome ,439125  -mitochondrial disease ,81539  -nephrotic syndrome ,195314  -neutropenia ,604243  -Diagnosis of organ system dysfunction ,4080011  -Antibiotics ,4085730  -Antivirals ,4140762  -Immunosuppressors ,4314777  -Corticoids ,21602722  -Antineoplastics ,4181511  -Surgery previous to prediction time point ,4301351  -"Chest opening, chest drainage ",4074689  -Arterial blood pressure catheter ,45758028  -Peripheral IV cannulas ,4177205  -Urinary catheter ,4070667  -Nasogastric/orogastric tube ,42538045  -Endotracheal tube ,4097216  -Tracheostomy ,44783799  -Invasive ventilation ,44790095  -Non-invasive ventilation ,4177224  -FiO2 ,42869590  -FiO2 ,8554  -FiO2 ,8510  -FiO2 ,720868  -Mean Airway Pressure (MAP) ,42527086  -Mean Airway Pressure (MAP) ,44777590  -Mean Airway Pressure (MAP) ,8876  -Mean Airway Pressure (MAP) ,44777602  -Oxygenation index ,4193843  -Oxygenation index ,8529  -Oxygenation index ,0  -ECMO ,4052536  -ECMO type ,37206603  -ECMO type ,37206601  -Ventricular assist device (VAD) ,4235043  -Dialysis ,4032243  -Dialysis ,4051330  -Peritoneal dialysis ,4324124  +sourceCode,concept_id +Previous diagnosis of sepsis measure ,1340204  +Previous diagnosis of sepsis measure ,132797  +Origin (external) ,44790567  +Origin (internal) ,4294886  +Reason for admission ,44803020  +Surgical admission (non-urgent) ,4084670  +Surgical admission (urgent) ,4123946   +Non-surgical admission ,0  +Central venous catheter ,4179206  +Diagnosis of chronic condition ,443783  +Diagnosis of chronic condition ,312723  +Diagnosis of chronic condition ,201820  +Diagnosis of chronic condition ,255573  +Diagnosis of acute infection having the potential for progression to sepsis1+2 ,37174269  +Diagnosis of acute infection having the potential for progression to sepsis1+2 ,4271450  +Meningo-encephalitis ,4322814  +hepatitis ,4243475  +pneumonia ,255848  +meningitis ,435785  +bacteremia ,132736  +viremia ,133327  +UTI ,4331815  +tuberculosis ,4103588  +candidiasis ,433968  +Diagnosis of SIRS ,434821  +Diagnosis of condition producing immunodeficiency ,4140977  +Abcess ,444202  +appendicitis ,440448  +NA,NA +peritonitis ,196152  +cellulitis ,435613  +surgical site inflammation ,4300243  +injury with open wound ,444187  +renal insufficiency ,36716945  +endocarditis ,441589  +miocarditis ,314383  +necrotizing enterocolitis ,44807226  +Cancer ,443392  +cardiac arrest ,321042  +organ transplant ,4208341  +acute kidney injury ,197320  +immunodeficiency ,433740  +asplenia ,45768671  +cerebral palsy ,4134120  +rheumatoid arthritis ,80809  +sickle cell disease ,22281  +ulcerative colitis ,81893  +Crohn's disease ,201606  +Cushing's disease ,195212  +Down's syndrome ,439125  +mitochondrial disease ,81539  +nephrotic syndrome ,195314  +neutropenia ,604243  +Diagnosis of organ system dysfunction ,4080011  +Antibiotics ,4085730  +Antivirals ,4140762  +Immunosuppressors ,4314777  +Corticoids ,21602722  +Antineoplastics ,4181511  +Surgery previous to prediction time point ,4301351  +"Chest opening, chest drainage ",4074689  +Arterial blood pressure catheter ,45758028  +Peripheral IV cannulas ,4177205  +Urinary catheter ,4070667  +Nasogastric/orogastric tube ,42538045  +Endotracheal tube ,4097216  +Tracheostomy ,44783799  +Invasive ventilation ,44790095  +Non-invasive ventilation ,4177224  +FiO2 ,42869590  +FiO2 ,8554  +FiO2 ,8510  +FiO2 ,720868  +Mean Airway Pressure (MAP) ,42527086  +Mean Airway Pressure (MAP) ,44777590  +Mean Airway Pressure (MAP) ,8876  +Mean Airway Pressure (MAP) ,44777602  +Oxygenation index ,4193843  +Oxygenation index ,8529  +Oxygenation index ,0  +ECMO ,4052536  +ECMO type ,37206603  +ECMO type ,37206601  +Ventricular assist device (VAD) ,4235043  +Dialysis ,4032243  +Dialysis ,4051330  +Peritoneal dialysis ,4324124  diff --git a/inst/extdata/phems_variable_list/5.22_vital_signs.csv b/inst/extdata/phems_variables/original_tables/5.22_vital_signs.csv similarity index 52% rename from inst/extdata/phems_variable_list/5.22_vital_signs.csv rename to inst/extdata/phems_variables/original_tables/5.22_vital_signs.csv index e2bd991b..09816bbb 100644 --- a/inst/extdata/phems_variable_list/5.22_vital_signs.csv +++ b/inst/extdata/phems_variables/original_tables/5.22_vital_signs.csv @@ -1,88 +1,88 @@ -sourceCode,concept_id -HR ,3027018  -HR ,8483  -RR ,3024171  -RR ,8483  -Body temperature ,3020891  -Body temperature ,586323  -SBP (Systolic Blood Pressure) ,3004249  -SBP (Systolic Blood Pressure) ,8876  -DBP (Diastolic blood pressure) ,3012888  -DBP (Diastolic blood pressure) ,8876  -SpO2 ,4096101  -SpO2 ,8554  -Urine output ,3014315  -Urine output ,8587  -Urine output ,44777613  -Urine output ,33014  -Urine output ,0  -Weight ,3025315  -Weight ,9529  -Weight ,8504  -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, +sourceCode,concept_id +HR ,3027018  +HR ,8483  +RR ,3024171  +RR ,8483  +Body temperature ,3020891  +Body temperature ,586323  +SBP (Systolic Blood Pressure) ,3004249  +SBP (Systolic Blood Pressure) ,8876  +DBP (Diastolic blood pressure) ,3012888  +DBP (Diastolic blood pressure) ,8876  +SpO2 ,4096101  +SpO2 ,8554  +Urine output ,3014315  +Urine output ,8587  +Urine output ,44777613  +Urine output ,33014  +Urine output ,0  +Weight ,3025315  +Weight ,9529  +Weight ,8504  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA diff --git a/inst/extdata/phems_variable_list/5.23_physical_examination_signs.csv b/inst/extdata/phems_variables/original_tables/5.23_physical_examination_signs.csv similarity index 78% rename from inst/extdata/phems_variable_list/5.23_physical_examination_signs.csv rename to inst/extdata/phems_variables/original_tables/5.23_physical_examination_signs.csv index b304ff0d..8b820d4a 100644 --- a/inst/extdata/phems_variable_list/5.23_physical_examination_signs.csv +++ b/inst/extdata/phems_variables/original_tables/5.23_physical_examination_signs.csv @@ -1,88 +1,88 @@ -sourceCode,concept_id -GCS ,3032652  -Pupillary reactivity (right) ,21490963  -Pupillary reactivity (right) ,4069590  -Pupillary reactivity (right) ,45879546  -Pupillary reactivity (right) ,45880051  -Pupillary reactivity (right) ,4188539  -Pupillary reactivity (right) ,4188540  -Pupillary reactivity (left) ,21491763  -Pupillary reactivity (left) ,4069590  -Pupillary reactivity (left) ,45879546  -Pupillary reactivity (left) ,45880051  -Pupillary reactivity (left) ,4188539  -Pupillary reactivity (left) ,4188540  -Pupillary size (right) ,3027214  -Pupillary size (right) ,8588  -Pupillary size (right) ,36310446  -Pupillary size (right) ,21499034  -Pupillary size (right) ,4116857  -Pupillary size (left) ,3021415  -Pupillary size (left) ,8588  -Pupillary size (left) ,36310446  -Pupillary size (left) ,21499034  -Pupillary size (left) ,4116857  -Capillary refill time ,3045676  -Capillary refill time ,8555  -Peripheral pulse (pressure) ,4314539  -Peripheral pulse (pressure) ,4181412  -Peripheral pulse (pressure) ,4132135  -Peripheral pulse (pressure) ,4124461  -Peripheral pulse (pressure) ,8483  -Central pulse ,4224504  -Central pulse ,4181412  -Central pulse ,4132135  -Central pulse ,4124461  -Central pulse ,8483  -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, +sourceCode,concept_id +GCS ,3032652  +Pupillary reactivity (right) ,21490963  +Pupillary reactivity (right) ,4069590  +Pupillary reactivity (right) ,45879546  +Pupillary reactivity (right) ,45880051  +Pupillary reactivity (right) ,4188539  +Pupillary reactivity (right) ,4188540  +Pupillary reactivity (left) ,21491763  +Pupillary reactivity (left) ,4069590  +Pupillary reactivity (left) ,45879546  +Pupillary reactivity (left) ,45880051  +Pupillary reactivity (left) ,4188539  +Pupillary reactivity (left) ,4188540  +Pupillary size (right) ,3027214  +Pupillary size (right) ,8588  +Pupillary size (right) ,36310446  +Pupillary size (right) ,21499034  +Pupillary size (right) ,4116857  +Pupillary size (left) ,3021415  +Pupillary size (left) ,8588  +Pupillary size (left) ,36310446  +Pupillary size (left) ,21499034  +Pupillary size (left) ,4116857  +Capillary refill time ,3045676  +Capillary refill time ,8555  +Peripheral pulse (pressure) ,4314539  +Peripheral pulse (pressure) ,4181412  +Peripheral pulse (pressure) ,4132135  +Peripheral pulse (pressure) ,4124461  +Peripheral pulse (pressure) ,8483  +Central pulse ,4224504  +Central pulse ,4181412  +Central pulse ,4132135  +Central pulse ,4124461  +Central pulse ,8483  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA diff --git a/inst/extdata/phems_variable_list/5.24_laboratory_test_results_uc2.csv b/inst/extdata/phems_variables/original_tables/5.24_laboratory_test_results_uc2.csv similarity index 77% rename from inst/extdata/phems_variable_list/5.24_laboratory_test_results_uc2.csv rename to inst/extdata/phems_variables/original_tables/5.24_laboratory_test_results_uc2.csv index 70c91b9d..bcbe45db 100644 --- a/inst/extdata/phems_variable_list/5.24_laboratory_test_results_uc2.csv +++ b/inst/extdata/phems_variables/original_tables/5.24_laboratory_test_results_uc2.csv @@ -1,87 +1,87 @@ -sourceCode,concept_id -Bacterial pathogen detection ,4036356  -Name of bacterial pathogen detected ,432545  -Quantification of colonies in culture ,4299649  -Quantification of colonies in culture ,9278  -PCR panel ,4196268  -Antibiotic resistance ,44806682  -Viral pathogen detection ,440029  -PCR panel ,4196268  -Leukocytes ,4212899  -Leukocytes ,9278  -Leukocytes ,0  -Thromboplastin time ,4175016  -Thromboplastin time ,8555  -Thromboplastin time ,8523  -D-dimer ,37393605  -D-dimer ,8751  -D-dimer ,8753  -Fibrinogen ,4094436  -Fibrinogen ,8636  -Fibrinogen ,8753  -Blood urea nitrogen ,4017361  -Blood urea nitrogen ,8753  -Blood urea nitrogen ,8840  -Glucose ,3013826  -Glucose ,8753  -Glucose ,8840  -Direct bilirubin ,4118986  -Direct bilirubin ,8749  -Direct bilirubin ,8753  -Direct bilirubin ,8840  -Ionized calcium ,44789220  -Ionized calcium ,8753  -PCT ,3046279  -PCT ,8842  -PCT ,8725  -PCT ,8748  -MR-proADM ,42536081  -MR-proADM ,8736  -Interleukin-6 ,3033291  -Interleukin-6 ,8845  -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, -, +sourceCode,concept_id +Bacterial pathogen detection ,4036356  +Name of bacterial pathogen detected ,432545  +Quantification of colonies in culture ,4299649  +Quantification of colonies in culture ,9278  +PCR panel ,4196268  +Antibiotic resistance ,44806682  +Viral pathogen detection ,440029  +PCR panel ,4196268  +Leukocytes ,4212899  +Leukocytes ,9278  +Leukocytes ,0  +Thromboplastin time ,4175016  +Thromboplastin time ,8555  +Thromboplastin time ,8523  +D-dimer ,37393605  +D-dimer ,8751  +D-dimer ,8753  +Fibrinogen ,4094436  +Fibrinogen ,8636  +Fibrinogen ,8753  +Blood urea nitrogen ,4017361  +Blood urea nitrogen ,8753  +Blood urea nitrogen ,8840  +Glucose ,3013826  +Glucose ,8753  +Glucose ,8840  +Direct bilirubin ,4118986  +Direct bilirubin ,8749  +Direct bilirubin ,8753  +Direct bilirubin ,8840  +Ionized calcium ,44789220  +Ionized calcium ,8753  +PCT ,3046279  +PCT ,8842  +PCT ,8725  +PCT ,8748  +MR-proADM ,42536081  +MR-proADM ,8736  +Interleukin-6 ,3033291  +Interleukin-6 ,8845  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA diff --git a/inst/extdata/phems_variables/original_tables/5.25_arterial_blood_gas.csv b/inst/extdata/phems_variables/original_tables/5.25_arterial_blood_gas.csv new file mode 100644 index 00000000..3de30e89 --- /dev/null +++ b/inst/extdata/phems_variables/original_tables/5.25_arterial_blood_gas.csv @@ -0,0 +1,87 @@ +sourceCode,concept_id +pH ,3019977  +pCO2 ,3027946  +pCO2 ,44777602  +pCO2 ,8876  +PaO2 ,3027801  +PaO2 ,44777602  +PaO2 ,8876  +HCO3 ,3008152  +HCO3 ,8753  +Base excess ,3003396  +Base excess ,8753  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA diff --git a/inst/extdata/phems_variables/original_tables/5.26_venous_blood_gas.csv b/inst/extdata/phems_variables/original_tables/5.26_venous_blood_gas.csv new file mode 100644 index 00000000..7570921b --- /dev/null +++ b/inst/extdata/phems_variables/original_tables/5.26_venous_blood_gas.csv @@ -0,0 +1,87 @@ +sourceCode,concept_id +pH ,3012544  +pH ,3009343  +pCO2 ,3021447  +pCO2 ,3023024  +pCO2 ,44777602  +pCO2 ,8876  +PaO2 ,3024354  +PaO2 ,3028626  +PaO2 ,44777602  +PaO2 ,8876  +HCO3 ,3027273  +HCO3 ,3015235  +HCO3 ,8753  +Base excess,3002032  +Base excess,3003129  +Base excess,8753  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA diff --git a/inst/extdata/phems_variables/original_tables/5.28_patient_characteristics.csv b/inst/extdata/phems_variables/original_tables/5.28_patient_characteristics.csv new file mode 100644 index 00000000..21a18a9d --- /dev/null +++ b/inst/extdata/phems_variables/original_tables/5.28_patient_characteristics.csv @@ -0,0 +1,87 @@ +sourceCode,concept_id +body weight ,3025315  +body weight ,9529  +body weight ,8504  +height ,3036277  +height ,8582  +height ,9546  +hemophilia A diagnosis ,434007  +hemophilia A subtype/ severity ,4094223  +hemophilia A subtype/ severity ,4140661  +hemophilia A subtype/ severity ,4056830  +blood group ,3003694  +factor VIII inhibitor status ,37393608  +factor VIII inhibitor status ,4126681  +factor VIII inhibitor status ,9190  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA diff --git a/inst/extdata/phems_variable_list/5.28_uc3_patient_characteristics.csv b/inst/extdata/phems_variables/original_tables/5.28_uc3_patient_characteristics.csv similarity index 100% rename from inst/extdata/phems_variable_list/5.28_uc3_patient_characteristics.csv rename to inst/extdata/phems_variables/original_tables/5.28_uc3_patient_characteristics.csv diff --git a/inst/extdata/phems_variable_list/5.29_uc3_lab_measurements.csv b/inst/extdata/phems_variables/original_tables/5.29_uc3_lab_measurements.csv similarity index 99% rename from inst/extdata/phems_variable_list/5.29_uc3_lab_measurements.csv rename to inst/extdata/phems_variables/original_tables/5.29_uc3_lab_measurements.csv index 6b129df7..7bbd8f97 100644 --- a/inst/extdata/phems_variable_list/5.29_uc3_lab_measurements.csv +++ b/inst/extdata/phems_variables/original_tables/5.29_uc3_lab_measurements.csv @@ -34,4 +34,4 @@ fibrinogen,8636 ALT,3006923 ALT,8645 AST,3013721 -AST,8645 \ No newline at end of file +AST,8645 diff --git a/inst/extdata/phems_variable_list/5.30_uc3_treatments.csv b/inst/extdata/phems_variables/original_tables/5.30_uc3_treatments.csv similarity index 98% rename from inst/extdata/phems_variable_list/5.30_uc3_treatments.csv rename to inst/extdata/phems_variables/original_tables/5.30_uc3_treatments.csv index 72541184..450301cc 100644 --- a/inst/extdata/phems_variable_list/5.30_uc3_treatments.csv +++ b/inst/extdata/phems_variables/original_tables/5.30_uc3_treatments.csv @@ -39,4 +39,4 @@ factor VIII dose is continuous infusion or bolus dose,4265597 desmopressin,1517070 desmopressin,9655 desmopressin,8576 -desmopressin,9662 \ No newline at end of file +desmopressin,9662 diff --git a/inst/extdata/phems_variable_list/5.31_uc3_surgery.csv b/inst/extdata/phems_variables/original_tables/5.31_uc3_surgery.csv similarity index 85% rename from inst/extdata/phems_variable_list/5.31_uc3_surgery.csv rename to inst/extdata/phems_variables/original_tables/5.31_uc3_surgery.csv index de3ce952..96bef24d 100644 --- a/inst/extdata/phems_variable_list/5.31_uc3_surgery.csv +++ b/inst/extdata/phems_variables/original_tables/5.31_uc3_surgery.csv @@ -5,4 +5,4 @@ NaCl administration during surgery,8587 plasma administration during surgery,4028665 datetime start anesthesia,4160439 blood loss during surgery,4308716 -blood transfusion during surgery,37017589 \ No newline at end of file +blood transfusion during surgery,37017589 diff --git a/inst/extdata/phems_variable_list/5.3_vis_score_medications.csv b/inst/extdata/phems_variables/original_tables/5.3_vis_score_medications.csv similarity index 90% rename from inst/extdata/phems_variable_list/5.3_vis_score_medications.csv rename to inst/extdata/phems_variables/original_tables/5.3_vis_score_medications.csv index 19e1b346..e1c959bd 100644 --- a/inst/extdata/phems_variable_list/5.3_vis_score_medications.csv +++ b/inst/extdata/phems_variables/original_tables/5.3_vis_score_medications.csv @@ -1,8 +1,8 @@ -sourceCode,concept_id -dobutamine,1337720 -dopamine,1337860 -epinephrine,1343916 -milrinone,1368671 -norepinephrin,1321341 -vasopressin,1507835 -,9688 +sourceCode,concept_id +dobutamine,1337720 +dopamine,1337860 +epinephrine,1343916 +milrinone,1368671 +norepinephrin,1321341 +vasopressin,1507835 +NA,9688 diff --git a/inst/extdata/phems_variable_list/5.4_vasopressors_inotropes.csv b/inst/extdata/phems_variables/original_tables/5.4_vasopressors_inotropes.csv similarity index 95% rename from inst/extdata/phems_variable_list/5.4_vasopressors_inotropes.csv rename to inst/extdata/phems_variables/original_tables/5.4_vasopressors_inotropes.csv index 2cdcea90..ca40d92b 100644 --- a/inst/extdata/phems_variable_list/5.4_vasopressors_inotropes.csv +++ b/inst/extdata/phems_variables/original_tables/5.4_vasopressors_inotropes.csv @@ -1,12 +1,12 @@ -sourceCode,concept_id -Dobutamine,1337720 -Dopamine,1337860 -Ephedrine,1143374 -Epinephrine,1343916 -Isoproterenol,1183554 -Levosimendan,40173184 -Milrinone,1368671 -Norepinephrine,1321341 -Phenylephrine,1135766 -Terlipressin,19119253 -Vasopressin,1507835 +sourceCode,concept_id +Dobutamine,1337720 +Dopamine,1337860 +Ephedrine,1143374 +Epinephrine,1343916 +Isoproterenol,1183554 +Levosimendan,40173184 +Milrinone,1368671 +Norepinephrine,1321341 +Phenylephrine,1135766 +Terlipressin,19119253 +Vasopressin,1507835 diff --git a/inst/extdata/phems_variable_list/5.5_immunosuppressants.csv b/inst/extdata/phems_variables/original_tables/5.5_immunosuppressants.csv similarity index 95% rename from inst/extdata/phems_variable_list/5.5_immunosuppressants.csv rename to inst/extdata/phems_variables/original_tables/5.5_immunosuppressants.csv index b48ccf21..c0285044 100644 --- a/inst/extdata/phems_variable_list/5.5_immunosuppressants.csv +++ b/inst/extdata/phems_variables/original_tables/5.5_immunosuppressants.csv @@ -1,7 +1,7 @@ -sourceCode,concept_id -Chemotherapy,4273629 -Dexamethasone,1518254 -Hydrocortisone,975125 -Methylprednisolone,1506270 -Monoclonal Antibodies,21603754 -Prednisolone,1550557 +sourceCode,concept_id +Chemotherapy,4273629 +Dexamethasone,1518254 +Hydrocortisone,975125 +Methylprednisolone,1506270 +Monoclonal Antibodies,21603754 +Prednisolone,1550557 diff --git a/inst/extdata/phems_variable_list/5.6_antibiotic_medication.csv b/inst/extdata/phems_variables/original_tables/5.6_antibiotic_medication.csv similarity index 95% rename from inst/extdata/phems_variable_list/5.6_antibiotic_medication.csv rename to inst/extdata/phems_variables/original_tables/5.6_antibiotic_medication.csv index aac54744..9b46a626 100644 --- a/inst/extdata/phems_variable_list/5.6_antibiotic_medication.csv +++ b/inst/extdata/phems_variables/original_tables/5.6_antibiotic_medication.csv @@ -1,51 +1,51 @@ -sourceCode,concept_id -Amikacin,1790868 -Amoxicillin,1713332 -Amoxicillin clavulanate,1713332 -Amoxicillin clavulanate,1759842 -Ampicillin,1717327 -Azithromycin,1734104 -Cefadroxil,1769535 -Cefazolin,1771162 -Cefepime,1748975 -Cefotaxime,1774470 -Ceftazidime,1776684 -Ceftazidime-Avibactam,46221507 -Ceftazidime-Avibactam,1776684 -Ceftolozane-Tazovactam,1741122 -Ceftolozane-Tazovactam,45892599 -Cefuroxime,1778162 -Chemotherapy,4273629 -Ciprofloxacin,1797513 -Clarithromycin,1750500 -Clindamycin,997881 -Colistin,901845 -Daptomycin,1786617 -Dexamethasone,1518254 -Ertapenem,1717963 -Erythromycin,1746940 -Fosfomycin,956653 -Fusidic acid,19010400 -Gentamicin,45892419 -Hydrocortisone,975125 -Imipenem,1778262 -Levofloxacin,1742253 -Linezolid,1736887 -Meropenem,1709170 -Methylprednisolone,1506270 -Monoclonal Antibodies,21603754 -Mupirocin,951511 -Nitrofurantoin,920293 -Norfloxacin,1721543 -Oxacillin,1724703 -Penicillin,1728416 -Piperacillin-Tazobactam,1746114 -Piperacillin-Tazobactam,1741122 -Prednisolone,1550557 -Rifampicin,1763204 -Teicoplanin,19078399 -Tetracycline,1836948 -Tobramycin,902722 -Trimethoprim-Sulfamethoxazole,1836430 -Trimethoprim-Sulfamethoxazole,1705674 -Vancomycin,1707687 +sourceCode,concept_id +Amikacin,1790868 +Amoxicillin,1713332 +Amoxicillin clavulanate,1713332 +Amoxicillin clavulanate,1759842 +Ampicillin,1717327 +Azithromycin,1734104 +Cefadroxil,1769535 +Cefazolin,1771162 +Cefepime,1748975 +Cefotaxime,1774470 +Ceftazidime,1776684 +Ceftazidime-Avibactam,46221507 +Ceftazidime-Avibactam,1776684 +Ceftolozane-Tazovactam,1741122 +Ceftolozane-Tazovactam,45892599 +Cefuroxime,1778162 +Chemotherapy,4273629 +Ciprofloxacin,1797513 +Clarithromycin,1750500 +Clindamycin,997881 +Colistin,901845 +Daptomycin,1786617 +Dexamethasone,1518254 +Ertapenem,1717963 +Erythromycin,1746940 +Fosfomycin,956653 +Fusidic acid,19010400 +Gentamicin,45892419 +Hydrocortisone,975125 +Imipenem,1778262 +Levofloxacin,1742253 +Linezolid,1736887 +Meropenem,1709170 +Methylprednisolone,1506270 +Monoclonal Antibodies,21603754 +Mupirocin,951511 +Nitrofurantoin,920293 +Norfloxacin,1721543 +Oxacillin,1724703 +Penicillin,1728416 +Piperacillin-Tazobactam,1746114 +Piperacillin-Tazobactam,1741122 +Prednisolone,1550557 +Rifampicin,1763204 +Teicoplanin,19078399 +Tetracycline,1836948 +Tobramycin,902722 +Trimethoprim-Sulfamethoxazole,1836430 +Trimethoprim-Sulfamethoxazole,1705674 +Vancomycin,1707687 diff --git a/inst/extdata/phems_variable_list/5.7_antifungals.csv b/inst/extdata/phems_variables/original_tables/5.7_antifungals.csv similarity index 95% rename from inst/extdata/phems_variable_list/5.7_antifungals.csv rename to inst/extdata/phems_variables/original_tables/5.7_antifungals.csv index 8fd22f8d..fe8ea611 100644 --- a/inst/extdata/phems_variable_list/5.7_antifungals.csv +++ b/inst/extdata/phems_variables/original_tables/5.7_antifungals.csv @@ -1,6 +1,6 @@ -sourceCode,concept_id -Andiulafungin,19026450 -Fluconazole,1754994 -Isovuconazole,35606695 -Micafungin,19018013 -Voriconazole,1714277 +sourceCode,concept_id +Andiulafungin,19026450 +Fluconazole,1754994 +Isovuconazole,35606695 +Micafungin,19018013 +Voriconazole,1714277 diff --git a/inst/extdata/phems_variable_list/5.8_antibiotic_resistance.csv b/inst/extdata/phems_variables/original_tables/5.8_antibiotic_resistance.csv similarity index 96% rename from inst/extdata/phems_variable_list/5.8_antibiotic_resistance.csv rename to inst/extdata/phems_variables/original_tables/5.8_antibiotic_resistance.csv index fabf6808..601451e4 100644 --- a/inst/extdata/phems_variable_list/5.8_antibiotic_resistance.csv +++ b/inst/extdata/phems_variables/original_tables/5.8_antibiotic_resistance.csv @@ -1,11 +1,11 @@ -sourceCode,concept_id -Clindamycin-resistant,997881 -Clindamycin-resistant,37017134 -Drug-resistant,37017134 -ESBL,4257547 -Erythromycin-resistant,1746940 -Erythromycin-resistant,37017134 -MRSA,4019195 -Multidrug-resistant,37017134 -Vancomycin-resistant,1707687 -Vancomycin-resistant,37017134 +sourceCode,concept_id +Clindamycin-resistant,997881 +Clindamycin-resistant,37017134 +Drug-resistant,37017134 +ESBL,4257547 +Erythromycin-resistant,1746940 +Erythromycin-resistant,37017134 +MRSA,4019195 +Multidrug-resistant,37017134 +Vancomycin-resistant,1707687 +Vancomycin-resistant,37017134 diff --git a/inst/extdata/phems_variable_list/5.9_cardiac_surgery.csv b/inst/extdata/phems_variables/original_tables/5.9_cardiac_surgery.csv similarity index 98% rename from inst/extdata/phems_variable_list/5.9_cardiac_surgery.csv rename to inst/extdata/phems_variables/original_tables/5.9_cardiac_surgery.csv index c533c5fb..f86a964a 100644 --- a/inst/extdata/phems_variable_list/5.9_cardiac_surgery.csv +++ b/inst/extdata/phems_variables/original_tables/5.9_cardiac_surgery.csv @@ -1,43 +1,43 @@ -sourceCode,concept_id -Aortic root pulmonary valve autograft with right vent to pulmonary artery valved conduit/ aortic root pulmonary valve autograft with right vent to pulmonary artery aortoventriculoplasty ,44790415  -Aortic valve repair NEC ,4312194  -Aortopulmonary reconstruction with systemic to pulmonary arterial shunt ,44793133  -Application of band to pulmonary artery ,4049734  -Closure of patent ductus arteriosus NEC ,4050114  -Correction of partial anomalous pulmonary venous drainage ,4018441  -Correction of persistent sinus venosus ,4020508  -Creation of anastomosis to pulmonary artery from vena cava ,4019237  -Extracorporeal membrane oxygenation ,4052536  -Implantation of cardiac pacemaker system NEC ,4144921  -Open aortic valvotomy ,4020520  -Open implantation of ventricular assist device ,4139214  -Other specified : repair of pulmonary artery ,4018926  -Other specified other operations on ventricles of heart ,44510968  -Other specified: plastic repair of aorta ,4019026  -Plastic repair of aorta and end to end anastomosis of aorta ,4020812  -Plication of diaphragm ,4217615  -Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum ,4187380  -Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum ,40486525  -Primary repair of defect of interatrial septum NEC/repair of defect of interatrial septum using pericardial patch ,4020376  -Release of vascular ring of aorta ,4019028  -Relief of left ventricular outflow tract obstruction ,44790092  -Removal of band from pulmonary artery ,4021725  -Repair of defect of interventricular septum using prosthetic patch/unspecified repair of defect of interventricular septum ,4232476  -Repair of double outlet right ventricle ,4049979  -Repair of tetralogy of fallot using transannular patch ,4308136  -Repair of subaortic stenosis ,4018747  -Replacement of mitral valve NEC ,4203153  -Repositioning of transposed great arteries ,4019932  -Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4339184  -Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4019950  -Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4020506  -Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4178479  -Total cavopulmonary connection with extracardiac inferior caval vein topulmonary artery conduit ,44789857  -Transposition of coronary artery NEC ,4296790  -Tricuspid valve repair NEC ,4293619  -Unspecified creation of shunt to pulmonary artery from subclavian artery using interposition tube pr ,4019233  -Unspecified other transplantation of heart/allotransplantation of heart NEC ,4137127  -Unspecified other transplantation of heart/allotransplantation of heart NEC ,4336751  -Unspecified repair of defect of interventricular septum ,4199899  -Unspecified repair of tetralogy of fallot ,4019929  -Unspecified correction of total anomalous pulmonary  venous connection ,4017751  +sourceCode,concept_id +Aortic root pulmonary valve autograft with right vent to pulmonary artery valved conduit/ aortic root pulmonary valve autograft with right vent to pulmonary artery aortoventriculoplasty ,44790415  +Aortic valve repair NEC ,4312194  +Aortopulmonary reconstruction with systemic to pulmonary arterial shunt ,44793133  +Application of band to pulmonary artery ,4049734  +Closure of patent ductus arteriosus NEC ,4050114  +Correction of partial anomalous pulmonary venous drainage ,4018441  +Correction of persistent sinus venosus ,4020508  +Creation of anastomosis to pulmonary artery from vena cava ,4019237  +Extracorporeal membrane oxygenation ,4052536  +Implantation of cardiac pacemaker system NEC ,4144921  +Open aortic valvotomy ,4020520  +Open implantation of ventricular assist device ,4139214  +Other specified : repair of pulmonary artery ,4018926  +Other specified other operations on ventricles of heart ,44510968  +Other specified: plastic repair of aorta ,4019026  +Plastic repair of aorta and end to end anastomosis of aorta ,4020812  +Plication of diaphragm ,4217615  +Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum ,4187380  +Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum ,40486525  +Primary repair of defect of interatrial septum NEC/repair of defect of interatrial septum using pericardial patch ,4020376  +Release of vascular ring of aorta ,4019028  +Relief of left ventricular outflow tract obstruction ,44790092  +Removal of band from pulmonary artery ,4021725  +Repair of defect of interventricular septum using prosthetic patch/unspecified repair of defect of interventricular septum ,4232476  +Repair of double outlet right ventricle ,4049979  +Repair of tetralogy of fallot using transannular patch ,4308136  +Repair of subaortic stenosis ,4018747  +Replacement of mitral valve NEC ,4203153  +Repositioning of transposed great arteries ,4019932  +Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4339184  +Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4019950  +Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4020506  +Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4178479  +Total cavopulmonary connection with extracardiac inferior caval vein topulmonary artery conduit ,44789857  +Transposition of coronary artery NEC ,4296790  +Tricuspid valve repair NEC ,4293619  +Unspecified creation of shunt to pulmonary artery from subclavian artery using interposition tube pr ,4019233  +Unspecified other transplantation of heart/allotransplantation of heart NEC ,4137127  +Unspecified other transplantation of heart/allotransplantation of heart NEC ,4336751  +Unspecified repair of defect of interventricular septum ,4199899  +Unspecified repair of tetralogy of fallot ,4019929  +Unspecified correction of total anomalous pulmonary  venous connection ,4017751  diff --git a/inst/extdata/phems_variables/uc1.csv b/inst/extdata/phems_variables/uc1.csv new file mode 100644 index 00000000..cead9c33 --- /dev/null +++ b/inst/extdata/phems_variables/uc1.csv @@ -0,0 +1,278 @@ +sourceCode,concept_id +dobutamine,1337720 +dopamine,1337860 +epinephrine,1343916 +milrinone,1368671 +norepinephrin,1321341 +vasopressin,1507835 +NA,9688 +Dobutamine,1337720 +Dopamine,1337860 +Ephedrine,1143374 +Epinephrine,1343916 +Isoproterenol,1183554 +Levosimendan,40173184 +Milrinone,1368671 +Norepinephrine,1321341 +Phenylephrine,1135766 +Terlipressin,19119253 +Vasopressin,1507835 +Aortic root pulmonary valve autograft with right vent to pulmonary artery valved conduit/ aortic root pulmonary valve autograft with right vent to pulmonary artery aortoventriculoplasty ,44790415  +Aortic valve repair NEC ,4312194  +Aortopulmonary reconstruction with systemic to pulmonary arterial shunt ,44793133  +Application of band to pulmonary artery ,4049734  +Closure of patent ductus arteriosus NEC ,4050114  +Correction of partial anomalous pulmonary venous drainage ,4018441  +Correction of persistent sinus venosus ,4020508  +Creation of anastomosis to pulmonary artery from vena cava ,4019237  +Extracorporeal membrane oxygenation ,4052536  +Implantation of cardiac pacemaker system NEC ,4144921  +Open aortic valvotomy ,4020520  +Open implantation of ventricular assist device ,4139214  +Other specified : repair of pulmonary artery ,4018926  +Other specified other operations on ventricles of heart ,44510968  +Other specified: plastic repair of aorta ,4019026  +Plastic repair of aorta and end to end anastomosis of aorta ,4020812  +Plication of diaphragm ,4217615  +Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum ,4187380  +Primary repair of defect of atrioventricular septum NEC/repair of persistent ostium primum/repair of persistent ostium primum ,40486525  +Primary repair of defect of interatrial septum NEC/repair of defect of interatrial septum using pericardial patch ,4020376  +Release of vascular ring of aorta ,4019028  +Relief of left ventricular outflow tract obstruction ,44790092  +Removal of band from pulmonary artery ,4021725  +Repair of defect of interventricular septum using prosthetic patch/unspecified repair of defect of interventricular septum ,4232476  +Repair of double outlet right ventricle ,4049979  +Repair of tetralogy of fallot using transannular patch ,4308136  +Repair of subaortic stenosis ,4018747  +Replacement of mitral valve NEC ,4203153  +Repositioning of transposed great arteries ,4019932  +Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4339184  +Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4019950  +Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4020506  +Revision of cardiac conduit nec/creation of valved conduit between Right ventricle of heart and Pulmonary artery/replacement of valved cardiac conduit/ replacement of pulmonary valve nec ,4178479  +Total cavopulmonary connection with extracardiac inferior caval vein topulmonary artery conduit ,44789857  +Transposition of coronary artery NEC ,4296790  +Tricuspid valve repair NEC ,4293619  +Unspecified creation of shunt to pulmonary artery from subclavian artery using interposition tube pr ,4019233  +Unspecified other transplantation of heart/allotransplantation of heart NEC ,4137127  +Unspecified other transplantation of heart/allotransplantation of heart NEC ,4336751  +Unspecified repair of defect of interventricular septum ,4199899  +Unspecified repair of tetralogy of fallot ,4019929  +Unspecified correction of total anomalous pulmonary  venous connection ,4017751  +24h holter monitor ,45764527  +24h holter monitor ,4140473  +CT head ,4125350  +CT heart with contrast/ CT cardiac angiogram coronary/ CT cardiac gated with contrast ,4306317  +CT thorax with contrast ,4327032  +Cardiopulmonary exercise test (CPET) ,40492338  +EEG routine ,4181917  +EEG routine portable ,4205144  +Epicardial echocardiogram ,4203365  +Event monitor ,45765560  +Exercise test (non-CPET) ,4065416  +FL video swallow ,4345925  +IR PICC line insertion ,4322380  +IR bronchogram ,4312208  +IR bronchoscopy ,4032404  +IR tunnelled central venous line insertion ,40482732  +IR tunnelled central venous line removal ,42873079  +MRI cardiac complex congenital ,44802640  +MRI head ,4082979  +Pacemaker/ICD device check - remote patient initiated ,4235141  +Pacemaker/ICD device check - remote device initiated ,4235141  +Pacemaker/ICD interrogation (in clinic)/ pacemaker/ICD interrogation (other) ,40488431  +US abdomen and pelvis/ US abdomen ,4261497  +US abdomen and pelvis/ US abdomen ,4305221  +US cranial contents ,4083106  +US diaphragmatic region ,4303522  +US doppler ,35622931  +US doppler groin both ,35622931  +US doppler groin both ,4167029  +US doppler jugular vein both ,40489841  +US doppler lower limb veins both ,4335392  +US doppler renal both ,4167052  +US neck ,4083108  +US thorax and pleural cavity ,4329508  +US thorax and pleural cavity ,4093436  +US transoesophageal echocardiogram (toe) ,4019824  +US transthoracic echocardiogram/ us transthoracic echocardiogram (pre- admission)/ US transthoracic echocardiogram (sedated) ,4335825  +US urinary tract ,4125530  +US vocal cord ,44813863  +XR abdomen ,4264477  +XR chest ,4163872  +XR chest and abdomen ,4169275  +Cardiology ward admission (start datetime and end datetime) ,36675203  +HDU admission (start datetime and end datetime) ,4161811  +ICU admission (start datetime and end datetime) ,4123933  +Total hospital admission (start datetime and end datetime) ,8715  +Base Excess ,8753  +Base Excess ,4095105  +Diagnoses ,4234469  +Elective ICU admission ,4123933  +FiO2 ,42869590  +FiO2 ,8554  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",43530727  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",440207  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",4213310  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",201957  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",314383  +"High Risk Diagnoses: (None, spontaneous cerbral hemorrhage, cardiomyopathy or myocarditis, hypoplastic left heart syndrome, neurodegenerative disorder, necrotizing enterocolitis) ",321319  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",260134  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",4165112  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",442588  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",4029498  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",443727  +"Low Risk Diagnoses: None, asthma, bronchiolitis, croup, obstructive sleep apnea, diabetic ketoacidosis, seizure disorder ",317009  +Mechanical ventilation ,40493026  +Outpatient appointment type (telephone/ clinic visit etc.) ,5083  +"Outpatient appointments start datetime, end datetime ",9202  +Outpatient specialty ,32577  +PaCO2 ,44777602  +PaCO2 ,3027946  +PaCO2 ,8876  +Pupillary reaction ,4209008  +"Reason for ICU admission: (Main reason for ICU admission is not recovery from surgery or a procedure, Recovery from a bypass cardiac procedure, recovery from a non-bypass cardiac procedure, recovery from non-cardiac procedure) ",44803020  +Systolic blood pressure ,8876  +Systolic blood pressure ,3004249  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",42537745  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",432571  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",4124462  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",321042  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",317510  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",29783  +"Very High Risk Diagnoses: None, cardiac arrest preceding ICU admission, severe combined immune deficiency, leukemia or lymphoma after first induction, bone marrow transplant recipient, liver failure ",4245975  +ALT ,3006923  +ALT ,8645  +AST ,3013721  +AST ,8645  +Albumin ,8713  +Albumin ,3024561  +Albumin ,8636  +Bicarbonate (arterial) ,8753  +Bicarbonate (arterial) ,3008152  +Bicarbonate (venous) ,8753  +Bicarbonate (venous) ,3027273  +Bilirubin ,3006140  +Bilirubin ,8749  +Blood urea nitrogen ,3024641  +Blood urea nitrogen ,8753  +CRP ,8751  +CRP ,3020460  +Calcium ,8753  +Calcium ,3015377  +Chloride ,8753  +Chloride ,3018572  +Creatinine ,8749  +Creatinine ,8840  +Creatinine ,3051825  +Glucose ,3013826  +Glucose ,8753  +Hematocrit ,3009542  +Hematocrit ,8554  +Hemoglobin ,8713  +Hemoglobin ,8636  +Hemoglobin ,40762351  +INR prothrombin time ,3034426  +INR prothrombin time ,8555  +Immature WBC count ,4298431  +Immature WBC count ,8647  +Lactate ,3047181  +Lactate ,8753  +Magnesium ,8753  +Magnesium ,3033836  +Neutrophil count ,3007670  +Neutrophil count ,8647  +Phosphate ,3003458  +Phosphate ,8753  +Platelet count ,8647  +Platelet count ,4267147  +Potassium ,8753  +Potassium ,3005456  +Sodium ,3019550  +Sodium ,8753  +pCO2 (arterial) ,3027946  +pCO2 (arterial) ,8876  +pCO2 (venous) ,44777602  +pCO2 (venous) ,3021447  +pCO2 (venous) ,8876  +pH (arterial) ,37399161  +pH (venous) ,37392672  +pO2 (arterial) ,3027801  +pO2 (arterial) ,8876  +pO2 (venous) ,3024354  +pO2 (venous) ,8876  +CVL infections ,42537043  +Extracorporeal membrane oxygenation,4052536  +ICU ward stay ,4123933  +LCOS - Cardiac arrest ,321042  +LCOS - NEC requiring treatment ,4185565  +LCOS - renal support (CVVH/ PD),4324124  +LCOS - renal support (CVVH/ PD) ,4051330  +Low cardiac output state (LCOS) - ECMO,4185565 +Low cardiac output state (LCOS) - ECMO ,4185565  +Neurological injury - intracranial haemmhorage/ intracranial bleeding ,439847  +Neurological injury - infarction ,443454  +Neurological injury - seizure ,377091  +Surgical injury - Blood Loss ,4308537  +Surgical injury - Chylothorax ,4306136  +Surgical injury - Reexplore for bleeding,437312  +Surgical injury - Reexplore for bleeding,442019  +Surgical injury - Reexplore for bleeding ,4295705  +Age-dependent HR ,3027018 +Age-dependent HR ,8483  +Age-dependent RR ,3024171 +Age-dependent RR ,8483  +SBP (Systolic Blood Pressure) ,3004249 +SBP (Systolic Blood Pressure) ,8876  +DBP (Dyastolic Blood Pressure) ,3012888 +DBP (Dyastolic Blood Pressure) ,8876  +SpO2 ,4096101  +SpO2 ,8554  +Body Surface Area (BSA) - Combination of weight and height ,4201235  +Body Surface Area (BSA) - Combination of weight and height ,8617  +Cardiac surgeries (Interventions) ,4275564  +Extracardiac anomalies - diagnoses ,0  +Height ,607590  +Height ,8582  +Weight ,3025315  +Weight ,9529  +"Antegrade Cerebral Perfusion start datetime, end datetime ",4272324  +Aristotle's score of surgery ,0  +"Cardiac bypass start datetime, end datetime ",4336464  +"Cross-clamping start datetime, end datetime ",4201547  +"Deep hypothermic circulatory arrest start datetime, end datetime ",37152781  +"Antegrade Cerebral Perfusion start datetime, end datetime ",4272324  +Extubation event ,4150627  +STAT/EACTS score of surgery ,40490494  +"Surgery start datetime, end datetime ",4301351  +Admission reason ,44803020  +ventilation ,0  +"Vasoactive infusion start datetime, end datetime ",42539650  +Type of vasoactive infusion ,0  +VIS score of vasoactive infusion ,0  +"Postop central venous catheter in/start datetime, out/ end datetime ",4179206  +"Total ventilation start datetime, end datetime ",0  +Type of vasoactive infusion ,0  +VIS score of vasoactive infusion ,0  +"Vasoactive infusion start datetime, end datetime ",42539650  +ventilation ,0  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",44784217  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",315643  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4068155  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4228448  +"Arrhythmia diagnosis (tachyarrhythmia, bradyarrhythmia, atrial, ventricular etc.) ",4185572  +"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4117045  +"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4353741  +"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4049398  +"Arrhythmia therapy (procedures): Cardioversion, Rapid atrial pacing, temporary pacing, permanent pacing) ",4051940  +Cardiac surgeries (interventions) ,4275564  +Diaphragmatic Paralysis ,4275136  +"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",1309944  +"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",46234437  +"Drugs administered; Arrhythmia therapy (drugs): IV anthyarritmics (ivabradine, amiodarone, flecainide) ",1354860  +Listed for heart transplantation ,609312  +Pneumothorax ,253796  +Sternum reopening (procedure undertaken) ,4044892  +Tracheostomy ,44783799  +Vocal Cord Dysfunction ,4046868  +intubation ,4202832  diff --git a/inst/extdata/phems_variables/uc2.csv b/inst/extdata/phems_variables/uc2.csv new file mode 100644 index 00000000..9b90561b --- /dev/null +++ b/inst/extdata/phems_variables/uc2.csv @@ -0,0 +1,602 @@ +sourceCode,concept_id +Dobutamine,1337720 +Dopamine,1337860 +Ephedrine,1143374 +Epinephrine,1343916 +Isoproterenol,1183554 +Levosimendan,40173184 +Milrinone,1368671 +Norepinephrine,1321341 +Phenylephrine,1135766 +Terlipressin,19119253 +Vasopressin,1507835 +Chemotherapy,4273629 +Dexamethasone,1518254 +Hydrocortisone,975125 +Methylprednisolone,1506270 +Monoclonal Antibodies,21603754 +Prednisolone,1550557 +Amikacin,1790868 +Amoxicillin,1713332 +Amoxicillin clavulanate,1713332 +Amoxicillin clavulanate,1759842 +Ampicillin,1717327 +Azithromycin,1734104 +Cefadroxil,1769535 +Cefazolin,1771162 +Cefepime,1748975 +Cefotaxime,1774470 +Ceftazidime,1776684 +Ceftazidime-Avibactam,46221507 +Ceftazidime-Avibactam,1776684 +Ceftolozane-Tazovactam,1741122 +Ceftolozane-Tazovactam,45892599 +Cefuroxime,1778162 +Chemotherapy,4273629 +Ciprofloxacin,1797513 +Clarithromycin,1750500 +Clindamycin,997881 +Colistin,901845 +Daptomycin,1786617 +Dexamethasone,1518254 +Ertapenem,1717963 +Erythromycin,1746940 +Fosfomycin,956653 +Fusidic acid,19010400 +Gentamicin,45892419 +Hydrocortisone,975125 +Imipenem,1778262 +Levofloxacin,1742253 +Linezolid,1736887 +Meropenem,1709170 +Methylprednisolone,1506270 +Monoclonal Antibodies,21603754 +Mupirocin,951511 +Nitrofurantoin,920293 +Norfloxacin,1721543 +Oxacillin,1724703 +Penicillin,1728416 +Piperacillin-Tazobactam,1746114 +Piperacillin-Tazobactam,1741122 +Prednisolone,1550557 +Rifampicin,1763204 +Teicoplanin,19078399 +Tetracycline,1836948 +Tobramycin,902722 +Trimethoprim-Sulfamethoxazole,1836430 +Trimethoprim-Sulfamethoxazole,1705674 +Vancomycin,1707687 +Andiulafungin,19026450 +Fluconazole,1754994 +Isovuconazole,35606695 +Micafungin,19018013 +Voriconazole,1714277 +Clindamycin-resistant,997881 +Clindamycin-resistant,37017134 +Drug-resistant,37017134 +ESBL,4257547 +Erythromycin-resistant,1746940 +Erythromycin-resistant,37017134 +MRSA,4019195 +Multidrug-resistant,37017134 +Vancomycin-resistant,1707687 +Vancomycin-resistant,37017134 +Previous diagnosis of sepsis measure ,1340204  +Previous diagnosis of sepsis measure ,132797  +Origin (external) ,44790567  +Origin (internal) ,4294886  +Reason for admission ,44803020  +Surgical admission (non-urgent) ,4084670  +Surgical admission (urgent) ,4123946   +Non-surgical admission ,0  +Central venous catheter ,4179206  +Diagnosis of chronic condition ,443783  +Diagnosis of chronic condition ,312723  +Diagnosis of chronic condition ,201820  +Diagnosis of chronic condition ,255573  +Diagnosis of acute infection having the potential for progression to sepsis1+2 ,37174269  +Diagnosis of acute infection having the potential for progression to sepsis1+2 ,4271450  +Meningo-encephalitis ,4322814  +hepatitis ,4243475  +pneumonia ,255848  +meningitis ,435785  +bacteremia ,132736  +viremia ,133327  +UTI ,4331815  +tuberculosis ,4103588  +candidiasis ,433968  +Diagnosis of SIRS ,434821  +Diagnosis of condition producing immunodeficiency ,4140977  +Abcess ,444202  +appendicitis ,440448  +NA,NA +peritonitis ,196152  +cellulitis ,435613  +surgical site inflammation ,4300243  +injury with open wound ,444187  +renal insufficiency ,36716945  +endocarditis ,441589  +miocarditis ,314383  +necrotizing enterocolitis ,44807226  +Cancer ,443392  +cardiac arrest ,321042  +organ transplant ,4208341  +acute kidney injury ,197320  +immunodeficiency ,433740  +asplenia ,45768671  +cerebral palsy ,4134120  +rheumatoid arthritis ,80809  +sickle cell disease ,22281  +ulcerative colitis ,81893  +Crohn's disease ,201606  +Cushing's disease ,195212  +Down's syndrome ,439125  +mitochondrial disease ,81539  +nephrotic syndrome ,195314  +neutropenia ,604243  +Diagnosis of organ system dysfunction ,4080011  +Antibiotics ,4085730  +Antivirals ,4140762  +Immunosuppressors ,4314777  +Corticoids ,21602722  +Antineoplastics ,4181511  +Surgery previous to prediction time point ,4301351  +"Chest opening, chest drainage ",4074689  +Arterial blood pressure catheter ,45758028  +Peripheral IV cannulas ,4177205  +Urinary catheter ,4070667  +Nasogastric/orogastric tube ,42538045  +Endotracheal tube ,4097216  +Tracheostomy ,44783799  +Invasive ventilation ,44790095  +Non-invasive ventilation ,4177224  +FiO2 ,42869590  +FiO2 ,8554  +FiO2 ,8510  +FiO2 ,720868  +Mean Airway Pressure (MAP) ,42527086  +Mean Airway Pressure (MAP) ,44777590  +Mean Airway Pressure (MAP) ,8876  +Mean Airway Pressure (MAP) ,44777602  +Oxygenation index ,4193843  +Oxygenation index ,8529  +Oxygenation index ,0  +ECMO ,4052536  +ECMO type ,37206603  +ECMO type ,37206601  +Ventricular assist device (VAD) ,4235043  +Dialysis ,4032243  +Dialysis ,4051330  +Peritoneal dialysis ,4324124  +HR ,3027018  +HR ,8483  +RR ,3024171  +RR ,8483  +Body temperature ,3020891  +Body temperature ,586323  +SBP (Systolic Blood Pressure) ,3004249  +SBP (Systolic Blood Pressure) ,8876  +DBP (Diastolic blood pressure) ,3012888  +DBP (Diastolic blood pressure) ,8876  +SpO2 ,4096101  +SpO2 ,8554  +Urine output ,3014315  +Urine output ,8587  +Urine output ,44777613  +Urine output ,33014  +Urine output ,0  +Weight ,3025315  +Weight ,9529  +Weight ,8504  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +GCS ,3032652  +Pupillary reactivity (right) ,21490963  +Pupillary reactivity (right) ,4069590  +Pupillary reactivity (right) ,45879546  +Pupillary reactivity (right) ,45880051  +Pupillary reactivity (right) ,4188539  +Pupillary reactivity (right) ,4188540  +Pupillary reactivity (left) ,21491763  +Pupillary reactivity (left) ,4069590  +Pupillary reactivity (left) ,45879546  +Pupillary reactivity (left) ,45880051  +Pupillary reactivity (left) ,4188539  +Pupillary reactivity (left) ,4188540  +Pupillary size (right) ,3027214  +Pupillary size (right) ,8588  +Pupillary size (right) ,36310446  +Pupillary size (right) ,21499034  +Pupillary size (right) ,4116857  +Pupillary size (left) ,3021415  +Pupillary size (left) ,8588  +Pupillary size (left) ,36310446  +Pupillary size (left) ,21499034  +Pupillary size (left) ,4116857  +Capillary refill time ,3045676  +Capillary refill time ,8555  +Peripheral pulse (pressure) ,4314539  +Peripheral pulse (pressure) ,4181412  +Peripheral pulse (pressure) ,4132135  +Peripheral pulse (pressure) ,4124461  +Peripheral pulse (pressure) ,8483  +Central pulse ,4224504  +Central pulse ,4181412  +Central pulse ,4132135  +Central pulse ,4124461  +Central pulse ,8483  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +Bacterial pathogen detection ,4036356  +Name of bacterial pathogen detected ,432545  +Quantification of colonies in culture ,4299649  +Quantification of colonies in culture ,9278  +PCR panel ,4196268  +Antibiotic resistance ,44806682  +Viral pathogen detection ,440029  +PCR panel ,4196268  +Leukocytes ,4212899  +Leukocytes ,9278  +Leukocytes ,0  +Thromboplastin time ,4175016  +Thromboplastin time ,8555  +Thromboplastin time ,8523  +D-dimer ,37393605  +D-dimer ,8751  +D-dimer ,8753  +Fibrinogen ,4094436  +Fibrinogen ,8636  +Fibrinogen ,8753  +Blood urea nitrogen ,4017361  +Blood urea nitrogen ,8753  +Blood urea nitrogen ,8840  +Glucose ,3013826  +Glucose ,8753  +Glucose ,8840  +Direct bilirubin ,4118986  +Direct bilirubin ,8749  +Direct bilirubin ,8753  +Direct bilirubin ,8840  +Ionized calcium ,44789220  +Ionized calcium ,8753  +PCT ,3046279  +PCT ,8842  +PCT ,8725  +PCT ,8748  +MR-proADM ,42536081  +MR-proADM ,8736  +Interleukin-6 ,3033291  +Interleukin-6 ,8845  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +pH ,3019977  +pCO2 ,3027946  +pCO2 ,44777602  +pCO2 ,8876  +PaO2 ,3027801  +PaO2 ,44777602  +PaO2 ,8876  +HCO3 ,3008152  +HCO3 ,8753  +Base excess ,3003396  +Base excess ,8753  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +pH ,3012544  +pH ,3009343  +pCO2 ,3021447  +pCO2 ,3023024  +pCO2 ,44777602  +pCO2 ,8876  +PaO2 ,3024354  +PaO2 ,3028626  +PaO2 ,44777602  +PaO2 ,8876  +HCO3 ,3027273  +HCO3 ,3015235  +HCO3 ,8753  +Base excess,3002032  +Base excess,3003129  +Base excess,8753  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA diff --git a/inst/extdata/phems_variables/uc3.csv b/inst/extdata/phems_variables/uc3.csv new file mode 100644 index 00000000..df4395ca --- /dev/null +++ b/inst/extdata/phems_variables/uc3.csv @@ -0,0 +1,214 @@ +sourceCode,concept_id +body weight ,3025315  +body weight ,9529  +body weight ,8504  +height ,3036277  +height ,8582  +height ,9546  +hemophilia A diagnosis ,434007  +hemophilia A subtype/ severity ,4094223  +hemophilia A subtype/ severity ,4140661  +hemophilia A subtype/ severity ,4056830  +blood group ,3003694  +factor VIII inhibitor status ,37393608  +factor VIII inhibitor status ,4126681  +factor VIII inhibitor status ,9190  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +factor VIII inhibitor titer,3024942 +factor VIII inhibitor titer,44777562 +factor VIII activity measurement,3022520 +factor VIII activity measurement,3011832 +factor VIII activity measurement,8985 +factor VIII activity measurement,9332 +factor VIII activity measurement,8554 +Von Willebrand factor activity measurement,43534000 +Von Willebrand factor activity measurement,8985 +Von Willebrand factor activity measurement,9332 +Von Willebrand factor activity measurement,8554 +Von Willebrand factor antigen measurement,3002124 +Von Willebrand factor antigen measurement,8985 +Von Willebrand factor antigen measurement,9332 +Von Willebrand factor antigen measurement,8554 +Von Willebrand factor propeptide measurement,3023693 +Von Willebrand factor propeptide measurement,3042349 +Von Willebrand factor propeptide measurement,8763 +activated partial thromboplastin time (APTT),4175016 +activated partial thromboplastin time (APTT),8555 +activated partial thromboplastin time (APTT),8523 +Prothrombin time (PT),3034426 +Prothrombin time (PT),8555 +Prothrombin time (PT),8523 +Prothrombin time (PT),8554 +platelet count,4267147 +platelet count,44777588 +hematocrit,3009542 +hematocrit,44777604 +hematocrit,8554 +fibrinogen,3016407 +fibrinogen,8636 +ALT,3006923 +ALT,8645 +AST,3013721 +AST,8645 +factor VIII  ,35766745  +factor VIII  ,21154209  +factor VIII  ,35831239  +factor VIII  ,40745282  +factor VIII  ,8985  +factor VIII dose is continuous infusion or bolus dose ,40492862  +factor VIII dose is continuous infusion or bolus dose ,4129275  +factor VIII dose is continuous infusion or bolus dose ,4265597  +desmopressin ,1517070  +desmopressin ,9655  +desmopressin ,8576  +desmopressin ,9662  +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +NA,NA +Medical/ surgical procedure,4172515 +NaCl administration during surgery,967823 +NaCl administration during surgery,8587 +plasma administration during surgery,4028665 +datetime start anesthesia,4160439 +blood loss during surgery,4308716 +blood transfusion during surgery,37017589 diff --git a/inst/extdata/standard_concepts/.gitkeep b/inst/extdata/standard_concepts/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/inst/extdata/standardness/.gitignore b/inst/extdata/standardness/.gitignore new file mode 100644 index 00000000..a3a0c8b5 --- /dev/null +++ b/inst/extdata/standardness/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/inst/extdata/vocabularies/.gitkeep b/inst/extdata/vocabularies/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/inst/scripts/main.R b/inst/scripts/main.R new file mode 100644 index 00000000..11fb2fb1 --- /dev/null +++ b/inst/scripts/main.R @@ -0,0 +1,99 @@ +## Load libraries ============================================================== +library(RSQLite) +library(tibble) +library(DatabaseConnector) +library(CohortGenerator) +library(CirceR) +library(Capr) + + +## Set-up config =============================================================== +connectionConfig <- config::get( + config = "config", file = "./inst/config/connection_config.yml" +) +config_oth <- config::get( + config = "config", file = "./inst/config/config.yml" +) + + +## Connect to DB =============================================================== +# Use connection details from configuration +connectionDetails <- createConnectionDetails( + dbms = connectionConfig$dbms, + user = connectionConfig$user, + password = connectionConfig$password, + server = connectionConfig$server, + port = connectionConfig$port, + oracleDriver = connectionConfig$oracleDriver, + pathToDriver = connectionConfig$pathToDriver +) + + +## Concept sets ================================================================ +data(conceptSets, package="CaprPHEMS") +# Establish connection +con <- connect(connectionDetails) + +conceptSets$conceptSets <- conceptSets$conceptSets %>% + # Add details for all concepts (excl. descendants) + lapply( + FUN = Capr::getConceptSetDetails, + con = con, + vocabularyDatabaseSchema = connectionConfig$vocabulary_schema + ) + +# Disconnect +disconnect(con) + + +## Concept counts ============================================================== + +# Establish connection +con <- connect(connectionDetails) + +CaprPHEMS::countOccurrences( + v = conceptSets$concepts$uc1, + tables = names(CaprPHEMS::links), # Query all CDM tables + links = CaprPHEMS::links, # Links between tables and concept_id fields (table:field) + db_connection = con, + cdm_schema = connectionConfig$cdm_schema, + vocab_schema = connectionConfig$vocabulary_schema, + save_path = config_oth$save_path_counts +) + +# Disconnect +disconnect(con) + +## Standard and non-standard concepts given a database connection ============== +# Establish connection +con <- connect(connectionDetails) + +# Return table of non-standard concepts +CaprPHEMS::isStandardDB( + db_connection = con, + cdm_schema = connectionConfig$cdm_schema, + vocab_schema = connectionConfig$vocabulary_schema, + links = CaprPHEMS::links, + # (optional) Save the results (with standard and non-standard concepts) + save_path = config_oth$save_path_isStandard +) + +# Disconnect +disconnect(con) + +## Standard and non-standard concepts given a concept set ====================== +# Establish connection +con <- connect(connectionDetails) + +# UC2 used as an Example concept set +uc2 <- conceptSets$conceptSets$uc2 + +# check standardness across concept set +CaprPHEMS::isStandardCS( + conceptSet = conceptSets$conceptSets$uc2, + # (optional) Save the results (with standard and non-standard concepts) + save_path = config_oth$save_path_isStandard +) + +# Disconnect +disconnect(con) diff --git a/inst/templates/cohortCapr.R b/inst/templates/cohortCapr.R deleted file mode 100644 index daae8dd7..00000000 --- a/inst/templates/cohortCapr.R +++ /dev/null @@ -1,255 +0,0 @@ -## ----knitr, include=FALSE----------------------------------------------------- -knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) - -knitr::opts_chunk$set(echo = TRUE) - -# knitr::purl( -# input = './inst/templates/cohortCapr_md.Rmd', -# output = './inst/templates/cohortCapr.R' -# ) - - -## ----Get project configurations----------------------------------------------- -connectionConfig <- config::get(config = 'config', file = './inst/config/connection_config.yml') -config_oth <- config::get(config = 'config', file = './inst/config/config.yml') - - -## ----Load libraries----------------------------------------------------------- -library(RSQLite) -library(tibble) -library(DatabaseConnector) -library(CohortGenerator) -library(CirceR) -library(Capr) - - -## ----connect to database, eval=TRUE, include=TRUE----------------------------- -# Use connection details from configuration -connectionDetails <- createConnectionDetails( - dbms = connectionConfig$dbms, - user = connectionConfig$user, - password = connectionConfig$password, - server = connectionConfig$server, - port = connectionConfig$port, - oracleDriver = connectionConfig$oracleDriver, - pathToDriver = connectionConfig$pathToDriver -) - - -## ----concept sets, echo=TRUE-------------------------------------------------- -## Concept sets -source("./R/conceptSets.R") - -# Establish connection -con <- connect(connectionDetails) - -conceptSets$conceptSets <- conceptSets$conceptSets %>% - # Add details for all concepts (excl. descendants) - lapply(FUN = getConceptSetDetails, - con = con, - vocabularyDatabaseSchema = connectionConfig$vocabulary_schema) - -# Disconnect -disconnect(con) - - -## ----count occurences--------------------------------------------------------- -## Count occurrences of each concept in data - -# Establish connection -con <- connect(connectionDetails) - -# Get countOccurrences function -source("./R/countOccurrences.R") - -# Get links between tables and fields as input -source("./R/table_linked_to_concept_field.R") - -additionalVarsCounts <- - countOccurrences( - conceptSets$concepts$additional, - c("condition_occurrence", "procedure_occurrence", "measurement", "observation"), - links, - con, - connectionConfig$cdm_schema, - connectionConfig$vocabulary_schema, - save_path = config_oth$save_path_counts - ) %>% print() - -# Disconnect -disconnect(con) - - -## ----Standard non-standard check---------------------------------------------- -# Connect to DB -con <- connect(connectionDetails) - -# Return table of non-standard concepts -source('./R/isStandard.R') -nonStandard <- isStandard( - db_connection = con, - data_concepts_path = config_oth$concepts_path, - vocab_schema = connectionConfig$vocabulary_schema, - # (optional) Save the results (with standard and non-standard concepts) - save_path = config_oth$save_path_isStandard -) - -# Disconnect -disconnect(con) - -# Print all non-standard concepts -nonStandard - - - -## ----Standard non-standard check concept set---------------------------------- -# connect to DB -con <- connect(connectionDetails) - -# run for labTests conceptSet -labTests <- conceptSets$conceptSets$labTests - -# check standardness across concept set -source('./R/isStandardCS.R') -nonStandardCS <- isStandardCS( - db_connection = con, - conceptSet = conceptSets$conceptSets$labTests, - # (optional) Save the results (with standard and non-standard concepts) - save_path = config_oth$save_path_isStandard -) - -# Disconnect -disconnect(con) - -# print results (non-standard) -nonStandardCS - - -## ----Cohort definition-------------------------------------------------------- -## Cohort definition -# Create cohort definition -ch <- cohort( - entry = entry( - # enter patients who have had cardiac surgery - procedure(conceptSets$conceptSets$cardiacSurgery), - observationWindow = continuousObservation(0, 0), - primaryCriteriaLimit = "All" - ), - attrition = attrition( - withAny( - # include all cardiac complications - atLeast( - x = 1, - # include all cardiac complications represented by condition concepts - query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications) - ), - atLeast( - x = 1, - # include all cardiac complications represented by procedure concepts - query = procedure(conceptSets$conceptSets$cardiacComplications) - ) - ), - withAny( - atLeast( - x = 1, - # include patients who have had laboratory measurements - query = measurement(conceptSets$conceptSets$labTests) - ) - ) - ), - exit = exit( - endStrategy = observationExit() - ) -) - - -## ----json and sql------------------------------------------------------------- -## Cohort json and sql -# Generate json for cohort -chJson <- ch %>% - Capr::toCirce() %>% - jsonlite::toJSON(pretty = TRUE, auto_unbox = TRUE) %>% - as.character() - -# Generate cohort sql query -sql <- CirceR::buildCohortQuery( - expression = CirceR::cohortExpressionFromJson(chJson), - options = CirceR::createGenerateOptions(generateStats = FALSE) -) - - -## ----Save cohort and concept set json----------------------------------------- -write(chJson, paste0(config_oth$save_path_json, "/cohort.json")) -for (cs in names(conceptSets$conceptSets)) { - writeConceptSet( - x = conceptSets$conceptSets[[cs]], - path = paste(config_oth$save_path_json, "/", cs, "_cs.json", sep="") - ) -} - - -## ----Create and generate cohorts---------------------------------------------- -# Establish connection -con <- connect(connectionDetails) - -# Cohorts to create -cohortsToCreate <- tibble::tibble( - cohortId = 9876, - cohortName = "cohort", - sql = sql -) - -# Cohort tables -cohortTableNames <- CohortGenerator::getCohortTableNames(cohortTable = "cohort") -CohortGenerator::createCohortTables( - connectionDetails = connectionDetails, - cohortDatabaseSchema = "cohort", - cohortTableNames = cohortTableNames, -) - -# Generate the cohorts -cohortsGenerated <- CohortGenerator::generateCohortSet( - connectionDetails = connectionDetails, - cdmDatabaseSchema = "cdm", - cohortDatabaseSchema = "cohort", - cohortTableNames = cohortTableNames, - cohortDefinitionSet = cohortsToCreate -) - -# Get cohort counts -cohortCounts <- CohortGenerator::getCohortCounts( - connectionDetails = connectionDetails, - cohortDatabaseSchema = "cohort", - cohortTable = cohortTableNames$cohortTable -) - -# Disconnect -disconnect(con) - - -cohortCounts - - -## ----Number of people in DB--------------------------------------------------- -# Establish connection -con <- connect(connectionDetails) - -# Count unique person_id in the person table -query_person <- - paste0("SELECT COUNT(DISTINCT person_id) AS num_persons FROM ", connectionConfig$cdm_schema, ".person") -result_person <- dbGetQuery(con, query_person)$num_persons - -# Count unique subject_id in the cardiac_arrest table -query_cohort <- - paste0("SELECT COUNT(DISTINCT subject_id) AS num_persons FROM ", connectionConfig$cohort_schema, ".cohort") - -result_cohort <- dbGetQuery(con, query_cohort)$num_persons - -# Print results -cat("Number of persons in dataset: ", result_person, "\n") -cat("Number of persons in cohort: ", result_cohort, "\n") - - -# Disconnect -disconnect(con) - diff --git a/inst/templates/cohortCapr_template.R b/inst/templates/cohortCapr_template.R deleted file mode 100644 index 407f5519..00000000 --- a/inst/templates/cohortCapr_template.R +++ /dev/null @@ -1,255 +0,0 @@ -## ----knitr, include=FALSE----------------------------------------------------- -knitr::opts_knit$set(root.dir = rprojroot::find_rstudio_root_file()) - -knitr::opts_chunk$set(echo = TRUE) - -knitr::purl( - input = './inst/templates/cohortCapr_md.Rmd', - output = './inst/templates/cohortCapr_template.R' -) - - -## ----Get project configurations----------------------------------------------- -connectionConfig <- config::get(config = 'config', file = './inst/config/connection_config.yml') -config_oth <- config::get(config = 'config', file = './inst/config/config.yml') - - -## ----Load libraries----------------------------------------------------------- -library(RSQLite) -library(tibble) -library(DatabaseConnector) -library(CohortGenerator) -library(CirceR) -library(Capr) - - -## ----connect to database, eval=TRUE, include=TRUE----------------------------- -# Use connection details from configuration -connectionDetails <- createConnectionDetails( - dbms = connectionConfig$dbms, - user = connectionConfig$user, - password = connectionConfig$password, - server = connectionConfig$server, - port = connectionConfig$port, - oracleDriver = connectionConfig$oracleDriver, - pathToDriver = connectionConfig$pathToDriver -) - - -## ----concept sets, echo=TRUE-------------------------------------------------- -## Concept sets -source("./R/conceptSets.R") - -# Establish connection -con <- connect(connectionDetails) - -conceptSets$conceptSets <- conceptSets$conceptSets %>% - # Add details for all concepts (excl. descendants) - lapply(FUN = getConceptSetDetails, - con = con, - vocabularyDatabaseSchema = connectionConfig$vocabulary_schema) - -# Disconnect -disconnect(con) - - -## ----count occurences--------------------------------------------------------- -## Count occurrences of each concept in data - -# Establish connection -con <- connect(connectionDetails) - -# Get countOccurrences function -source("./R/countOccurrences.R") - -# Get links between tables and fields as input -source("./R/table_linked_to_concept_field.R") - -additionalVarsCounts <- - countOccurrences( - conceptSets$concepts$additional, - c("condition_occurrence", "procedure_occurrence", "measurement", "observation"), - links, - con, - connectionConfig$cdm_schema, - connectionConfig$vocabulary_schema, - save_path = config_oth$save_path_counts - ) %>% print() - -# Disconnect -disconnect(con) - - -## ----Standard non-standard check---------------------------------------------- -# Connect to DB -con <- connect(connectionDetails) - -# Return table of non-standard concepts -source('./R/isStandard.R') -nonStandard <- isStandard( - db_connection = con, - data_concepts_path = config_oth$concepts_path, - vocab_schema = connectionConfig$vocabulary_schema, - # (optional) Save the results (with standard and non-standard concepts) - save_path = config_oth$save_path_isStandard -) - -# Disconnect -disconnect(con) - -# Print all non-standard concepts -nonStandard - - - -## ----Standard non-standard check concept set---------------------------------- -# connect to DB -con <- connect(connectionDetails) - -# run for labTests conceptSet -labTests <- conceptSets$conceptSets$labTests - -# check standardness across concept set -source('./R/isStandardCS.R') -nonStandardCS <- isStandardCS( - db_connection = con, - conceptSet = conceptSets$conceptSets$labTests, - # (optional) Save the results (with standard and non-standard concepts) - save_path = config_oth$save_path_isStandard -) - -# Disconnect -disconnect(con) - -# print results (non-standard) -nonStandardCS - - -## ----Cohort definition-------------------------------------------------------- -## Cohort definition -# Create cohort definition -ch <- cohort( - entry = entry( - # enter patients who have had cardiac surgery - procedure(conceptSets$conceptSets$cardiacSurgery), - observationWindow = continuousObservation(0, 0), - primaryCriteriaLimit = "All" - ), - attrition = attrition( - withAny( - # include all cardiac complications - atLeast( - x = 1, - # include all cardiac complications represented by condition concepts - query = conditionOccurrence(conceptSets$conceptSets$cardiacComplications) - ), - atLeast( - x = 1, - # include all cardiac complications represented by procedure concepts - query = procedure(conceptSets$conceptSets$cardiacComplications) - ) - ), - withAny( - atLeast( - x = 1, - # include patients who have had laboratory measurements - query = measurement(conceptSets$conceptSets$labTests) - ) - ) - ), - exit = exit( - endStrategy = observationExit() - ) -) - - -## ----json and sql------------------------------------------------------------- -## Cohort json and sql -# Generate json for cohort -chJson <- ch %>% - Capr::toCirce() %>% - jsonlite::toJSON(pretty = TRUE, auto_unbox = TRUE) %>% - as.character() - -# Generate cohort sql query -sql <- CirceR::buildCohortQuery( - expression = CirceR::cohortExpressionFromJson(chJson), - options = CirceR::createGenerateOptions(generateStats = FALSE) -) - - -## ----Save cohort and concept set json----------------------------------------- -write(chJson, paste0(config_oth$save_path_json, "/cohort.json")) -for (cs in names(conceptSets$conceptSets)) { - writeConceptSet( - x = conceptSets$conceptSets[[cs]], - path = paste(config_oth$save_path_json, "/", cs, "_cs.json", sep="") - ) -} - - -## ----Create and generate cohorts---------------------------------------------- -# Establish connection -con <- connect(connectionDetails) - -# Cohorts to create -cohortsToCreate <- tibble::tibble( - cohortId = 9876, - cohortName = "cohort", - sql = sql -) - -# Cohort tables -cohortTableNames <- CohortGenerator::getCohortTableNames(cohortTable = "cohort") -CohortGenerator::createCohortTables( - connectionDetails = connectionDetails, - cohortDatabaseSchema = "cohort", - cohortTableNames = cohortTableNames, -) - -# Generate the cohorts -cohortsGenerated <- CohortGenerator::generateCohortSet( - connectionDetails = connectionDetails, - cdmDatabaseSchema = "cdm", - cohortDatabaseSchema = "cohort", - cohortTableNames = cohortTableNames, - cohortDefinitionSet = cohortsToCreate -) - -# Get cohort counts -cohortCounts <- CohortGenerator::getCohortCounts( - connectionDetails = connectionDetails, - cohortDatabaseSchema = "cohort", - cohortTable = cohortTableNames$cohortTable -) - -# Disconnect -disconnect(con) - - -cohortCounts - - -## ----Number of people in DB--------------------------------------------------- -# Establish connection -con <- connect(connectionDetails) - -# Count unique person_id in the person table -query_person <- - paste0("SELECT COUNT(DISTINCT person_id) AS num_persons FROM ", connectionConfig$cdm_schema, ".person") -result_person <- dbGetQuery(con, query_person)$num_persons - -# Count unique subject_id in the cardiac_arrest table -query_cohort <- - paste0("SELECT COUNT(DISTINCT subject_id) AS num_persons FROM ", connectionConfig$cohort_schema, ".cohort") - -result_cohort <- dbGetQuery(con, query_cohort)$num_persons - -# Print results -cat("Number of persons in dataset: ", result_person, "\n") -cat("Number of persons in cohort: ", result_cohort, "\n") - - -# Disconnect -disconnect(con) - diff --git a/man/Capr-PHEMS-package.Rd b/man/CaprPHEMS-package.Rd similarity index 84% rename from man/Capr-PHEMS-package.Rd rename to man/CaprPHEMS-package.Rd index 628b6a72..5affd2a8 100644 --- a/man/Capr-PHEMS-package.Rd +++ b/man/CaprPHEMS-package.Rd @@ -1,13 +1,11 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/Capr.R \docType{package} -\name{Capr-PHEMS-package} -\alias{Capr-PHEMS} -\alias{Capr-PHEMS-package} -\title{Capr-PHEMS: Cohort Definition Application Programming - project specific for PHEMS} +\name{CaprPHEMS-package} +\alias{CaprPHEMS} +\alias{CaprPHEMS-package} +\title{CaprPHEMS: Cohort Definition Application Programming - project specific for PHEMS} \description{ -\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} - Provides a programming language for defining cohort definitions in R to use in studies for Observational Health Data Sciences and Informatics (OHDSI). The functions in 'Capr' allow for the programmatic creation of OHDSI concept sets and cohorts that can be serialized to 'OHDSI' compatible 'json' files or to 'OHDSI-SQL'. 'Capr' functions can be used to create, save, and load component parts to a cohort definition allowing R programmers to easily reuse cohort logic. 'Capr' provides tools to create a large number of OHDSI cohorts while also helping bridge the gap between human readable descriptions of clinical phenotypes and their computational implementation. For PHEMS this package has been extended with additional functions to support PHEMS cohort creation. } \seealso{ diff --git a/man/conceptSets.Rd b/man/conceptSets.Rd index fbf9568a..51a17500 100644 --- a/man/conceptSets.Rd +++ b/man/conceptSets.Rd @@ -1,10 +1,17 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/conceptSets.R +% Please edit documentation in R/data.R +\docType{data} \name{conceptSets} \alias{conceptSets} -\title{Medical Concept Sets Definition and Expansion} +\title{Concept set definitions by use case} +\format{ +An object of class \code{list} of length 2. +} +\usage{ +conceptSets +} \description{ -This script defines and expands various concept sets related to medical data. It utilizes the Capr library to fetch all descendant concepts +ConceptSets related to PHEMS variables are defined in ./data_raw/conceptSetsPHEMS.R. The base Capr library is used to fetch all descendant concepts for each defined concept set, ensuring comprehensive coverage of related medical concepts. } \details{ @@ -14,4 +21,7 @@ the `conceptSets` object. Finally, the script outputs a confirmation message ind } \note{ This script requires the Capr library to be installed and loaded for proper execution. + +Duplicated concepts within the same UC have been removed; keeping the first occurrence. } +\keyword{datasets} diff --git a/man/countOccurrences.Rd b/man/countOccurrences.Rd index 93627cff..0c3ecc6e 100644 --- a/man/countOccurrences.Rd +++ b/man/countOccurrences.Rd @@ -2,31 +2,41 @@ % Please edit documentation in R/countOccurrences.R \name{countOccurrences} \alias{countOccurrences} -\title{Count Occurrences of Values in Database Tables} +\title{Count Occurrences of Concept IDs in OMOP Database} \usage{ -countOccurrences(v, tables, links, db_connection, cdm_schema, vocab_schema) +countOccurrences( + db_connection, + cdm_schema, + vocab_schema, + v, + tables, + links, + save_path +) } \arguments{ +\item{db_connection}{A database connection object through which queries will be executed.} + +\item{cdm_schema}{The database cdm_schema in which the tables are located.} + +\item{vocab_schema}{The database vocab_schema in which the concept tables are located.} + \item{v}{A vector of concept_ids to count occurrences for.} \item{tables}{A character vector of CDM table names to search within.} \item{links}{A list linking each table to its respective concept_id field.} -\item{db_connection}{A database connection object through which queries will be executed.} - -\item{cdm_schema}{The database cdm_schema in which the tables are located.} - -\item{vocab_schema}{The database vocab_schema in which the concept tables are located.} +\item{save_path}{The path to save the results to as a CSV file. If NULL, the results are not saved.} } \value{ -A tibble with columns for the number of times any concept from 'v' occurs: direct count of persons, - direct count of records, descendant count of persons, and descendant count of records. - The tibble also includes the concept names derived from `v` and is arranged by the total +A tibble with columns for the number of times any concept from 'v' occurs: direct count of persons, + direct count of records, descendant count of persons, and descendant count of records. + The tibble also includes the concept names and domain ids derived from `v` and is arranged by the total record count (direct + descendant). } \description{ -This function counts the occurrences of specified concept ids within specified tables in a OMOP database, +This function counts the occurrences of specified concept IDs within specified tables in an OMOP database, including direct occurrences and occurrences through descendants, based on a provided cdm_schema and links. It returns a tibble summarizing the counts across persons and across records. } @@ -34,8 +44,11 @@ It returns a tibble summarizing the counts across persons and across records. # Assuming `db_connection` is a valid database connection, `cdm_schema` is set to "public", # `tables` contains the names of the tables to search, `links` defines the relevant fields, # and `v` contains the values to search for: -results <- countOccurrences(v = c(1, 2), tables = c("observation", "condition_occurrence"), - links = list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id", ...), - db_connection = db_connection, cdm_schema = "public") +results <- countOccurrences( + db_connection = db_connection, cdm_schema = "public", vocab_schema = "vocabulary", + v = c(1, 2), tables = c("observation", "condition_occurrence"), + links = list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id"), + save_path = NULL +) } diff --git a/man/cs.Rd b/man/cs.Rd index cbc89be3..0f1e8a7c 100644 --- a/man/cs.Rd +++ b/man/cs.Rd @@ -1,66 +1,61 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/conceptSet.R -\docType{data} -\name{cs} -\alias{cs} -\alias{exclude} -\alias{mapped} -\alias{descendants} -\title{Create a concept set} -\format{ -An object of class \code{character} of length 1. -} -\usage{ -cs - -exclude(...) - -mapped(...) - -descendants(...) -} -\arguments{ -\item{...}{One or more numeric vectors that can be coerced to integers, or -Calls to helper functions "exclude", "descendants", or "mapped".} - -\item{name}{A name for the concept set} - -\item{id}{An id for the concept set} -} -\value{ -A Capr Concept Set Object - -A list of Capr concepts - -A list of Capr concepts - -A list of Capr concepts -} -\description{ -cs is used to create concept set expressions. - -`exclude` is meant to be used inside `cs` when creating a new concept set. - -`mapped` is meant to be used inside `cs` when creating a new concept set. - -`descendants` is meant to be used inside `cs` when creating a new concept set. -} -\section{Functions}{ -\itemize{ -\item \code{exclude()}: exclude concepts - -\item \code{mapped()}: Include mapped concepts - -\item \code{descendants()}: Include descendants - -}} -\examples{ -cs(1, 2, name = "concepts") -cs(1, c(10, 11, 2), name = "concepts") -cs(1, seq(2, 10, 2), name = "concepts") -cs(1, 2, 3, exclude(4, 5), name = "concepts") -cs(1, 2, 3, exclude(4, 5), mapped(6, 7), name = "concepts") -cs(1, 2, 3, exclude(4, 5), mapped(6, 7), descendants(8, 9), name = "concepts") -cs(descendants(1, 2, 3), exclude(descendants(8, 9)), name = "concepts") -} -\keyword{datasets} +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/conceptSet.R +\name{cs} +\alias{cs} +\alias{exclude} +\alias{mapped} +\alias{descendants} +\title{Create a concept set} +\usage{ +cs(..., name, id = NULL) + +exclude(...) + +mapped(...) + +descendants(...) +} +\arguments{ +\item{...}{One or more numeric vectors that can be coerced to integers, or +Calls to helper functions "exclude", "descendants", or "mapped".} + +\item{name}{A name for the concept set} + +\item{id}{An id for the concept set} +} +\value{ +A Capr Concept Set Object + +A list of Capr concepts + +A list of Capr concepts + +A list of Capr concepts +} +\description{ +cs is used to create concept set expressions. + +`exclude` is meant to be used inside `cs` when creating a new concept set. + +`mapped` is meant to be used inside `cs` when creating a new concept set. + +`descendants` is meant to be used inside `cs` when creating a new concept set. +} +\section{Functions}{ +\itemize{ +\item \code{exclude()}: exclude concepts + +\item \code{mapped()}: Include mapped concepts + +\item \code{descendants()}: Include descendants + +}} +\examples{ +cs(1, 2, name = "concepts") +cs(1, c(10, 11, 2), name = "concepts") +cs(1, seq(2, 10, 2), name = "concepts") +cs(1, 2, 3, exclude(4, 5), name = "concepts") +cs(1, 2, 3, exclude(4, 5), mapped(6, 7), name = "concepts") +cs(1, 2, 3, exclude(4, 5), mapped(6, 7), descendants(8, 9), name = "concepts") +cs(descendants(1, 2, 3), exclude(descendants(8, 9)), name = "concepts") +} diff --git a/man/figures/logo.png b/man/figures/logo.png deleted file mode 100644 index 8747244e..00000000 Binary files a/man/figures/logo.png and /dev/null differ diff --git a/man/isStandardCS.Rd b/man/isStandardCS.Rd index 4fb8a475..3feb4329 100644 --- a/man/isStandardCS.Rd +++ b/man/isStandardCS.Rd @@ -4,26 +4,24 @@ \alias{isStandardCS} \title{Check for Non-Standard Concepts in Concept Sets} \usage{ -isStandardCS(db_connection, conceptSet, save_path = NULL) +isStandardCS(conceptSet, save_path = NULL) } \arguments{ -\item{db_connection}{A DBI database connection object to the SQL database containing the standard concepts table. This parameter is currently not used in the function but intended for future use where database queries might be necessary.} - \item{conceptSet}{An object representing a set of concepts, containing details such as concept ID, concept name, and whether it is a standard concept. The structure of this object should support `@Expression` to access the individual concepts and their properties.} \item{save_path}{(Optional) The file path where the details of non-standard concepts should be saved as a CSV file. If not provided, the information will not be saved but will still be checked for non-standard concepts.} } \value{ -A tibble containing the columns `concept_name`, `concept_id`, `concept_set`, and `standard`, which represent the concept name, concept ID, the name of the concept set, and the standard status for each concept found to be non-standard or not classified as standard. +A tibble containing the columns `concept_name`, `concept_id`, `concept_set`, and `standard_concept`, which represent the concept name, concept ID, the name of the concept set, and the standard status for each concept found to be non-standard or not classified as standard. } \description{ This function examines a concept set for non-standard concepts by comparing them against a standard concepts table in a SQL database. It identifies non-standard concepts and optionally saves the details of these non-standard concepts to a specified path. } \details{ -The function processes a given concept set to identify non-standard concepts. Non-standard concepts are those not marked as 'S' (Standard) or 'C' (Classification) in their `standard_concept` attribute. The function creates a data frame with concept details, filters out standard and classification concepts, and if a `save_path` is provided, saves this information to a CSV file. If no non-standard concepts are found, appropriate messages are displayed. +The function processes a given concept set to identify non-standard concepts. Non-standard concepts are those not marked as 'S' (Standard) or 'C' (Classification) in their `standard_concept` attribute. The function creates a data frame with concept details, replaces empty `standard_concept` values with "Non-standard", filters out standard and classification concepts, and if a `save_path` is provided, saves this information to a CSV file. If no non-standard concepts are found, appropriate messages are displayed. } \examples{ # Assuming you have a concept set `conceptSet`: -non_standard_concepts <- isStandardCS(db_conn, conceptSet, "path/to/save_standard_AND_non_standard/") +non_standard_concepts <- isStandardCS(conceptSet, "path/to/save_standard_AND_non_standard/") } diff --git a/man/isStandardDB.Rd b/man/isStandardDB.Rd new file mode 100644 index 00000000..d45f5fbf --- /dev/null +++ b/man/isStandardDB.Rd @@ -0,0 +1,39 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/isStandardDB.R +\name{isStandardDB} +\alias{isStandardDB} +\title{Identify Non-Standard Concepts in Database} +\usage{ +isStandardDB(db_connection, cdm_schema, vocab_schema, links, save_path) +} +\arguments{ +\item{db_connection}{A DBI database connection object to the SQL database containing the standard concepts table.} + +\item{cdm_schema}{The schema name of the Common Data Model (CDM) database containing the source tables.} + +\item{vocab_schema}{The schema name of the vocabulary database containing the standard concepts table.} + +\item{links}{A named list where each name is a table name and each value is a vector of two strings: the column names for `concept_id` and `source_code` in that table.} + +\item{save_path}{(Optional) The file path where the joined tables containing non-standard concepts should be saved. If not provided, the tables will not be saved but will still be checked for non-standard concepts.} +} +\value{ +A tibble containing the columns `concept_id`, `concept_name`, `source_code`, and `source_table`, representing the concept ID, concept name, source code, and source table name for each non-standard concept found. +} +\description{ +This function checks a set of tables for non-standard concepts by comparing them against the concept table in a SQL database. It identifies non-standard concepts and optionally saves the joined tables containing these non-standard concepts. +} +\details{ +The function first queries the `concept` table from the provided SQL database to retrieve the standard concepts. It then reads each specified table, preparing and joining it with the standard concepts table based on the concept ID. Non-standard concepts are identified based on the `standard_concept` column being `NA`. Information about these non-standard concepts is collected and returned as a tibble. The function also adds a `source_table` column to indicate the source table name. + +If a `save_path` is provided, each joined table (including both standard and non-standard concepts) is saved to the specified directory with the same name as the original table file. +} +\examples{ +# Assuming you have a valid DBI connection `db_conn` and your tables are specified in the `links` list: +links <- list( + "table1" = c("concept_id_col1", "source_code_col1"), + "table2" = c("concept_id_col2", "source_code_col2") +) +non_standard_concepts <- isStandardDB(db_conn, "cdm_schema", "vocab_schema", links, "path/to/save_non_standard/") + +} diff --git a/renv.lock b/renv.lock index ab095ac1..1a76e5b4 100644 --- a/renv.lock +++ b/renv.lock @@ -77,18 +77,18 @@ }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.12", + "Version": "1.0.13", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods", "utils" ], - "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" + "Hash": "f27411eb6d9c3dada5edd444b8416675" }, "SqlRender": { "Package": "SqlRender", - "Version": "1.18.0", + "Version": "1.18.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -96,7 +96,7 @@ "rJava", "rlang" ], - "Hash": "e1762de0f08b14658d74989c10e2f265" + "Hash": "ea71a7a1a06f53090d9fa72fdf21cd76" }, "backports": { "Package": "backports", @@ -146,7 +146,7 @@ }, "checkmate": { "Package": "checkmate", - "Version": "2.3.1", + "Version": "2.3.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -154,7 +154,7 @@ "backports", "utils" ], - "Hash": "c01cab1cb0f9125211a6fc99d540e315" + "Hash": "0ec787de547f8a134e7ac0470048ec47" }, "cli": { "Package": "cli", @@ -189,13 +189,13 @@ }, "cpp11": { "Package": "cpp11", - "Version": "0.4.7", + "Version": "0.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "5a295d7d963cc5035284dcdbaf334f4e" + "Hash": "91570bba75d0c9d3f1040c835cee8fba" }, "crayon": { "Package": "crayon", @@ -239,14 +239,14 @@ }, "digest": { "Package": "digest", - "Version": "0.6.36", + "Version": "0.6.37", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "fd6824ad91ede64151e93af67df6376b" + "Hash": "33698c4b3127fc9f506654607fb73676" }, "dplyr": { "Package": "dplyr", @@ -682,7 +682,7 @@ }, "withr": { "Package": "withr", - "Version": "3.0.0", + "Version": "3.0.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -690,7 +690,7 @@ "grDevices", "graphics" ], - "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" + "Hash": "07909200e8bbe90426fbfeb73e1e27aa" } } } diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..6c22c7f0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,51 @@ +CirceR >= 1.3.3 +DBI >= 1.2.3 +DatabaseConnector >= 6.3.2 +R6 >= 2.5.1 +RJSONIO >= 1.3-1.9 +Rcpp >= 1.0.12 +SqlRender >= 1.18.0 +backports >= 1.5.0 +bit >= 4.0.5 +bit64 >= 4.0.5 +blob >= 1.2.4 +checkmate >= 2.3.1 +cli >= 3.6.3 +clipr >= 0.8.0 +codetools >= 0.2-20 +cpp11 >= 0.4.7 +crayon >= 1.5.3 +dbplyr >= 2.5.0 +digest >= 0.6.36 +dplyr >= 1.1.4 +fansi >= 1.0.6 +fs >= 1.6.4 +generics >= 0.1.3 +glue >= 1.7.0 +hms >= 1.1.3 +jsonlite >= 1.8.8 +lifecycle >= 1.0.4 +lubridate >= 1.9.3 +magrittr >= 2.0.3 +pillar >= 1.9.0 +pkgconfig >= 2.0.3 +prettyunits >= 1.2.0 +progress >= 1.2.3 +purrr >= 1.0.2 +rJava >= 1.0-11 +readr >= 2.1.5 +renv >= 1.0.7 +rlang >= 1.1.4 +stringi >= 1.8.4 +stringr >= 1.5.1 +tibble >= 3.2.1 +tidyr >= 1.3.1 +tidyselect >= 1.2.1 +timechange >= 0.3.0 +triebeard >= 0.4.1 +tzdb >= 0.4.0 +urltools >= 1.7.3 +utf8 >= 1.2.4 +vctrs >= 0.6.5 +vroom >= 1.6.5 +withr >= 3.0.0 diff --git a/tests/testthat/resources/ihd_cad_NS.json b/tests/testthat/resources/ihd_cad_NS.json new file mode 100644 index 00000000..2a51d7ae --- /dev/null +++ b/tests/testthat/resources/ihd_cad_NS.json @@ -0,0 +1,55 @@ +{ + "items": [ + { + "concept": { + "CONCEPT_ID": 40398869, + "CONCEPT_NAME": "Coronary (atherosclerosis or artery disease) or triple vessel disease of the heart", + "STANDARD_CONCEPT": "", + "STANDARD_CONCEPT_CAPTION": "", + "INVALID_REASON": "D", + "INVALID_REASON_CAPTION": "", + "CONCEPT_CODE": "194841001", + "DOMAIN_ID": "Condition", + "VOCABULARY_ID": "SNOMED", + "CONCEPT_CLASS_ID": "Disorder" + }, + "isExcluded": false, + "includeDescendants": true, + "includeMapped": false + }, + { + "concept": { + "CONCEPT_ID": 40348851, + "CONCEPT_NAME": "Ischemic heart disease", + "STANDARD_CONCEPT": "", + "STANDARD_CONCEPT_CAPTION": "", + "INVALID_REASON": "D", + "INVALID_REASON_CAPTION": "", + "CONCEPT_CODE": "2610009", + "DOMAIN_ID": "Condition", + "VOCABULARY_ID": "SNOMED", + "CONCEPT_CLASS_ID": "Disorder" + }, + "isExcluded": false, + "includeDescendants": true, + "includeMapped": false + }, + { + "concept": { + "CONCEPT_ID": 37063456, + "CONCEPT_NAME": "Hospital admission ischemic heart disease diagnosis | Patient | Cardiopulmonary", + "STANDARD_CONCEPT": "C", + "STANDARD_CONCEPT_CAPTION": "Classification", + "INVALID_REASON": "V", + "INVALID_REASON_CAPTION": "Valid", + "CONCEPT_CODE": "LP408320-2", + "DOMAIN_ID": "Measurement", + "VOCABULARY_ID": "LOINC", + "CONCEPT_CLASS_ID": "LOINC Hierarchy" + }, + "isExcluded": false, + "includeDescendants": true, + "includeMapped": false + } + ] +} diff --git a/tests/testthat/resources/ihd_cad_S.json b/tests/testthat/resources/ihd_cad_S.json new file mode 100644 index 00000000..d9355519 --- /dev/null +++ b/tests/testthat/resources/ihd_cad_S.json @@ -0,0 +1,38 @@ +{ + "items": [ + { + "concept": { + "CONCEPT_ID": 4185932, + "CONCEPT_NAME": "Ischemic heart disease", + "STANDARD_CONCEPT": "S", + "STANDARD_CONCEPT_CAPTION": "Standard", + "INVALID_REASON": "V", + "INVALID_REASON_CAPTION": "Valid", + "CONCEPT_CODE": "414545008", + "DOMAIN_ID": "Condition", + "VOCABULARY_ID": "SNOMED", + "CONCEPT_CLASS_ID": "Disorder" + }, + "isExcluded": false, + "includeDescendants": true, + "includeMapped": false + }, + { + "concept": { + "CONCEPT_ID": 317576, + "CONCEPT_NAME": "Coronary arteriosclerosis", + "STANDARD_CONCEPT": "S", + "STANDARD_CONCEPT_CAPTION": "Standard", + "INVALID_REASON": "V", + "INVALID_REASON_CAPTION": "Valid", + "CONCEPT_CODE": "53741008", + "DOMAIN_ID": "Condition", + "VOCABULARY_ID": "SNOMED", + "CONCEPT_CLASS_ID": "Disorder" + }, + "isExcluded": false, + "includeDescendants": true, + "includeMapped": false + } + ] +} diff --git a/tests/testthat/resources/ihd_cad_mix.json b/tests/testthat/resources/ihd_cad_mix.json new file mode 100644 index 00000000..0bd03b67 --- /dev/null +++ b/tests/testthat/resources/ihd_cad_mix.json @@ -0,0 +1,55 @@ +{ + "items": [ + { + "concept": { + "CONCEPT_ID": 4185932, + "CONCEPT_NAME": "Ischemic heart disease", + "STANDARD_CONCEPT": "S", + "STANDARD_CONCEPT_CAPTION": "Standard", + "INVALID_REASON": "V", + "INVALID_REASON_CAPTION": "Valid", + "CONCEPT_CODE": "414545008", + "DOMAIN_ID": "Condition", + "VOCABULARY_ID": "SNOMED", + "CONCEPT_CLASS_ID": "Disorder" + }, + "isExcluded": false, + "includeDescendants": true, + "includeMapped": false + }, + { + "concept": { + "CONCEPT_ID": 40348851, + "CONCEPT_NAME": "Ischemic heart disease", + "STANDARD_CONCEPT": "", + "STANDARD_CONCEPT_CAPTION": "", + "INVALID_REASON": "D", + "INVALID_REASON_CAPTION": "", + "CONCEPT_CODE": "2610009", + "DOMAIN_ID": "Condition", + "VOCABULARY_ID": "SNOMED", + "CONCEPT_CLASS_ID": "Disorder" + }, + "isExcluded": false, + "includeDescendants": true, + "includeMapped": false + }, + { + "concept": { + "CONCEPT_ID": 37063456, + "CONCEPT_NAME": "Hospital admission ischemic heart disease diagnosis | Patient | Cardiopulmonary", + "STANDARD_CONCEPT": "C", + "STANDARD_CONCEPT_CAPTION": "Classification", + "INVALID_REASON": "V", + "INVALID_REASON_CAPTION": "Valid", + "CONCEPT_CODE": "LP408320-2", + "DOMAIN_ID": "Measurement", + "VOCABULARY_ID": "LOINC", + "CONCEPT_CLASS_ID": "LOINC Hierarchy" + }, + "isExcluded": false, + "includeDescendants": true, + "includeMapped": false + } + ] +} diff --git a/tests/testthat/test-countOccurrences.R b/tests/testthat/test-countOccurrences.R new file mode 100644 index 00000000..04cbb2c4 --- /dev/null +++ b/tests/testthat/test-countOccurrences.R @@ -0,0 +1,232 @@ +source("R/countOccurrences.R") + +test_that("countOccurrences returns correct structure", { + mock_db <- mockery::mock() + attr(mock_db, "dbms") <- "postgresql" + + # Sample concept IDs + concept_id <- c("A" = 1, "B" = 2) + + # Mock the dbWriteTable function to do nothing + mockery::stub(countOccurrences, "DatabaseConnector::dbExecute", function(...) TRUE) + + # Mock the querySql function to return a predefined result + mockery::stub(countOccurrences, "DatabaseConnector::dbGetQuery", function(...) { + tibble::tibble( + concept_id = concept_id, + concept_name = c("A", "B"), + domain_id = c("Observation", "Observation"), + count_persons = c(1, 2), + count_records = c(3, 4), + desc_count_person = c(5, 6), + desc_count_record = c(7, 8) + ) + }) + + v <- c(1, 2) + tables <- c("observation", "condition_occurrence") + links <- list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id") + cdm_schema <- "main" + vocab_schema <- "main" + + result <- countOccurrences(v, tables, links, mock_db, cdm_schema, vocab_schema) + + expect_s3_class(result, "tbl_df") + expect_true(all(c("concept_id", "count_persons", "count_records", "desc_count_person", "desc_count_record", "concept_name") %in% colnames(result))) +}) + + +test_that("countOccurrences handles empty input", { + mock_db <- mockery::mock() + attr(mock_db, "dbms") <- "postgresql" + + # Mock the querySql function to return an empty result + mockery::stub(countOccurrences, "DatabaseConnector::dbGetQuery", function(...) { + tibble::tibble( + concept_id = integer(), + count_persons = integer(), + count_records = integer(), + desc_count_person = integer(), + desc_count_record = integer() + ) + }) + + v <- c() + tables <- c("observation") + links <- list(observation = "observation_concept_id") + cdm_schema <- "main" + vocab_schema <- "main" + + expect_error(countOccurrences(v, tables, links, mock_db, cdm_schema, vocab_schema)) +}) + + +test_that("countOccurrences handles missing concept ids", { + mock_db <- mockery::mock() + attr(mock_db, "dbms") <- "postgresql" + + # Mock the dbWriteTable function to do nothing + mockery::stub(countOccurrences, "DatabaseConnector::dbExecute", function(...) TRUE) + + # Mock the querySql function to return a result with no matching concept ids + mockery::stub(countOccurrences, "DatabaseConnector::dbGetQuery", function(...) { + tibble::tibble( + concept_id = integer(), + concept_name = character(), + domain_id = character(), + count_persons = integer(), + count_records = integer(), + desc_count_person = integer(), + desc_count_record = integer() + ) + }) + + v <- c(4, 5) + tables <- c("observation", "condition_occurrence") + links <- list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id") + cdm_schema <- "main" + vocab_schema <- "main" + + result <- countOccurrences(v, tables, links, mock_db, cdm_schema, vocab_schema) + + expect_s3_class(result, "tbl_df") + expect_equal(nrow(result), length(v)) + expect_true(all(result$concept_name == "Unknown; concept_id not found in data")) + expect_true(all(result$domain_id == "Unknown; concept_id not found in data")) + expect_true(all(result$count_persons == 0)) + expect_true(all(result$count_records == 0)) + expect_true(all(result$desc_count_person == 0)) + expect_true(all(result$desc_count_record == 0)) +}) + + +test_that("countOccurrences saves results to file", { + mock_db <- mockery::mock() + attr(mock_db, "dbms") <- "postgresql" + + # Mock the dbWriteTable function to do nothing + mockery::stub(countOccurrences, "DatabaseConnector::dbExecute", function(...) TRUE) + + # Mock the querySql function to return a predefined result + mockery::stub(countOccurrences, "DatabaseConnector::dbGetQuery", function(...) { + tibble::tibble( + concept_id = c(1, 2), + concept_name = c("A", "B"), + domain_id = c("Observation", "Condition"), + count_persons = c(2, 1), + count_records = c(3, 1), + desc_count_person = c(1, 0), + desc_count_record = c(1, 0) + ) + }) + + v <- c(1, 2) + tables <- c("observation", "condition_occurrence") + links <- list(observation = "observation_concept_id", condition_occurrence = "condition_concept_id") + cdm_schema <- "main" + vocab_schema <- "main" + save_path <- tempdir() + + result <- countOccurrences(v, tables, links, mock_db, cdm_schema, vocab_schema, save_path) + + expect_equal(result, readr::read_csv(file.path(save_path, "count_occurrences.csv"))) +}) + + +test_that("countOccurrences performs count query correctly", { + # Create a connection to an in-memory SQLite database + connectionDetails <- DatabaseConnector::createConnectionDetails(dbms = "sqlite", server = ":memory:") + conn <- DatabaseConnector::connect(connectionDetails) + + # Create the observation table + DatabaseConnector::dbExecute(conn, " + CREATE TABLE main.observation ( + observation_id INTEGER PRIMARY KEY, + person_id INTEGER, + observation_concept_id INTEGER + ) +") + + # Create the concept_ancestor table + DatabaseConnector::dbExecute(conn, " + CREATE TABLE main.concept_ancestor ( + ancestor_concept_id INTEGER, + descendant_concept_id INTEGER + ) +") + + # Create the concept table + DatabaseConnector::dbExecute(conn, " + CREATE TABLE main.concept ( + concept_id INTEGER PRIMARY KEY, + concept_name TEXT, + domain_id TEXT + )") + + # Insert sample data into the observation table + DatabaseConnector::dbExecute(conn, " + INSERT INTO main.observation (observation_id, person_id, observation_concept_id) VALUES + (1, 101, 1001), + (2, 102, 1002), + (3, 103, 1003), + (4, 101, 2004) +") + + # Insert sample data into the concept_ancestor table + DatabaseConnector::dbExecute(conn, " + INSERT INTO main.concept_ancestor (ancestor_concept_id, descendant_concept_id) VALUES + (1001, 1001), + (1002, 1002), + (1003, 1003), + (1004, 1004), + (1001, 2001), + (1002, 2002), + (1003, 2003), + (1004, 2004) +") + + # Insert test data into the concept table + DatabaseConnector::dbExecute(conn, " + INSERT INTO main.concept (concept_id, concept_name, domain_id) VALUES + (1001, 'A', 'Observation'), + (1002, 'B', 'Observation'), + (1003, 'C', 'Observation'), + (1004, 'D', 'Observation') +") + + observation_data <- DatabaseConnector::dbGetQuery(conn, "SELECT * FROM main.observation") + ancestor_data <- DatabaseConnector::dbGetQuery(conn, "SELECT * FROM main.concept_ancestor") + concept_data <- DatabaseConnector::dbGetQuery(conn, "SELECT * FROM main.concept") + + # Define the schema and tables + vocab_schema <- "main" + save_path <- tempdir() + + # Mock data for testing + v <- c(1001, 1002, 1003, 1004) + tables <- c("observation") + links <- list(observation = "observation_concept_id") + cdm_schema <- "main" + vocab_schema <- "main" + + # Run the countOccurrences function + result <- countOccurrences(v, tables, links, conn, cdm_schema, vocab_schema, save_path) + + # Verify the results + expect_true(file.exists(file.path(save_path, "count_occurrences.csv"))) + + expected_result <- tibble::tibble( + concept_id = c(1001, 1002, 1003, 1004), + concept_name = c("A", "B", "C", "D"), + domain_id = rep.int("Observation", 4), + count_persons = c(1, 1, 1, 0), + count_records = c(1, 1, 1, 0), + desc_count_person = c(1, 1, 1, 1), + desc_count_record = c(1, 1, 1, 1) + ) |> + dplyr::arrange(dplyr::desc(count_records + desc_count_record)) + + expect_equal(result, expected_result) + + DatabaseConnector::disconnect(conn) +}) diff --git a/tests/testthat/test-isStandard.R b/tests/testthat/test-isStandard.R new file mode 100644 index 00000000..fcbe9444 --- /dev/null +++ b/tests/testthat/test-isStandard.R @@ -0,0 +1,127 @@ +source("R/isStandard.R") + +test_that("isStandard works expectedly with no data", { + db_connection <- mockery::mock() + data_concepts_path <- tempdir() + vocab_schema <- "cdm" + save_path <- tempdir() + + expect_error( + isStandard(db_connection, data_concepts_path, vocab_schema, save_path) + ) + unlink(data_concepts_path, recursive = TRUE, force = TRUE) +}) + + +test_that("isStandard works correctly with only standard concepts", { + db_connection <- mockery::mock() + attr(db_connection, "dbms") <- "postgresql" + data_concepts_path <- tempdir() + vocab_schema <- "vocab_schema" + + # Mock the concept table query result + concept_table <- tibble::tibble( + CONCEPT_ID = c("1", "2"), + CONCEPT_NAME = c("Standard1", "Standard2"), + STANDARD_CONCEPT = c("S", "S"), + ) + + mockery::stub(isStandard, "DatabaseConnector::querySql", concept_table) + + # Mock source data + mockdatapath <- tempfile(pattern = "mockdata", fileext = ".csv", tmpdir = data_concepts_path) + mockdata <- tibble::tribble( + ~sourceCode, ~concept_id, + "A", "1", + "B", "2" + ) + + # Create a mock CSV file with standard concepts + write.csv(data.frame(mockdata), mockdatapath, row.names = FALSE) + + res <- isStandard(db_connection, data_concepts_path, vocab_schema) + + expect_equal(nrow(res), 0) + + unlink(data_concepts_path, recursive = TRUE, force = TRUE) +}) + +test_that("isStandard works correctly with non-standard concepts", { + db_connection <- mockery::mock() + attr(db_connection, "dbms") <- "postgresql" + data_concepts_path <- tempdir() + vocab_schema <- "vocab_schema" + + # Mock the concept table query result + concept_table <- tibble::tibble( + CONCEPT_ID = c("1", "2"), + CONCEPT_NAME = c("Standard", "Non-standard"), + STANDARD_CONCEPT = c("Standard", "Non-standard"), + ) + + mockery::stub(isStandard, "DatabaseConnector::querySql", concept_table) + + # Mock source data + mockdatapath <- tempfile(pattern = "mockdata", fileext = ".csv", tmpdir = data_concepts_path) + mockdata <- tibble::tribble( + ~sourceCode, ~concept_id, + "A", "1", + "B", "2" + ) + filepath <- sub(".*(mockdata.*)", "\\1", mockdatapath) + + # Create a mock CSV file with non-standard concepts + write.csv(data.frame(mockdata), mockdatapath, row.names = FALSE) + + res <- isStandard(db_connection, data_concepts_path, vocab_schema) + + expect_equal(nrow(res), 1) + expect_equal(res$concept_id, "2") + expect_equal(res$concept_name, "Non-standard") + expect_equal(res$source_code, "B") + expect_contains(res$source_table, filepath) + expect_equal(res$standard_concept, "Non-standard") + + unlink(data_concepts_path, recursive = TRUE, force = TRUE) +}) + +test_that("isStandard works correctly with all kinds of concepts", { + db_connection <- mockery::mock() + attr(db_connection, "dbms") <- "postgresql" + data_concepts_path <- tempdir() + vocab_schema <- "vocab_schema" + + # Mock the concept table query result + concept_table <- tibble::tibble( + CONCEPT_ID = c("1", "2", "3"), + CONCEPT_NAME = c("Standard", "Non-Standard", "Classification"), + STANDARD_CONCEPT = c("Standard", "Non-standard", "Classification"), + ) + + mockery::stub(isStandard, "DatabaseConnector::querySql", concept_table) + + # Mock source data + mockdatapath <- tempfile(pattern = "mockdata", fileext = ".csv", tmpdir = data_concepts_path) + mockdata <- tibble::tribble( + ~sourceCode, ~concept_id, + "A", "1", + "B", "2", + "C", "3" + ) + + filepath <- sub(".*(mockdata.*)", "\\1", mockdatapath) + + # Create a mock CSV file with all kinds of concepts + write.csv(data.frame(mockdata), mockdatapath, row.names = FALSE) + + res <- isStandard(db_connection, data_concepts_path, vocab_schema) + + expect_equal(nrow(res), 2) + expect_equal(res$concept_id, c("2", "3")) + expect_equal(res$concept_name, c("Non-Standard", "Classification")) + expect_equal(res$source_code, c("B", "C")) + expect_contains(res$source_table, filepath) + expect_equal(res$standard_concept, c("Non-standard", "Classification")) + + unlink(data_concepts_path, recursive = TRUE, force = TRUE) +}) diff --git a/tests/testthat/test-isStandardCS.R b/tests/testthat/test-isStandardCS.R new file mode 100644 index 00000000..22b4dd9d --- /dev/null +++ b/tests/testthat/test-isStandardCS.R @@ -0,0 +1,32 @@ +source("R/isStandardCS.R") + +test_that("isStandardCS works correctly with standard concepts only", { + # Load test data + dat <- Capr::readConceptSet("tests/testthat/resources/ihd_cad_S.json") + + res <- isStandardCS(dat) + + expect_equal(nrow(res), 0) +}) + +test_that("isStandardCS works correctly with non-standard concepts only", { + # Load test data + dat <- Capr::readConceptSet("tests/testthat/resources/ihd_cad_NS.json") + + res <- isStandardCS(dat) + + expect_equal(nrow(res), 3) + expect_contains(res$standard_concept, "Non-standard") + expect_contains(res$standard_concept, "C") +}) + +test_that("isStandardCS works correctly with all kinds of concepts", { + # Load test data + dat <- Capr::readConceptSet("tests/testthat/resources/ihd_cad_mix.json") + + res <- isStandardCS(dat) + + expect_equal(nrow(res), 2) + expect_contains(res$standard_concept, "Non-standard") + expect_contains(res$standard_concept, "C") +}) diff --git a/tests/testthat/test-isStandardDB.R b/tests/testthat/test-isStandardDB.R new file mode 100644 index 00000000..b19465a6 --- /dev/null +++ b/tests/testthat/test-isStandardDB.R @@ -0,0 +1,107 @@ +# tests/testthat/test-isStandardDB.R + +library(testthat) +library(mockery) +library(dplyr) +source('R/isStandardDB.R') + +# Mock data +mock_db_connection <- mock() +attr(mock_db_connection, "dbms") <- "postgresql" +mock_querySql <- mock( + data.frame( + CONCEPT_ID = c(1, 2, 3), + CONCEPT_NAME = c("Concept1", "Concept2", "Concept3"), + SOURCE_CODE = c("Code1", "Code2", "Code3"), + STANDARD_CONCEPT = c(NA, "S", NA) + ) +) + +# Mock the DatabaseConnector::querySql function +stub(isStandardDB, "DatabaseConnector::querySql", mock_querySql) + +test_that("isStandardDB identifies non-standard concepts", { + links <- list( + "table1" = c("concept_id_col1", "source_code_col1") + ) + + result <- isStandardDB(mock_db_connection, "cdm_schema", "vocab_schema", links) + + expect_equal(nrow(result), 2) + expect_equal(result$concept_id, c("1", "3")) + expect_equal(result$concept_name, c("Concept1", "Concept3")) + expect_equal(result$source_code, c("Code1", "Code3")) + expect_equal(result$source_table, c("table1", "table1")) +}) + +test_that("isStandardDB returns empty tibble when no non-standard concepts", { + mock_querySql_empty <- mock( + data.frame( + CONCEPT_ID = c(1, 2, 3), + CONCEPT_NAME = c("Concept1", "Concept2", "Concept3"), + SOURCE_CODE = c("Code1", "Code2", "Code3"), + STANDARD_CONCEPT = c("S", "S", "S") + ) + ) + + mockery::stub(isStandardDB, "DatabaseConnector::querySql", mock_querySql_empty) + + links <- list( + "table1" = c("concept_id_col1", "source_code_col1") + ) + + result <- isStandardDB(mock_db_connection, "cdm_schema", "vocab_schema", links) + + expect_equal(nrow(result), 0) +}) + +test_that("isStandardDB saves results when save_path is provided", { + temp_dir <- tempdir() + + links <- list( + "table1" = c("concept_id_col1", "source_code_col1") + ) + + mock_querySql <- mock( + data.frame( + CONCEPT_ID = c(1, 2, 3), + CONCEPT_NAME = c("Concept1", "Concept2", "Concept3"), + SOURCE_CODE = c("Code1", "Code2", "Code3"), + STANDARD_CONCEPT = c(NA, "S", "C") + ) + ) + + stub(isStandardDB, "DatabaseConnector::querySql", mock_querySql) + + result <- isStandardDB(mock_db_connection, "cdm_schema", "vocab_schema", links, save_path = temp_dir) + + expect_true(file.exists(file.path(temp_dir, "table1"))) + saved_data <- readr::read_csv(file.path(temp_dir, "table1")) + expect_equal(nrow(saved_data), 3) + expect_equal(nrow(result), 1) +}) + +test_that("isStandardDB handles multiple tables", { + links <- list( + "table1" = c("concept_id_col1", "source_code_col1"), + "table2" = c("concept_id_col2", "source_code_col2") + ) + + mock_querySql <- mock( + data.frame( + CONCEPT_ID = c(1, 2, 3), + CONCEPT_NAME = c("Concept1", "Concept2", "Concept3"), + SOURCE_CODE = c("Code1", "Code2", "Code3"), + STANDARD_CONCEPT = c(NA, "S", NA) + ), + cycle = TRUE + ) + + stub(isStandardDB, "DatabaseConnector::querySql", mock_querySql) + + result <- isStandardDB(mock_db_connection, "cdm_schema", "vocab_schema", links) + + expect_equal(nrow(result), 4) + expect_equal(result$concept_id, c("1", "3", "1", "3")) + expect_equal(result$source_table, c("table1", "table1", "table2", "table2")) +}) \ No newline at end of file