Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Generated pydicom/sr codes now append '__' to Python keyword names #1281

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

seandoyle
Copy link

Describe the changes

generated_concept_dicts.py was modified to add '__' to names which were also keywords in Python. New versions of the dictionary codes in python/sr/* were generated by
python ./source/generate_cids/generate_concept_dicts.py

>>>from pydicom.sr.codedict import codes
>>> codes.cid3716.None__
Code(value='260413007', scheme_designator='SCT', meaning='None', scheme_version=None)

This handles issue 1273.

Tasks

  • Unit Test test_cid3716 added in test_codedict.py
  • Closes 1273
  • Unclear where documentation of original SyntaxError would be most helpful.
  • Unit tests failing for codes which were not changed in this PR - see test_cid3111. Perhaps code libraries have changed?

@pep8speaks
Copy link

pep8speaks commented Dec 10, 2020

Hello @seandoyle! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 70:1: E122 continuation line missing indentation or outdented
Line 546:1: E122 continuation line missing indentation or outdented
Line 1159:1: E122 continuation line missing indentation or outdented
Line 1241:1: E122 continuation line missing indentation or outdented
Line 1382:1: E122 continuation line missing indentation or outdented
Line 1599:1: E122 continuation line missing indentation or outdented
Line 1612:1: E122 continuation line missing indentation or outdented
Line 1891:1: E122 continuation line missing indentation or outdented
Line 2216:1: E122 continuation line missing indentation or outdented
Line 2236:1: E122 continuation line missing indentation or outdented
Line 2241:1: E122 continuation line missing indentation or outdented
Line 2257:1: E122 continuation line missing indentation or outdented
Line 2267:1: E122 continuation line missing indentation or outdented
Line 2288:1: E122 continuation line missing indentation or outdented
Line 2462:1: E122 continuation line missing indentation or outdented
Line 2664:1: E122 continuation line missing indentation or outdented
Line 2766:1: E122 continuation line missing indentation or outdented
Line 3066:1: E122 continuation line missing indentation or outdented
Line 3141:1: E122 continuation line missing indentation or outdented
Line 3241:1: E122 continuation line missing indentation or outdented
Line 3449:1: E122 continuation line missing indentation or outdented
Line 3529:1: E122 continuation line missing indentation or outdented
Line 3551:1: E122 continuation line missing indentation or outdented
Line 3817:1: E122 continuation line missing indentation or outdented
Line 4098:1: E122 continuation line missing indentation or outdented
Line 4293:1: E122 continuation line missing indentation or outdented
Line 4478:1: E122 continuation line missing indentation or outdented
Line 4866:1: E122 continuation line missing indentation or outdented
Line 5019:1: E122 continuation line missing indentation or outdented
Line 5679:1: E122 continuation line missing indentation or outdented
Line 5698:1: E122 continuation line missing indentation or outdented
Line 5838:1: E122 continuation line missing indentation or outdented
Line 5868:1: E122 continuation line missing indentation or outdented
Line 6286:1: E122 continuation line missing indentation or outdented
Line 6455:1: E122 continuation line missing indentation or outdented
Line 6835:1: E122 continuation line missing indentation or outdented
Line 7078:1: E122 continuation line missing indentation or outdented
Line 7287:1: E122 continuation line missing indentation or outdented
Line 7354:1: E122 continuation line missing indentation or outdented
Line 7810:1: E122 continuation line missing indentation or outdented
Line 7842:1: E122 continuation line missing indentation or outdented
Line 7925:1: E122 continuation line missing indentation or outdented
Line 8576:1: E122 continuation line missing indentation or outdented
Line 8917:1: E122 continuation line missing indentation or outdented
Line 8959:1: E122 continuation line missing indentation or outdented
Line 8999:1: E122 continuation line missing indentation or outdented
Line 9007:1: E122 continuation line missing indentation or outdented
Line 9019:1: E122 continuation line missing indentation or outdented
Line 9251:1: E122 continuation line missing indentation or outdented
Line 9279:1: E122 continuation line missing indentation or outdented
Line 9326:1: E122 continuation line missing indentation or outdented
Line 9366:1: E122 continuation line missing indentation or outdented
Line 9370:1: E122 continuation line missing indentation or outdented
Line 9468:1: E122 continuation line missing indentation or outdented
Line 9492:1: E122 continuation line missing indentation or outdented
Line 9940:1: E122 continuation line missing indentation or outdented
Line 9962:1: E122 continuation line missing indentation or outdented
Line 9996:1: E122 continuation line missing indentation or outdented
Line 10152:1: E122 continuation line missing indentation or outdented
Line 10267:1: E122 continuation line missing indentation or outdented
Line 10283:1: E122 continuation line missing indentation or outdented
Line 10481:1: E122 continuation line missing indentation or outdented
Line 10894:1: E122 continuation line missing indentation or outdented
Line 10915:1: E122 continuation line missing indentation or outdented
Line 11101:1: E122 continuation line missing indentation or outdented
Line 11388:1: E122 continuation line missing indentation or outdented
Line 11834:1: E122 continuation line missing indentation or outdented
Line 11933:1: E122 continuation line missing indentation or outdented
Line 12649:1: E122 continuation line missing indentation or outdented
Line 12989:1: E122 continuation line missing indentation or outdented
Line 13011:1: E122 continuation line missing indentation or outdented
Line 13130:1: E122 continuation line missing indentation or outdented
Line 13155:1: E122 continuation line missing indentation or outdented
Line 13175:1: E122 continuation line missing indentation or outdented
Line 13202:80: E501 line too long (84 > 79 characters)
Line 13204:1: E122 continuation line missing indentation or outdented
Line 13417:1: E122 continuation line missing indentation or outdented
Line 13716:1: E122 continuation line missing indentation or outdented
Line 14031:1: E122 continuation line missing indentation or outdented
Line 14132:1: E122 continuation line missing indentation or outdented
Line 14399:1: E122 continuation line missing indentation or outdented
Line 17216:1: E122 continuation line missing indentation or outdented
Line 17232:1: E122 continuation line missing indentation or outdented
Line 17262:1: E122 continuation line missing indentation or outdented
Line 18122:1: E122 continuation line missing indentation or outdented
Line 18220:1: E122 continuation line missing indentation or outdented
Line 18345:1: E122 continuation line missing indentation or outdented
Line 18452:1: E122 continuation line missing indentation or outdented
Line 18552:1: E122 continuation line missing indentation or outdented
Line 18558:1: E122 continuation line missing indentation or outdented
Line 19188:1: E122 continuation line missing indentation or outdented
Line 19572:1: E122 continuation line missing indentation or outdented
Line 20551:1: E122 continuation line missing indentation or outdented
Line 20641:1: E122 continuation line missing indentation or outdented
Line 20999:1: E122 continuation line missing indentation or outdented
Line 21129:1: E122 continuation line missing indentation or outdented
Line 21251:1: E122 continuation line missing indentation or outdented
Line 21407:1: E122 continuation line missing indentation or outdented
Line 22363:1: E122 continuation line missing indentation or outdented
Line 22459:1: E122 continuation line missing indentation or outdented
Line 22649:1: E122 continuation line missing indentation or outdented
Line 22681:1: E122 continuation line missing indentation or outdented
Line 22697:1: E122 continuation line missing indentation or outdented
Line 22769:1: E122 continuation line missing indentation or outdented
Line 22824:1: E122 continuation line missing indentation or outdented
Line 23226:1: E122 continuation line missing indentation or outdented
Line 23445:1: E122 continuation line missing indentation or outdented
Line 23510:1: E122 continuation line missing indentation or outdented
Line 24010:1: E122 continuation line missing indentation or outdented
Line 24189:1: E122 continuation line missing indentation or outdented
Line 24225:1: E122 continuation line missing indentation or outdented
Line 24267:1: E122 continuation line missing indentation or outdented
Line 24741:1: E122 continuation line missing indentation or outdented
Line 24841:1: E122 continuation line missing indentation or outdented
Line 25029:1: E122 continuation line missing indentation or outdented
Line 25053:1: E122 continuation line missing indentation or outdented
Line 25154:1: E122 continuation line missing indentation or outdented
Line 25190:1: E122 continuation line missing indentation or outdented
Line 25336:1: E122 continuation line missing indentation or outdented
Line 25461:1: E122 continuation line missing indentation or outdented
Line 26771:1: E122 continuation line missing indentation or outdented
Line 26775:1: E122 continuation line missing indentation or outdented
Line 26785:1: E122 continuation line missing indentation or outdented
Line 26801:1: E122 continuation line missing indentation or outdented
Line 26805:1: E122 continuation line missing indentation or outdented
Line 26809:1: E122 continuation line missing indentation or outdented
Line 26815:1: E122 continuation line missing indentation or outdented
Line 26821:1: E122 continuation line missing indentation or outdented
Line 26825:1: E122 continuation line missing indentation or outdented
Line 26825:80: E501 line too long (80 > 79 characters)
Line 26849:1: E122 continuation line missing indentation or outdented
Line 27024:1: E122 continuation line missing indentation or outdented
Line 27183:1: E122 continuation line missing indentation or outdented
Line 27782:1: E122 continuation line missing indentation or outdented
Line 27867:1: E122 continuation line missing indentation or outdented

Line 101:80: E501 line too long (80 > 79 characters)
Line 905:80: E501 line too long (80 > 79 characters)
Line 1566:80: E501 line too long (80 > 79 characters)
Line 3030:80: E501 line too long (80 > 79 characters)
Line 4120:80: E501 line too long (80 > 79 characters)
Line 4774:80: E501 line too long (80 > 79 characters)
Line 5980:80: E501 line too long (80 > 79 characters)
Line 6044:80: E501 line too long (80 > 79 characters)
Line 6182:80: E501 line too long (80 > 79 characters)
Line 7219:80: E501 line too long (80 > 79 characters)
Line 7403:80: E501 line too long (80 > 79 characters)
Line 7405:80: E501 line too long (80 > 79 characters)
Line 7857:80: E501 line too long (80 > 79 characters)
Line 7939:80: E501 line too long (80 > 79 characters)
Line 8216:80: E501 line too long (80 > 79 characters)
Line 8356:80: E501 line too long (80 > 79 characters)
Line 8761:80: E501 line too long (80 > 79 characters)
Line 9582:80: E501 line too long (80 > 79 characters)
Line 9593:80: E501 line too long (81 > 79 characters)
Line 9594:80: E501 line too long (80 > 79 characters)
Line 9596:80: E501 line too long (81 > 79 characters)
Line 9597:80: E501 line too long (80 > 79 characters)
Line 9600:80: E501 line too long (80 > 79 characters)
Line 9844:80: E501 line too long (80 > 79 characters)
Line 10576:80: E501 line too long (80 > 79 characters)
Line 10634:80: E501 line too long (80 > 79 characters)
Line 10872:80: E501 line too long (80 > 79 characters)
Line 11213:80: E501 line too long (80 > 79 characters)
Line 11539:80: E501 line too long (80 > 79 characters)
Line 12006:80: E501 line too long (82 > 79 characters)
Line 12318:80: E501 line too long (80 > 79 characters)
Line 12319:80: E501 line too long (83 > 79 characters)
Line 12397:80: E501 line too long (82 > 79 characters)
Line 14232:80: E501 line too long (80 > 79 characters)
Line 14413:80: E501 line too long (80 > 79 characters)
Line 16180:80: E501 line too long (80 > 79 characters)
Line 16188:80: E501 line too long (80 > 79 characters)
Line 16628:80: E501 line too long (80 > 79 characters)
Line 16702:80: E501 line too long (80 > 79 characters)
Line 16776:80: E501 line too long (80 > 79 characters)
Line 16777:80: E501 line too long (80 > 79 characters)
Line 17005:80: E501 line too long (80 > 79 characters)
Line 17007:80: E501 line too long (81 > 79 characters)
Line 17008:80: E501 line too long (80 > 79 characters)
Line 17914:80: E501 line too long (80 > 79 characters)
Line 18050:80: E501 line too long (80 > 79 characters)
Line 18137:80: E501 line too long (80 > 79 characters)
Line 18139:80: E501 line too long (80 > 79 characters)
Line 18140:80: E501 line too long (80 > 79 characters)
Line 18141:80: E501 line too long (81 > 79 characters)
Line 18255:80: E501 line too long (80 > 79 characters)
Line 19488:80: E501 line too long (80 > 79 characters)
Line 20188:80: E501 line too long (83 > 79 characters)
Line 20190:80: E501 line too long (80 > 79 characters)
Line 21311:80: E501 line too long (80 > 79 characters)
Line 21324:80: E501 line too long (80 > 79 characters)
Line 21450:80: E501 line too long (80 > 79 characters)
Line 21472:80: E501 line too long (80 > 79 characters)
Line 21496:80: E501 line too long (80 > 79 characters)
Line 21507:80: E501 line too long (80 > 79 characters)
Line 21516:80: E501 line too long (80 > 79 characters)
Line 21527:80: E501 line too long (80 > 79 characters)
Line 21529:80: E501 line too long (80 > 79 characters)
Line 21546:80: E501 line too long (80 > 79 characters)
Line 21570:80: E501 line too long (80 > 79 characters)
Line 21571:80: E501 line too long (80 > 79 characters)
Line 21576:80: E501 line too long (80 > 79 characters)
Line 21578:80: E501 line too long (80 > 79 characters)
Line 21585:80: E501 line too long (80 > 79 characters)
Line 21593:80: E501 line too long (80 > 79 characters)
Line 21595:80: E501 line too long (80 > 79 characters)
Line 21597:80: E501 line too long (80 > 79 characters)
Line 21608:80: E501 line too long (80 > 79 characters)
Line 21611:80: E501 line too long (80 > 79 characters)
Line 21629:80: E501 line too long (80 > 79 characters)
Line 21635:80: E501 line too long (80 > 79 characters)
Line 21676:80: E501 line too long (80 > 79 characters)
Line 21682:80: E501 line too long (80 > 79 characters)
Line 21724:80: E501 line too long (80 > 79 characters)
Line 21725:80: E501 line too long (80 > 79 characters)
Line 21730:80: E501 line too long (80 > 79 characters)
Line 21747:80: E501 line too long (80 > 79 characters)
Line 22285:80: E501 line too long (80 > 79 characters)
Line 22696:80: E501 line too long (80 > 79 characters)
Line 22699:80: E501 line too long (84 > 79 characters)
Line 22700:80: E501 line too long (80 > 79 characters)
Line 22703:80: E501 line too long (81 > 79 characters)
Line 24207:80: E501 line too long (80 > 79 characters)
Line 24298:80: E501 line too long (80 > 79 characters)
Line 24767:80: E501 line too long (80 > 79 characters)
Line 25052:80: E501 line too long (80 > 79 characters)
Line 26220:80: E501 line too long (80 > 79 characters)
Line 26338:80: E501 line too long (80 > 79 characters)
Line 27614:80: E501 line too long (84 > 79 characters)
Line 27644:80: E501 line too long (80 > 79 characters)
Line 27734:80: E501 line too long (83 > 79 characters)
Line 27806:80: E501 line too long (80 > 79 characters)
Line 28242:80: E501 line too long (80 > 79 characters)
Line 28873:80: E501 line too long (80 > 79 characters)
Line 29167:80: E501 line too long (80 > 79 characters)
Line 29211:80: E501 line too long (80 > 79 characters)
Line 29774:80: E501 line too long (80 > 79 characters)
Line 30411:80: E501 line too long (80 > 79 characters)
Line 30895:80: E501 line too long (121 > 79 characters)
Line 30898:80: E501 line too long (89 > 79 characters)
Line 30901:80: E501 line too long (89 > 79 characters)
Line 30904:80: E501 line too long (89 > 79 characters)
Line 30907:80: E501 line too long (89 > 79 characters)
Line 30910:80: E501 line too long (89 > 79 characters)
Line 30913:80: E501 line too long (99 > 79 characters)
Line 30916:80: E501 line too long (97 > 79 characters)
Line 30919:80: E501 line too long (99 > 79 characters)
Line 30925:80: E501 line too long (89 > 79 characters)
Line 32169:80: E501 line too long (80 > 79 characters)
Line 32354:80: E501 line too long (80 > 79 characters)
Line 32527:80: E501 line too long (80 > 79 characters)
Line 32641:80: E501 line too long (80 > 79 characters)
Line 33150:80: E501 line too long (83 > 79 characters)
Line 33360:80: E501 line too long (93 > 79 characters)
Line 33361:80: E501 line too long (84 > 79 characters)
Line 33362:80: E501 line too long (85 > 79 characters)
Line 33363:80: E501 line too long (84 > 79 characters)
Line 33364:80: E501 line too long (88 > 79 characters)
Line 33365:80: E501 line too long (87 > 79 characters)
Line 33366:80: E501 line too long (84 > 79 characters)
Line 33367:80: E501 line too long (92 > 79 characters)
Line 33368:80: E501 line too long (88 > 79 characters)
Line 33369:80: E501 line too long (88 > 79 characters)
Line 33370:80: E501 line too long (85 > 79 characters)
Line 33371:80: E501 line too long (88 > 79 characters)
Line 33372:80: E501 line too long (88 > 79 characters)
Line 33490:80: E501 line too long (80 > 79 characters)
Line 33498:80: E501 line too long (80 > 79 characters)
Line 33499:80: E501 line too long (80 > 79 characters)
Line 33801:80: E501 line too long (80 > 79 characters)
Line 33990:80: E501 line too long (80 > 79 characters)
Line 34452:80: E501 line too long (81 > 79 characters)
Line 34454:80: E501 line too long (87 > 79 characters)
Line 34455:80: E501 line too long (84 > 79 characters)
Line 34456:80: E501 line too long (83 > 79 characters)
Line 34458:80: E501 line too long (84 > 79 characters)
Line 34459:80: E501 line too long (83 > 79 characters)
Line 35441:80: E501 line too long (80 > 79 characters)
Line 36486:80: E501 line too long (80 > 79 characters)
Line 36487:80: E501 line too long (80 > 79 characters)
Line 36541:80: E501 line too long (80 > 79 characters)
Line 36592:80: E501 line too long (80 > 79 characters)
Line 37268:80: E501 line too long (80 > 79 characters)
Line 38077:80: E501 line too long (80 > 79 characters)
Line 40325:80: E501 line too long (80 > 79 characters)
Line 41004:80: E501 line too long (80 > 79 characters)
Line 41007:80: E501 line too long (80 > 79 characters)
Line 41256:1: E122 continuation line missing indentation or outdented
Line 41310:80: E501 line too long (80 > 79 characters)
Line 41476:80: E501 line too long (80 > 79 characters)
Line 41571:80: E501 line too long (80 > 79 characters)
Line 41585:80: E501 line too long (80 > 79 characters)
Line 41829:80: E501 line too long (81 > 79 characters)
Line 41830:80: E501 line too long (80 > 79 characters)
Line 41831:80: E501 line too long (82 > 79 characters)
Line 41832:80: E501 line too long (80 > 79 characters)
Line 41858:80: E501 line too long (80 > 79 characters)
Line 41867:80: E501 line too long (80 > 79 characters)
Line 41897:80: E501 line too long (80 > 79 characters)
Line 41964:80: E501 line too long (80 > 79 characters)
Line 41970:80: E501 line too long (80 > 79 characters)
Line 42027:80: E501 line too long (80 > 79 characters)
Line 42062:80: E501 line too long (80 > 79 characters)
Line 42086:80: E501 line too long (80 > 79 characters)
Line 42091:80: E501 line too long (80 > 79 characters)
Line 42092:80: E501 line too long (80 > 79 characters)
Line 42120:80: E501 line too long (80 > 79 characters)
Line 42131:80: E501 line too long (80 > 79 characters)
Line 42186:80: E501 line too long (80 > 79 characters)
Line 42195:80: E501 line too long (80 > 79 characters)
Line 42209:80: E501 line too long (80 > 79 characters)
Line 42218:80: E501 line too long (80 > 79 characters)
Line 42234:80: E501 line too long (80 > 79 characters)
Line 42237:80: E501 line too long (80 > 79 characters)
Line 42240:80: E501 line too long (80 > 79 characters)
Line 42255:80: E501 line too long (80 > 79 characters)
Line 42266:80: E501 line too long (80 > 79 characters)
Line 42273:80: E501 line too long (80 > 79 characters)
Line 42282:80: E501 line too long (80 > 79 characters)
Line 42315:80: E501 line too long (80 > 79 characters)
Line 42318:80: E501 line too long (80 > 79 characters)
Line 42332:80: E501 line too long (80 > 79 characters)
Line 42374:80: E501 line too long (80 > 79 characters)
Line 42400:80: E501 line too long (80 > 79 characters)
Line 42401:80: E501 line too long (80 > 79 characters)
Line 42429:80: E501 line too long (80 > 79 characters)
Line 42436:80: E501 line too long (80 > 79 characters)
Line 42452:80: E501 line too long (80 > 79 characters)
Line 42472:80: E501 line too long (81 > 79 characters)
Line 42473:80: E501 line too long (80 > 79 characters)
Line 42477:80: E501 line too long (82 > 79 characters)
Line 42479:80: E501 line too long (80 > 79 characters)
Line 42501:80: E501 line too long (80 > 79 characters)
Line 42582:80: E501 line too long (80 > 79 characters)
Line 42594:80: E501 line too long (80 > 79 characters)
Line 42681:80: E501 line too long (80 > 79 characters)
Line 42695:80: E501 line too long (80 > 79 characters)
Line 42765:80: E501 line too long (80 > 79 characters)
Line 42799:80: E501 line too long (80 > 79 characters)
Line 42860:80: E501 line too long (80 > 79 characters)
Line 42907:80: E501 line too long (80 > 79 characters)
Line 42965:80: E501 line too long (80 > 79 characters)
Line 42984:80: E501 line too long (80 > 79 characters)
Line 42992:80: E501 line too long (80 > 79 characters)
Line 43040:80: E501 line too long (80 > 79 characters)
Line 43041:80: E501 line too long (80 > 79 characters)
Line 43166:80: E501 line too long (80 > 79 characters)
Line 43175:80: E501 line too long (80 > 79 characters)
Line 43176:80: E501 line too long (80 > 79 characters)
Line 43181:80: E501 line too long (80 > 79 characters)
Line 43184:80: E501 line too long (80 > 79 characters)
Line 43193:80: E501 line too long (80 > 79 characters)
Line 43318:80: E501 line too long (80 > 79 characters)
Line 43363:80: E501 line too long (80 > 79 characters)
Line 44001:1: E122 continuation line missing indentation or outdented
Line 44168:1: E122 continuation line missing indentation or outdented
Line 44184:80: E501 line too long (80 > 79 characters)
Line 44243:80: E501 line too long (80 > 79 characters)
Line 44252:80: E501 line too long (80 > 79 characters)
Line 44309:80: E501 line too long (80 > 79 characters)
Line 44333:80: E501 line too long (80 > 79 characters)
Line 44343:80: E501 line too long (80 > 79 characters)
Line 44350:80: E501 line too long (80 > 79 characters)
Line 44359:80: E501 line too long (80 > 79 characters)
Line 44365:80: E501 line too long (80 > 79 characters)
Line 44387:80: E501 line too long (80 > 79 characters)
Line 44416:80: E501 line too long (80 > 79 characters)
Line 44417:80: E501 line too long (80 > 79 characters)
Line 44418:80: E501 line too long (84 > 79 characters)
Line 44427:80: E501 line too long (80 > 79 characters)
Line 44433:80: E501 line too long (80 > 79 characters)
Line 44452:80: E501 line too long (80 > 79 characters)
Line 44466:80: E501 line too long (80 > 79 characters)
Line 44496:80: E501 line too long (80 > 79 characters)
Line 44505:80: E501 line too long (80 > 79 characters)
Line 44544:80: E501 line too long (80 > 79 characters)
Line 44549:1: E122 continuation line missing indentation or outdented
Line 44556:1: E122 continuation line missing indentation or outdented

Comment last updated at 2021-06-04 00:15:33 UTC

@seandoyle
Copy link
Author

I'm unclear what I should do about the failing unit tests because they appear to be caused by changes outside of the scope of this PR. The PEP8 issues are on generated code - also a little outside the scope here. Open to suggestions.

@mrbean-bremen
Copy link
Member

because they appear to be caused by changes outside of the scope of this PR

The test fails because the code for "Tc99mTetrofosmin" has changed - I actually don't understand it. There are a lot of changes (I guess you used a different version of the standard), but I was under the impression that these codes are fixed. Maybe @hackermd can have a look at this.

@seandoyle
Copy link
Author

We're still working on this. CP 1850 has the details - there was a large number of coding changes from SNOMED-RT to SNOMED-CT. We'll respond with more details and a proposal.

@hackermd
Copy link
Contributor

hackermd commented Jan 7, 2021

We learned that not only code meanings, but also code values may be subject to change. DICOM defers to the individual coding schemes on how codes are maintained. SNOMED sometimes retires codes (not sure what the procedures are).

We have too things that complicate comparison of codes:

  1. There generally are SCT and SRT codes representing the same concept.
  2. There may be two SCT or SRT codes representing the same concept, where one of them is active and the other is retired.

We already account for 1. in pydicom.sr._snomed_dict based on Part 16 Annex O SNOMED Concept ID to SNOMED ID Mapping. We only expose SCT codes in pydicom.sr.codedict, but consider the corresponding SRT codes internally for determining equality.

It seems we also need to account for 2. and should create an additional mapping for Part 16 Annex J SNOMED Retired Codes. I would argue that we should only expose active codes in pydicom.sr.codedict. However, we will need to be smart about updating the library using generated_concept_dicts.py and may have to maintain retired codes for backwards compatibility.

@hackermd
Copy link
Contributor

hackermd commented Jan 7, 2021

I would suggest the following algorithm for updating:

  1. Update concepts map in pydicom.sr._concepts_dict, including codes from Table J-1 using SCT codes as keys
  2. Parse Table O-1 and extract SCT codes
  3. Look up concept in concepts map using SCT code as key. Use meaning specified in the looked up value to construct attribute name for codes.SCT (to avoid backwards incompatible changes in case the meaning should have changed)

@mrbean-bremen what do you think?

@mrbean-bremen
Copy link
Member

@hackermd - I will have a look tomorrow evening (didn't get to it today), though this is something that @darcymason and @scaramallion will probably want to check, too.

@scaramallion
Copy link
Member

SR is outside my area of expertise, I'm happy to defer to those with more experience

@hackermd
Copy link
Contributor

hackermd commented Jan 8, 2021

cc'ing @dclunie who pointed out Table J-1 and helped clarify questions regarding retired codes

@darcymason
Copy link
Member

though this is something that @darcymason and @scaramallion will probably want to check, too.

SR is really outside my area of expertise too - I wrote some of the source code in pydicom, but I don't have knowledge really of the SR codes and their meanings/retirements etc. But having read through @hackermd's proposals and looking at the tables linked, I agree with the principles, which it sounds like are the same as previously - basically convert to latest definitions, be flexible on reading in codes, but more strict on assigning codes to try to keep to non-retired ones, and in any case try to be explicit rather than silently accepting ambiguous situations.

3. Look up concept in concepts map using SCT code as key. Use meaning specified in the looked up value to construct attribute name for codes.SCT

This sounds a bit tricky, but again, in principle seems like the safest way.

@mrbean-bremen
Copy link
Member

Sorry, didn't get to this yesterday. I agree with @darcymason - as far as I can see, this all makes sense. And I also have to admit that I'm no expert by far for SR - I have been using it a long time ago and haven't been following it's development since then.

@hackermd
Copy link
Contributor

  1. Look up concept in concepts map using SCT code as key. Use meaning specified in the looked up value to construct attribute name for codes.SCT

This sounds a bit tricky, but again, in principle seems like the safest way.

Yes, that's going to be a bit tricky, but I think it's necessary. We should guarantee that the attributes of pydicom.sr.codedict.codes (generated keyword for for code meaning) remain the same when updating the library even if the codes in the standard may have changed.

@darcymason
Copy link
Member

Just checking in on this PR -- we have upcoming release - can we get this in for the release?

@seandoyle
Copy link
Author

I'm sorry - wasn't sure of of some of the steps and let this slip. I'll take a look tonight. If we follow @hackermd's recommendation then we should also change the unit tests to match the latest values. Don't know how many of these there will be. What is the timeframe for the upcoming release?

@darcymason
Copy link
Member

What is the timeframe for the upcoming release?

We don't have fixed dates, but had planned May some time back ... I'm late getting around to it anyway. I'd be fine with around 2 weeks, at least for a release candidate.

@darcymason
Copy link
Member

@seandoyle, I've just rediscovered this PR - my apologies that this slipped through the cracks. I somehow missed back then that you had submitted new commits.

Would there be any changes needed now before it could be pulled in?

@seandoyle
Copy link
Author

It's been a while - but I need to review it. The problem as I remember it was that incorporating the changes as is might break backward compatibility because some of the code values had changed.

  • The simplest thing would be to just have the code values be changed. This is consistent with the most recent version of the standard. But older files and older code might have difficulties.
  • We could leave the older codes as-is and generate the new ones with one more level of indirection for different versions of the code.
  • Accept @hackermd 's suggestion from Jan 7. I'm not entirely sure I understand step 3 - Use meaning specified in the looked up value to construct attribute name for codes.SCT - but it's been a while since I looked at this.

I would vote for following @hackermd's approach but I may ask some questions as I go along.

@hackermd
Copy link
Contributor

There are two things that could pose problems for backwards compatibility:

  1. A change of Code Meaning. This appears to happen relatively frequently. It is important to consider in this context that SNOMED-CT codes often have several synonyms, which can be used interchangeably.
  2. A change of Code Value. This should be a relatively rare event, but it does occur and is at the discretion of the source standard (e.g., SNOMED-CT).

To ensure a dictionary entry in pydicom doesn't change if the Code Meaning changes in the standard, I suggest creating a "reverse" lookup table from the value (Code Value) to the corresponding dictionary keyword (derived from the "previous" Code Meaning). When we then regenerate the dictionary from the standard documents, we can find and reuse the existing keyword for a given value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants