Intro

Various uses will be shown by chapter

source('codeToRun.R')
## Reading prepared vocab data (may take 2-8 minutes)
## Vocab data all loaded.
## Time difference of 1.281623 mins
library(DT);library(knitr)

Simple calls of overview functions

Of classes

get_version()
##   vocabulary_id                vocabulary_name vocabulary_reference
## 1          None OMOP Standardized Vocabularies       OMOP generated
##   vocabulary_version vocabulary_concept_id
## 1     v5.0 09-JUL-19              44819096
kable(overview_class())
concept$concept_class_id n
11-digit NDC 675336
Marketed Product 504088
Branded Drug Box 221041
Branded Drug 215615
9-digit NDC 207316
Branded Drug Comp 205553
Pharma/Biol Product 197517
Physical Object 191981
OTC Drug 189513
Clinical Finding 186818
Branded Drug Form 166305
Brand Name 165018
AMPP 149098
Prescription Drug 145877
Clinical Drug 137094
AMP 133581
Clinical Drug Comp 121833
ICD10PCS Hierarchy 112450
Clinical Drug Box 109796
Read 108681
Procedure 108026
Quant Branded Drug 104209
8th level 102089
LOINC Hierarchy 97863
Quant Branded Box 97511
Drug Product 93349
Quant Clinical Drug 84985
ICD10PCS 79974
LLT 77564
Quant Clinical Box 77183
Clinical Drug Form 67096
Organism 67046
7-char billing code 64661
10th level 62708
ICDO Condition 58512
Lab Test 55560
VA Product 54768
Ingredient 38839
Body Structure 38387
Diagnosis 37512
Substance 33068
VMPP 30982
NAACCR Value 30708
GCN_SEQNO 29659
Clinical Observation 24151
PT 23722
VMP 22547
Branded Dose Group 22204
Containered Pack 21456
9th level 20631
Answer 20285
Trade Product Pack 20227
Med Product Pack 18942
Qualifier Value 17458
Clinical Dose Group 16922
Observable Entity 15531
SPL 14715
ICD10 code 14271
Context-dependent 13569
Supplier 13470
Trade Product Unit 13054
Device 12450
CPT4 12029
Drug Interaction 10843
Chemical Structure 10560
Survey 10446
6-char billing code 10022
Multum 9770
6-char nonbill code 9362
Social Context 8576
6th level 8572
HCPCS 8545
Drug 8406
5-dig billing code 8212
OXMIS 8118
Pharma Preparation 7709
4-dig billing code 7524
Main Heading 7200
5-char nonbill code 7007
5-char billing code 6699
7th level 6574
LOINC Group 6542
Morph Abnormality 6211
4-char billing code 5510
Med Product Unit 5291
ATC 5th 5009
Ind / CI 4938
Suppl Concept 4779
4-char nonbill code 4499
Trade Product 4363
Event 4236
VTM 3508
CPT4 Hierarchy 3465
Medicinal Product 3283
Animal Drug 3045
Precise Ingredient 2871
Dose Form 2587
Disinfectant 2546
Staging / Scales 2497
Branded Pack 2469
Clinical Pack 2360
Specimen 2087
AU Substance 2065
Location 2058
ICD10 Hierarchy 2050
APC 1910
Physiologic Effect 1866
NAACCR Variable 1861
HLT 1801
4-dig nonbill code 1730
3-char nonbill code 1687
Question 1675
11th level 1632
Regimen 1546
3-dig nonbill code 1505
Record Artifact 1373
ICDO Histology 1368
ATC 4th 1299
Claims Attachment 1269
4-dig billing E code 1247
Finding 1229
Attribute 1141
ICD9CM V code 1108
Clinical Pack Box 1091
Undefined 1082
Misc 1007
Test 965
Unit 945
Field 869
Model Comp 832
MS-DRG 758
CDT 706
NFC 692
NAACCR Procedure 679
Plasma Derivative 676
Mechanism of Action 638
5-dig billing V code 634
Pharmacologic Class 626
DRG 604
ATC 3rd 585
Branded Pack Box 571
Visit 570
5th level 567
Component 555
Physician Specialty 553
Relationship 548
Revenue Code 538
VA Class 486
Vaccine 479
Permissible Range 475
4-dig billing V code 474
Provider 462
Supplement 432
Admin Concept 402
ICDO Topography 400
CPT4 Modifier 393
Condition 388
Concept Class 370
HCPCS Modifier 363
4th level 354
HLGT 349
Disposition 346
Component Class 333
SMQ 324
3-dig billing code 313
LOINC Class 301
Form 278
Anatomy 271
3-char billing code 259
Namespace Concept 230
Physical Force 204
CVX 195
NAACCR Schema 195
Non-Stand Allergenic 194
ATC 2nd 183
Currency 180
3-dig nonbill E code 171
12th level 165
Payer 162
4-dig nonbill V code 159
Doc Subject Matter 151
AU Qualifier 146
Doc Type of Service 141
ConvSet 138
Radiology 130
Navi Concept 127
LOINC Document Type 121
Vocabulary 111
Cosmetic 108
CDT Hierarchy 107
HCPCS Class 106
Condition Type 104
2-dig nonbill code 100
Procedure Type 97
Standard Allergenic 97
Topic 94
3-dig nonbill V code 89
Drug form 88
Cohort 78
Life circumstance 73
Doc Kind 68
LabSet 66
Domain 62
Race 60
Pharmacokinetics 59
UB04 Pt dis status 55
Table 53
Observation 52
Units of Measure 49
Place of Service 48
Symptom/Finding 48
Dose Form Group 45
3-dig billing E code 44
Death Type 42
Canonical Unit 35
Cellular Therapy 34
Frequency 34
Misc Order 34
Context 33
Special Concept 31
ATC 1st 30
NAACCR Proc Schema 30
Therapeutic Class 30
Doc Role 29
Symptom 29
3rd level 28
SOC 27
Summary 27
MDC 26
Detail 24
UB04 Point of Origin 22
Measurement 21
2nd level 19
Doc Setting 18
Regimen type 18
Visit Type 18
MedSet 17
Drug Type 16
Food 16
Observation Type 15
Discharge Status 14
Drug Class 14
Plan Stop Reason 13
Route 13
Admitting Source 12
ICD9CM code 12
Medical supply 12
Meas Type 11
Procedure Code Type 11
CDM 10
Module 10
Note Type 10
Linkage Assertion 9
US Census Division 9
Cost Type 8
Gender 8
Inactive Concept 8
State 7
Benefit 6
Obs Period Type 6
PPI Modifier 6
Sponsor 6
UB04 Pri Typ of Adm 6
Encounter Type 5
Episode Type 5
Metal level 5
Aggregate Meas 4
Device Type 4
Diagnosis Code Type 4
Enrollment Basis 4
Program 4
US Census Region 4
Blood Pressure Pos 3
Diagnosis Type 3
Disease Episode 3
Workflow 3
Biobank Flag 2
Biological Function 2
Chart Availability 2
Discharge Dispo 2
DRG Type 2
Ethnicity 2
Hispanic 2
Treatment Episode 2
Vital Source 2
3-dig billing V code 1
Episode of Care 1
Imaging Material 1
Patient Status 1
Specimen Type 1
#dummy

overview_vocab

Overview of vocabularies

kable(overview_vocab())
vocabulary_id n
RxNorm Extension 1884578
NDC 891522
SNOMED 861732
dm+d 358268
SPL 354488
RxNorm 286743
LOINC 213301
OSM 203339
DPD 193647
ICD10PCS 192424
ICD10CM 109706
Read 108681
MedDRA 103463
AMT 76706
ICDO3 60280
VA Product 54768
CIEL 50881
BDPM 40399
NDFRT 37486
JMDC 35962
NAACCR 33948
SNOMED Veterinary 33684
GCN_SEQNO 29659
GGR 24917
ICD9CM 18672
ICD10 16321
CPT4 15935
MeSH 12965
OPCS4 11000
Multum 9770
HCPCS 9014
OXMIS 8118
ATC 6211
PPI 4693
HemOnc 4678
ICD9Proc 4657
APC 1910
DRG 1362
UCUM 980
CDM 932
EphMRA ATC 895
NUCC 855
CDT 813
NFC 692
Relationship 548
Revenue Code 538
VA Class 486
Concept Class 370
SMQ 324
UB04 Typ bill 298
CVX 195
Currency 180
HES Specialty 165
PHDSC 162
Medicare Specialty 120
Condition Type 118
Vocabulary 111
ABMS 98
Procedure Type 97
PCORNet 81
Cohort 78
Domain 62
CMS Place of Service 60
UB04 Pt dis status 55
Race 53
Cost 51
Observation Type 29
MDC 26
UB04 Point of Origin 22
Visit Type 18
Drug Type 16
Death Type 14
Plan Stop Reason 13
US Census 13
Visit 12
Meas Type 11
Plan 11
Note Type 10
Cost Type 8
Episode 6
Obs Period Type 6
Sponsor 6
UB04 Pri Typ of Adm 6
Episode Type 5
Gender 5
Device Type 4
MMI 4
Provider 4
Ethnicity 2
None 1
Specimen Type 1
Supplier 1

included vocabularies

kable(vocabulary)
vocabulary_id vocabulary_name vocabulary_reference vocabulary_version vocabulary_concept_id
Cost Type OMOP Cost Type OMOP generated 5029
PCORNet National Patient-Centered Clinical Research Network (PCORI) OMOP generated 44819148
dm+d Dictionary of Medicines and Devices (NHS) https://isd.hscic.gov.uk/trud3/user/authenticated/group/0/pack/1/subpack/24/releases dm+d Version 1.4.0 20190128 232
Device Type OMOP Device Type OMOP generated 44819151
Plan Health Plan - contract to administer healthcare transactions by the payer, facilitated by the sponsor OMOP generated 32471
Medicare Specialty Medicare provider/supplier specialty codes (CMS) http://www.cms.gov/Medicare/Provider-Enrollment-and-Certification/MedicareProviderSupEnroll/Taxonomy.html 2018-06-26 Specialty 44819138
PHDSC Source of Payment Typology (PHDSC) http://www.phdsc.org/standards/payer-typology-source.asp Version 3.0 32473
Provider OMOP Provider OMOP generated 32573
VA Product VA National Drug File Product (VA) http://www.nlm.nih.gov/research/umls/rxnorm/docs/rxnormfiles.html RXNORM 2018-08-12 44819120
NAACCR NAACCR Data Dictionary http://datadictionary.naaccr.org/?c=10 NAACCR v18 32642
NDFRT National Drug File - Reference Terminology (VA) http://www.nlm.nih.gov/research/umls/rxnorm/docs/rxnormfiles.html RXNORM 2018-08-12 44819103
MEDRT Medication Reference Terminology MED-RT (VA) https://nciterms.nci.nih.gov/ncitbrowser/pages/vocabulary.jsf?dictionary=MED-RT MED-RT 2018-09-04 32537
Cohort Type OMOP Cohort Type OMOP generated 44819234
ICDO3 International Classification of Diseases for Oncology, Third Edition (WHO) https://seer.cancer.gov/icd-o-3/ ICDO3 SEER Site/Histology Released 09/18/2015 581426
UB04 Pri Typ of Adm UB04 Claim Inpatient Admission Type Code (CMS) https://www.resdac.org/cms-data/variables/Claim-Inpatient-Admission-Type-Code 32046
Read NHS UK Read Codes Version 2 (HSCIC) http://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html NHS READV2 21.0.0 20160401000001 + DATAMIGRATION_25.0.0_20180403000001 44819113
Revenue Code UB04/CMS1450 Revenue Codes (CMS) http://www.mpca.net/?page=ERC_finance 2010 Release 44819133
Death Type OMOP Death Type OMOP generated 44819135
DRG Diagnosis-related group (CMS) http://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/AcuteInpatientPPS/Acute-Inpatient-Files-for-Download.html 2011-18-02 44819130
MedDRA Medical Dictionary for Regulatory Activities (MSSO) http://www.meddramsso.com/subscriber_download.asp MedDRA Version 22.0 44819111
ICD10PCS ICD-10 Procedure Coding System (CMS) http://www.cms.gov/Medicare/Coding/ICD10/index.html ICD10PCS 2019 44819125
Domain OMOP Domain OMOP generated 44819147
OPCS4 OPCS Classification of Interventions and Procedures version 4 (NHS) http://systems.hscic.gov.uk/data/clinicalcoding/codingstandards/opcs4 2018 Release 44819143
Visit Type OMOP Visit Type OMOP generated 44819150
HemOnc HemOnc https://hemonc.org HemOnc 2019-05-30 32613
AMT Australian Medicines Terminology (NEHTA) https://www.nehta.gov.au/implementation-resources/terminology-access AMT 01-SEP-17 238
Concept Class OMOP Concept Class OMOP generated 44819233
Ethnicity OMOP Ethnicity OMOP generated 44819134
EphMRA ATC Anatomical Classification of Pharmaceutical Products (EphMRA) http://www.ephmra.org/Anatomical-Classification EphMRA ATC 2016 243
UCUM Unified Code for Units of Measure (Regenstrief Institute) http://aurora.regenstrief.org/~ucum/ucum.html#section-Alphabetic-Index Version 1.8.2 44819107
NFC New Form Code (EphMRA) http://www.ephmra.org/New-Form-Codes-Classification NFC 20160704 245
ABMS Provider Specialty (American Board of Medical Specialties) http://www.abms.org/member-boards/specialty-subspecialty-certificates 2018-06-26 ABMS 45756746
Drug Type OMOP Drug Exposure Type OMOP generated 44819126
MMI Modernizing Medicine (MMI) MMI proprietary 581367
CVX CDC Vaccine Administered CVX (NCIRD) https://www2a.cdc.gov/vaccines/iis/iisstandards/vaccines.asp?rpt=cvx CVX Code Set 20180831 581400
Supplier OMOP Supplier OMOP generated 32574
Plan Stop Reason Plan Stop Reason - Reason for termination of the Health Plan OMOP generated 32474
Cohort Legacy OMOP HOI or DOI cohort OMOP generated 44819123
Multum Cerner Multum (Cerner) http://www.nlm.nih.gov/research/umls/rxnorm/docs/rxnormfiles.html 2013-07-10 44819112
Race Race and Ethnicity Code Set (USBC) http://www.cdc.gov/nchs/data/dvs/Race_Ethnicity_CodeSet.pdf Version 1.0 44819109
CPT4 Current Procedural Terminology version 4 (AMA) http://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html 2019 Release 44819100
APC Ambulatory Payment Classification (CMS) http://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/HospitalOutpatientPPS/Hospital-Outpatient-Regulations-and-Notices.html 2018-January-Addendum-A 44819132
Specimen Type OMOP Specimen Type OMOP generated 581376
Note Type OMOP Note Type OMOP generated 44819146
GGR Commented Drug Directory (BCFI) http://www.bcfi.be/nl/download GGR 20190401 581450
Episode OMOP Episode OMOP generated 32523
Visit OMOP Visit OMOP generated 44819119
ICD10CM International Classification of Diseases, Tenth Revision, Clinical Modification (NCHS) http://www.cdc.gov/nchs/icd/icd10cm.htm ICD10CM FY2019 code descriptions 44819098
Condition Type OMOP Condition Occurrence Type OMOP generated 44819127
Procedure Type OMOP Procedure Occurrence Type OMOP generated 44819128
JMDC Japan Medical Data Center Drug Code (JMDC) OMOP generated JMDC 2019-03-11 32557
Episode Type OMOP Episode Type OMOP generated 32542
Meas Type OMOP Measurement Type OMOP generated 44819152
MDC Major Diagnostic Categories (CMS) http://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/AcuteInpatientPPS/Acute-Inpatient-Files-for-Download.html 2013-01-06 44819131
ATC WHO Anatomic Therapeutic Chemical Classification FDB UK distribution package RXNORM 2018-08-12 44819117
Cost OMOP Cost OMOP generated 581457
Currency International Currency Symbol (ISO 4217) http://www.iso.org/iso/home/standards/currency_codes.htm 2008 44819153
SNOMED Systematic Nomenclature of Medicine - Clinical Terms (IHTSDO) http://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html Snomed Release 20190131 44819097
VA Class VA National Drug File Class (VA) http://www.nlm.nih.gov/research/umls/rxnorm/docs/rxnormfiles.html RXNORM 2018-08-12 44819122
None OMOP Standardized Vocabularies OMOP generated v5.0 09-JUL-19 44819096
CDM OMOP Common DataModel https://github.com/OHDSI/CommonDataModel CDM v6.0.0 32485
HCPCS Healthcare Common Procedure Coding System (CMS) http://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html 20180101 Alpha Numeric HCPCS File 44819101
MeSH Medical Subject Headings (NLM) http://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html 2019 Release 44819136
ICD10 International Classification of Diseases, Tenth Revision (WHO) http://www.who.int/classifications/icd/icdonlineversions/en/ 2016 Release 44819124
UB04 Typ bill UB04 Type of Bill - Institutional (USHIK) https://ushik.ahrq.gov/ViewItemDetails?&system=apcd&itemKey=196987000 32044
BDPM Public Database of Medications (Social-Sante) http://base-donnees-publique.medicaments.gouv.fr/telechargement.php BDPM 17-JUL-17 236
Vocabulary OMOP Vocabulary OMOP generated 44819232
Relationship OMOP Relationship OMOP generated 44819235
RxNorm RxNorm (NLM) http://www.nlm.nih.gov/research/umls/rxnorm/docs/rxnormfiles.html RxNorm 20190603 44819104
RxNorm Extension RxNorm Extension (OMOP) OMOP generated RxNorm Extension 2019-06-10 252
Obs Period Type OMOP Observation Period Type OMOP generated 44819149
SMQ Standardised MedDRA Queries (MSSO) http://www.meddramsso.com/secure/smq/SMQ_Spreadsheet_14_0_English_update.xlsx Version 14.0 44819121
OXMIS Oxford Medical Information System (OCHP) Codes extracted from GPRD database, courtesy of GSK 44819114
OSM OpenStreetMap https://www.openstreetmap.org/copyright/en, https://wambachers-osm.website/boundaries/ OSM Release 2019-02-21 32541
US Census United States Census Bureau https://www.census.gov/geo/maps-data/data/tiger-cart-boundary.html US Census 2017 Release 32570
ICD9CM International Classification of Diseases, Ninth Revision, Clinical Modification, Volume 1 and 2 (NCHS) http://www.cms.gov/Medicare/Coding/ICD9ProviderDiagnosticCodes/codes.html ICD9CM v32 master descriptions 5046
CDT Current Dental Terminology (ADA) http://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html 2019 Release 581438
PPI AllOfUs_PPI (Columbia) http://terminology.pmi-ops.org/CodeSystem/ppi Codebook Version 0.3.34 581404
ICD9Proc International Classification of Diseases, Ninth Revision, Clinical Modification, Volume 3 (NCHS) http://www.cms.gov/Medicare/Coding/ICD9ProviderDiagnosticCodes/codes.html ICD9CM v32 master descriptions 44819099
Sponsor Sponsor - institution or individual financing healthcare transactions OMOP generated 32472
NUCC National Uniform Claim Committee Health Care Provider Taxonomy Code Set (NUCC) http://www.nucc.org/index.php?option=com_content&view=article&id=107&Itemid=132 2018-06-26 NUCC 44819137
UB04 Point of Origin UB04 Claim Source Inpatient Admission Code (CMS) https://www.resdac.org/cms-data/variables/Claim-Source-Inpatient-Admission-Code 32045
UB04 Pt dis status UB04 Patient Discharge Status Code (CMS) https://www.resdac.org/cms-data/variables/patient-discharge-status-code 32047
CMS Place of Service Place of Service Codes for Professional Claims (CMS) http://www.cms.gov/Medicare/Medicare-Fee-for-Service-Payment/PhysicianFeeSched/downloads//Website_POS_database.pdf 2009-01-11 44819110
DPD Drug Product Database (Health Canada) http://open.canada.ca/data/en/dataset/bf55e42a-63cb-4556-bfd8-44f26e5a36fe DPD 25-JUN-17 231
Observation Type OMOP Observation Type OMOP generated 44819129
CIEL Columbia International eHealth Laboratory (Columbia University) https://wiki.openmrs.org/display/docs/Getting+and+Using+the+MVP-CIEL+Concept+Dictionary Openmrs 1.11.0 20150227 45905710
Gender OMOP Gender OMOP generated 44819108
SNOMED Veterinary SNOMED Veterinary https://vtsl.vetmed.vt.edu/extension/ SNOMED Veterinary 20190401 32549
HES Specialty Hospital Episode Statistics Specialty (NHS) http://www.datadictionary.nhs.uk/data_dictionary/attributes/m/main_specialty_code_de.asp?shownav=0 2018-06-26 HES Specialty 44819145
GCN_SEQNO Clinical Formulation ID (FDB) FDB US distribution package 20151119 Release 44819141
NDC National Drug Code (FDA and manufacturers) http://www.nlm.nih.gov/research/umls/rxnorm/docs/rxnormfiles.html, http://www.fda.gov/downloads/Drugs/DevelopmentApprovalProcess/UCM070838.zip NDC 20190707 44819105
SPL Structured Product Labeling (FDA) http://www.fda.gov/Drugs/InformationOnDrugs/ucm142438.htm NDC 20190707 44819140
LOINC Logical Observation Identifiers Names and Codes (Regenstrief Institute) http://loinc.org/downloads/loinc 2.66 44819102

other

#deprecated with no successor in LOINC and RxNorm
search_by_invalid_reason(invalid_reason_value = 'D',vocabulary = c('LOINC','RxNorm')) %>% head()
##   concept_id                        concept_name vocabulary_id
## 1    3023253 Deprecated Skilled nursing treatmen         LOINC
## 2    3003626 Deprecated Alcohol-substance abuse          LOINC
## 3    3010062 Deprecated Respiratory therapy trea         LOINC
## 4    3038461 Deprecated Psychiatric rehabilitati         LOINC
## 5    3038465 Deprecated Physical therapy treatme         LOINC
## 6    3037178 Deprecated Cardiac rehabilitation t         LOINC
cid=1710316
search_concept_id(cid)
##   concept_id                        concept_name vocabulary_id
## 1    1710316 emtricitabine 200 MG / Tenofovir di        RxNorm
search_relationships(cid,vocabulary = 'RxNorm',full_output = TRUE)  %>% datatable(rownames = FALSE)
#dummy

Maps to relationships use

#
#translate-dx.csv
tset<-c('ICD10CM','ICD9CM','ICD10')
#start<-concept %>% filter(vocabulary_id %in% tset)
#only taking certain relationship
mt<-concept_relationship %>% filter(relationship_id=='Maps to')

#more info on the concept 1 (from)
mt %<>% left_join(concept, by=c('concept_id_1'='concept_id'))
names(mt)
##  [1] "concept_id_1"       "concept_id_2"       "relationship_id"   
##  [4] "valid_start_date.x" "valid_end_date.x"   "invalid_reason.x"  
##  [7] "concept_name"       "domain_id"          "vocabulary_id"     
## [10] "concept_class_id"   "standard_concept"   "concept_code"      
## [13] "valid_start_date.y" "valid_end_date.y"   "invalid_reason.y"
#restrict to our starting terminologies
mt2<-mt %>% filter(vocabulary_id %in% tset)

mt2 %<>% left_join(concept, by=c('concept_id_2'='concept_id'))
names(mt2)
##  [1] "concept_id_1"       "concept_id_2"       "relationship_id"   
##  [4] "valid_start_date.x" "valid_end_date.x"   "invalid_reason.x"  
##  [7] "concept_name.x"     "domain_id.x"        "vocabulary_id.x"   
## [10] "concept_class_id.x" "standard_concept.x" "concept_code.x"    
## [13] "valid_start_date.y" "valid_end_date.y"   "invalid_reason.y"  
## [16] "concept_name.y"     "domain_id.y"        "vocabulary_id.y"   
## [19] "concept_class_id.y" "standard_concept.y" "concept_code.y"    
## [22] "valid_start_date"   "valid_end_date"     "invalid_reason"
#all relationships  are valid
mt2 %>% count(invalid_reason.x)
## # A tibble: 1 x 2
##   invalid_reason.x      n
##   <lgl>             <int>
## 1 NA               158237
#export
oname='local/translate_dx'
mt2 %>% write_csv(paste0(oname,'-all.csv'))
mt3<-mt2 %>% select(vocabulary_id=vocabulary_id.x,concept_code=concept_code.x,target_concept_id=concept_id_2) 
mt3 %>% write_csv(paste0(oname,'.csv'))

Is icd10 subsumed in icd10cm?

Small analysis

i10<-concept %>% filter(vocabulary_id=='ICD10' & invalid_reason=='')
i10cm<-concept %>% filter(vocabulary_id=='ICD10CM'  & invalid_reason=='')
#inner_join(i10$concept_code,i10cm$concept_code) 
length(intersect(i10$concept_code,i10cm$concept_code) )
## [1] 12061
nrow(i10)
## [1] 15297
inInotCM<-setdiff(i10$concept_code,i10cm$concept_code)
nrow(i10cm)
## [1] 94444
#that many concepts are in Int and not in US version ( ICD10CM)
length(inInotCM)
## [1] 3236
d<-i10 %>% filter(concept_code %in% inInotCM)
d %>% datatable(rownames = FALSE)
d %>% write_csv('local/inInotCM.csv')