anoopshah / rdiagnosislist Goto Github PK
View Code? Open in Web Editor NEWR package for manipulating problem and diagnosis lists
R package for manipulating problem and diagnosis lists
Morning, Anoop.
I was delighted to see that someone has developed an R package for mapping CTV3 to SNOMED. Sincerely, thank you very much.
I’ve tried installing Rdiagnosislist but it appears there is an error in the mapping.R file at line 68. I’ll hazard a guess that the “if” should not follow the “else”.
I'll fork the data an suggest the edit. I could be be wrong so please have a look.
First off, I would just like to say that this package is amazing and so, so helpful.
I was just trying to filter found codes by semantic type, and I noticed that you cannot add a new column to a data frame using 'symanticType' because sometimes a single SNOMED CT code will have multiple descriptions that contain semantic types (for example '29218008', '774496003' etc) which results in an error because you are trying to add a column with more elements than the original data frame has.
I have added a bit of code that will just extract the first semantic type but I've realised that that might not always be what is wanted for the function. What would you suggest? Adding in an additional function, or altering this one, or something else?
Here is the semi-reproducible issue:
library(dplyr)
library(Rdiagnosislist)
# (SNOMED$CONCEPT is created using loadSNOMED with the most recent monolith version released on TRUD)
doesntwork <- SNOMED$CONCEPT[29000:30000, ] %>% mutate(type = semanticType((id)))
# row 29119 causes the error
Just want to start off by saying thank you for the work that has gone into this. I stumbled across your package today thought it looked fantastic. Is there an ability to switch between different editions of SNOMED-CT? In my case I would be looking to search through the US edition but can see others also wanting to use this tool to search through various editions. Thank you again for the work on what is a great tool for those who have to work with SNOMED.
Hello,
I have found an issue with the 'descendants' command which is quite unusual - hopefully the example I've provided is just a niche case! To get around the general set-up required for this package, I'm just going to copy and paste in what my screen shows me here.
# I was looking at products containing salbutamol. First, I look at the concept.
SNOMEDconcept("91143003")
# [1] "91143003 | Product containing salbutamol (medicinal product)"
# So far so good.
# Then, I look at the descendants:
descendants("91143003")
# [1] "135639005 | Product containing salbutamol in oral dose form (medicinal product form)"
# [2] "135640007 | Product containing salbutamol in parenteral dose form (medicinal product form)"
# [3] "320106000 | Product containing precisely salbutamol (as salbutamol sulfate) 2 milligram/1 each convent..."
# ...
# [222] "39709811000001108 | Salbutamol 5mg/ml nebuliser liquid (product)"
# [223] "39710011000001108 | Salbutamol 2.5mg/2.5ml nebuliser liquid unit dose vials (product)"
# [224] "39710511000001100 | Salbutamol 200microgram inhalation powder capsules (product)"
# [225] "41170711000001100 | Salbutamol 400microgram inhalation powder capsules (product)"
# [226] "41172211000001108 | Salbutamol 5mg/2.5ml nebuliser liquid unit dose vials (product)"
# [227] "41346811000001102 | Salbutamol 2.5mg/2.5ml / Ipratropium bromide 500micrograms/2.5ml nebuliser liquid ..."
# [228] "42019411000001100 | Salbutamol 2.5mg/2.5ml nebuliser liquid unit dose vials (Cipla EU Ltd) (product)"
# [229] "135639005 | Salbutamol 5mg/2.5ml nebuliser liquid unit dose vials (Cipla EU Ltd) (product)"
# [230] "135640007 | Brodilaten 2.5mg/2.5ml nebuliser solution unit dose ampoules (Kent Pharma (UK) Ltd) (product)"
# [231] "320106000 | Brodilaten 5mg/2.5ml nebuliser solution unit dose ampoules (Kent Pharma (UK) Ltd) (product)"
# you can see that at the end, the general sorting of concept ID by number of digits seems to be disrupted.
# on closer inspection, you can see that the last three descendants are actually repeated codes of the first three.
# Strangely, this does not correspond to the descriptions of these codes.
# Checking what is going on, with the code from line 228 the code actually corresponds to the description in line 231.
SNOMEDconcept("42019411000001100")
# [1] "42019411000001100 | Brodilaten 5mg/2.5ml nebuliser solution unit dose ampoules (Kent Pharma (UK) Ltd) ..."
So, it appears that somehow the concept codes and the concept descriptions have gone out of sync - quite strange!
As you know this package in and out, if you have a hunch of why this his happening and could look into this I would appreciate it! Alternatively I can have a go myself.
Anyway, thanks for any help!
Alex
e.g. when loading from the snapshot files of the International and UK editions, the UK snapshot STATEDRELATIONSHIP table is empty, and this means that the entire STATEDRELATIONSHIP table is empty:
A <- loadSNOMED(c('SnomedCT_InternationalRF2_PRODUCTION_20180731T120000Z/Snapshot/Terminology',
'SnomedCT_UKClinicalRF2_PRODUCTION_20191001T000001Z/Snapshot/Terminology'))
Attempting to load sct2_Concept_Snapshot_INT_20180731.txt
Loaded 454709 rows.
Converted effectiveTime to IDate.
Limiting to active rows (340659/454709).
Naming as CONCEPT
Attempting to load sct2_Description_Snapshot-en_INT_20180731.txt
Loaded 1407643 rows.
Converted effectiveTime to IDate.
Limiting to active rows (1176953/1407643).
Naming as DESCRIPTION
Attempting to load sct2_StatedRelationship_Snapshot_INT_20180731.txt
Loaded 944975 rows.
Converted effectiveTime to IDate.
Converting typeId to integer64.
Limiting to active rows (770835/944975).
Naming as STATEDRELATIONSHIP
Attempting to load sct2_Relationship_Snapshot_INT_20180731.txt
Loaded 2755736 rows.
Converted effectiveTime to IDate.
Converting typeId to integer64.
Limiting to active rows (1095369/2755736).
Naming as RELATIONSHIP
Attempting to load sct2_Concept_Snapshot_GB1000000_20191001.txt
Loaded 95656 rows.
Converted effectiveTime to IDate.
Limiting to active rows (29083/95656).
Appending to CONCEPT
Attempting to load sct2_Description_Snapshot-en_GB1000000_20191001.txt
Loaded 225023 rows.
Converted effectiveTime to IDate.
Limiting to active rows (208843/225023).
Appending to DESCRIPTION
Attempting to load sct2_StatedRelationship_Snapshot_GB1000000_20191001.txt
Loaded 0 rows.
Failed to convert effectiveTime to IDate.
Limiting to active rows (0/0).
Appending to STATEDRELATIONSHIP
Error in rbindlist(l, use.names, fill, idcol) :
Class attribute on column 2 of item 2 does not match with column 2 of item 1.
Attempting to load sct2_Relationship_Snapshot_GB1000000_20191001.txt
Loaded 201124 rows.
Converted effectiveTime to IDate.
Limiting to active rows (66250/201124).
Appending to RELATIONSHIP
SNOMED CT tables loaded into environment:
NAME NROW NCOL MB
1: CONCEPT 369,742 5 13
2: DESCRIPTION 1,385,796 9 206
3: RELATIONSHIP 1,161,619 10 93
4: STATEDRELATIONSHIP 0 11 0
COLS KEY
1: id,effectiveTime,active,moduleId,definitionStatusId
2: id,effectiveTime,active,moduleId,conceptId,languageCode,...
3: id,effectiveTime,active,moduleId,sourceId,destinationId,...
4: id,effectiveTime,active,moduleId,sourceId,destinationId,...
Total: 312MB
Also need to improve the documentation of the loadSNOMED function so that it guides readers which SNOMED sub-folders to use.
Hi Anoop,
Many thanks for all your work on this.
loadSNOMED()
is not finding the up-to-date UK file for us, I presume because of a change in the naming convention.
Happy to PR and adjust - but you are likely to be able to sort it quicker?
Many thanks again.
Ewen
Edinburgh
SnomedCT_UKClinicalRF2_PRODUCTION_20220511T000001Z/Snapshot/Terminology/sct2_Concept_UKCLSnapshot_GB1000000_20220511.txt
No longer _Concept_Snapshot
.
Hi,
Thank you for releasing this package. I am just starting to explore it's application but it looks very useful.
I ran into some challenges getting my local copy of SNOMED setup. I realise now that it is necessary to download both the International and UK releases from TRUD. I wonder whether you might consider explicitly stating in the vignette (line39), that there are two datasets that need to be imported. It wasn't immediately obvious as the UK edition includes a folder with the international heading. I finally worked it out when I compared the folder names in your loadSNOMED example.
Incidentally when loaded with only the UK release the as.SNOMED.concept function works as demonstrated in the Vignette. However the parent, children and ancestors functions fail (error shown below). I presume this is because there is no secondary dataset to merge with.
Error in bmerge(i, x, leftcols, rightcols, roll, rollends, nomatch, mult, :
Incompatible join types: x.destinationId (logical) and i.destinationId (integer64)
Thanks again.
I can make a suggestion and submit a pull request if that would be useful?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.