simple-icd-10-cm 1.4.0__tar.gz → 1.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simple_icd_10_cm
3
- Version: 1.4.0
3
+ Version: 1.5.0
4
4
  Summary: A simple python library for ICD-10-CM codes
5
5
  Home-page: https://github.com/StefanoTrv/simple_icd_10_CM
6
6
  Author: Stefano Travasci
@@ -68,10 +68,15 @@ A simple python library for ICD-10-CM codes
68
68
  * [get_index(code)](#get_indexcode)
69
69
  * [remove_dot(code)](#remove_dotcode)
70
70
  * [add_dot(code)](#add_dotcode)
71
- * [change_version(all_codes_file_path=None, classification_data_file_path=None)](#change_versionall_codes_file_pathnone-classification_data_file_pathnone)
71
+ * [change_version(all_codes_file_path=None, classification_data_file_path=None, suppress_warnings=None)](#change_versionall_codes_file_pathnone-classification_data_file_pathnone-suppress_warningsnone)
72
72
  * [Conclusion](#conclusion)
73
73
 
74
74
  ## Release notes
75
+ * **1.5.0**:
76
+ * The default ICD-10-CM release of the library is now the **April 2026 release**
77
+ * Certain kinds of defects in the data will now emit warnings instead of crashing the library
78
+ * Small refactoring for my own sanity
79
+ * Thanks to @Qwemep on Github for her valuable insights!
75
80
  * **1.4.0**: The data in the fields "codeAlso" and "notes" can now be retrieved using the get_code_also() and get_notes() functions
76
81
  * **1.3.0**:
77
82
  * Users can now use their preferred ICD-10-CM release by providing properly formatted files as inputs
@@ -92,7 +97,7 @@ The objective of this library is to provide a simple instrument for dealing with
92
97
  If you are looking for a library that deals with ICD-10 codes instead of ICD-10-CM codes, you can check the [simple_icd_10 library](https://github.com/StefanoTrv/simple_icd_10), which is based on the 2019 version of ICD-10. If you are interested in the ICD-11 MMS classification, you can check out instead the [simple_icd_11 library](https://github.com/StefanoTrv/simple_icd_11).
93
98
  There is also a Java version of this library, [SimpleICD10CM-Java-edition](https://github.com/StefanoTrv/SimpleICD10CM-Java-edition).
94
99
 
95
- The data used in this library was taken from the [website of the CDC](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html). This library currently uses the **April 2025 release of ICD-10-CM**. This package can be configured to use other releases of the ICD-10-CM classification, read the section [Using other ICD-10-CM releases](#using-other-icd-10-cm-releases) for more details.
100
+ The data used in this library was taken from the [website of the CDC](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html). This library currently uses the **April 2026 release of ICD-10-CM**. This package can be configured to use other releases of the ICD-10-CM classification, read the section [Using other ICD-10-CM releases](#using-other-icd-10-cm-releases) for more details.
96
101
 
97
102
  If you feel like supporting me, please check out the [Conclusion section](#conclusion).
98
103
 
@@ -128,14 +133,14 @@ cm.change_version(classification_data_file_path="icd10cm_tabular_2021.xml")
128
133
 
129
134
  The file specified in `all_codes_file_path` should contain all the unique codes of the desired release. However, it is sufficient that it contains all the seven-characters codes that must be generated programmatically, that is all the valid codes that are not explicitly listed in the XML file (see [About the special seventh character](#about-the-special-seventh-character) for more information). Each line in this file must contain a single code. Codes can be written in the format with or without the dot. In each line, the code may be followed by any text, as long as there is at least one space character immediately after the code. The `icd10cm-codes` text files available from the [CDC's website](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html) can be used for this purpose, without modification.
130
135
  The file specified in `classification_data_file_path` is the XML containing the whole classification. This typically corresponds to the `icd10cm-tabular` XML files available from the [CDC's website](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html). If using XML files from another origin, note that, in the official releases, the first two children of the root XML element are not part of the structure of the classification, and are therefore skipped by the library.
131
- Examples of both file types can be found in the [all-data folder](https://github.com/StefanoTrv/simple_icd_10_CM/tree/master/all-data), which includes data for the current default release and for a previous release.
136
+ Examples of both file types can be found in the [all-data folder](https://github.com/StefanoTrv/simple_icd_10_CM/tree/master/all-data), which includes data for the current default release and for previous releases.
132
137
 
133
138
  ## The format of the codes
134
139
  Subcategories codes can be written in two different ways: with a dot (for example "I13.1") and with no dot (for example "I131"). The functions in this library can receive as input codes in both these formats. The codes returned by the functions will always be in the format with the dot.
135
140
  You can easily change the format of a code by using the [`remove_dot`](#remove_dotcode) and [`add_dot`](#add_dotcode) functions.
136
141
 
137
142
  ## About the file "Instructional Notations.md"
138
- The file [Instructional Notations.md](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Instructional%20Notations.md) contains the introduction present in the file `icd10cm-tabular-April-2025.xml` (the file that contains the whole ICD-10-CM classification), copied there in a more accessible and readable format. There you can find an explanation about the meaning of most of the additional fields that can accompany a code.
143
+ The file [Instructional Notations.md](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Instructional%20Notations.md) contains the introduction present in the file `icd10cm-tabular-April-2026.xml` (the file that contains the whole ICD-10-CM classification), copied there in a more accessible and readable format. There you can find an explanation about the meaning of most of the additional fields that can accompany a code.
139
144
 
140
145
  ## Blocks containing only one category
141
146
  Unlike ICD-10, ICD-10-CM includes blocks of categories that contain only one category (and its subcategories). These blocks are named after the category that they contain, which means that ICD-10-CM contains blocks and categories that have the same exact code. This is a problem: because of this questionable decision, we can't know for sure if the code "B99", for example, refers to the category "B99" or to the block with the same name. This can be seen in the following example, where "B99" is recognized as both a block and a category:
@@ -161,9 +166,9 @@ cm.is_block("I12") and cm.is_category("I12")
161
166
  ```
162
167
 
163
168
  ## About the special seventh character
164
- The file `icd10cm-tabular-April-2025.xml`, which is the XML file that contains the whole ICD-10-CM classification, doesn't have an entry for all the codes generated by adding the "special" seventh character, but it often contains instead rules that explain how to generate these codes in the "sevenChrDef" field (and sometimes in the "sevenChrNote" field too, just to complicate things a little bit...). You can find more about the structure of these particular codes in [Instructional Notations.md](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Instructional%20Notations.md).
169
+ The file `icd10cm-tabular-April-2026.xml`, which is the XML file that contains the whole ICD-10-CM classification, doesn't have an entry for all the codes generated by adding the "special" seventh character, but it often contains instead rules that explain how to generate these codes in the "sevenChrDef" field (and sometimes in the "sevenChrNote" field too, just to complicate things a little bit...). You can find more about the structure of these particular codes in [Instructional Notations.md](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Instructional%20Notations.md).
165
170
  Due to the lack of a complete entry for these missing codes, I had to decide how they would be handled in this library. So I decided that their only field would be the description, composed of the description of their parent followed by the description of the meaning of the additional character, with a comma between the two: this description appears in official documents about ICD-10-CM, so it's not my invention but the actual official format. All the other fields are empty, but the optional argument `search_in_ancestors` of certain functions can be used to automatically retrieve the content of certain fields from the ancestors of the code (see the description of the specific functions in the [Documentation](#documentation) for more details).
166
- Seven-characters codes that have an entry in `icd10cm-tabular-April-2025.xml` are treated like any other code, and their data is taken directly from the file.
171
+ Seven-characters codes that have an entry in `icd10cm-tabular-April-2026.xml` are treated like any other code, and their data is taken directly from the file.
167
172
  If you need to know whether a code has been automatically generated using a rule described in a "sevenChrDef" field, you can use the [`is_extended_subcategory`](#is_extended_subcategorycode) function. Only the codes generated programmatically are classified as "extended subcategories", the seven-characters codes explicitly listed in the data are classified as "subcategories".
168
173
 
169
174
  ## Documentation
@@ -504,8 +509,8 @@ cm.add_dot("K00-K14")
504
509
  #'K00-K14'
505
510
  ```
506
511
 
507
- ### change_version(all_codes_file_path=None, classification_data_file_path=None)
508
- This function can be used to load any ICD-10-CM release provided by the user, or to revert to using the default release for the package. Its usage is explained in the paragraph [Using other ICD-10-CM releases](#using-other-icd-10-cm-releases).
512
+ ### change_version(all_codes_file_path=None, classification_data_file_path=None, suppress_warnings=None)
513
+ This function can be used to load any ICD-10-CM release provided by the user, or to revert to using the default release for the package. Its usage is explained in the paragraph [Using other ICD-10-CM releases](#using-other-icd-10-cm-releases). The optional argument `suppress_warnings` can be used to hide the warnings that are emitted when some kinds of small inconsistencies are detected in the loaded data. Setting this parameter to `True` will hide the warnings, setting it to `False` will show them, setting it to `None` or omitting it will not change whether warnings are hidden or shown. It is recommended that you always omit this parameter.
509
514
 
510
515
  ## Conclusion
511
516
  This should be everything you need to know about the simple_icd_10_cm library. Please contact me if you find any mistake, bug, missing feature or anything else that could be improved or made easier to comprehend, both in this documentation and in the library itself as well as in the [Showcase notebook](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Showcase%20notebook.ipynb). You can also contact me if you need any help using this library, but I may not be able to help with questions about the ICD-10-CM classification itself.
@@ -43,10 +43,15 @@ A simple python library for ICD-10-CM codes
43
43
  * [get_index(code)](#get_indexcode)
44
44
  * [remove_dot(code)](#remove_dotcode)
45
45
  * [add_dot(code)](#add_dotcode)
46
- * [change_version(all_codes_file_path=None, classification_data_file_path=None)](#change_versionall_codes_file_pathnone-classification_data_file_pathnone)
46
+ * [change_version(all_codes_file_path=None, classification_data_file_path=None, suppress_warnings=None)](#change_versionall_codes_file_pathnone-classification_data_file_pathnone-suppress_warningsnone)
47
47
  * [Conclusion](#conclusion)
48
48
 
49
49
  ## Release notes
50
+ * **1.5.0**:
51
+ * The default ICD-10-CM release of the library is now the **April 2026 release**
52
+ * Certain kinds of defects in the data will now emit warnings instead of crashing the library
53
+ * Small refactoring for my own sanity
54
+ * Thanks to @Qwemep on Github for her valuable insights!
50
55
  * **1.4.0**: The data in the fields "codeAlso" and "notes" can now be retrieved using the get_code_also() and get_notes() functions
51
56
  * **1.3.0**:
52
57
  * Users can now use their preferred ICD-10-CM release by providing properly formatted files as inputs
@@ -67,7 +72,7 @@ The objective of this library is to provide a simple instrument for dealing with
67
72
  If you are looking for a library that deals with ICD-10 codes instead of ICD-10-CM codes, you can check the [simple_icd_10 library](https://github.com/StefanoTrv/simple_icd_10), which is based on the 2019 version of ICD-10. If you are interested in the ICD-11 MMS classification, you can check out instead the [simple_icd_11 library](https://github.com/StefanoTrv/simple_icd_11).
68
73
  There is also a Java version of this library, [SimpleICD10CM-Java-edition](https://github.com/StefanoTrv/SimpleICD10CM-Java-edition).
69
74
 
70
- The data used in this library was taken from the [website of the CDC](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html). This library currently uses the **April 2025 release of ICD-10-CM**. This package can be configured to use other releases of the ICD-10-CM classification, read the section [Using other ICD-10-CM releases](#using-other-icd-10-cm-releases) for more details.
75
+ The data used in this library was taken from the [website of the CDC](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html). This library currently uses the **April 2026 release of ICD-10-CM**. This package can be configured to use other releases of the ICD-10-CM classification, read the section [Using other ICD-10-CM releases](#using-other-icd-10-cm-releases) for more details.
71
76
 
72
77
  If you feel like supporting me, please check out the [Conclusion section](#conclusion).
73
78
 
@@ -103,14 +108,14 @@ cm.change_version(classification_data_file_path="icd10cm_tabular_2021.xml")
103
108
 
104
109
  The file specified in `all_codes_file_path` should contain all the unique codes of the desired release. However, it is sufficient that it contains all the seven-characters codes that must be generated programmatically, that is all the valid codes that are not explicitly listed in the XML file (see [About the special seventh character](#about-the-special-seventh-character) for more information). Each line in this file must contain a single code. Codes can be written in the format with or without the dot. In each line, the code may be followed by any text, as long as there is at least one space character immediately after the code. The `icd10cm-codes` text files available from the [CDC's website](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html) can be used for this purpose, without modification.
105
110
  The file specified in `classification_data_file_path` is the XML containing the whole classification. This typically corresponds to the `icd10cm-tabular` XML files available from the [CDC's website](https://www.cdc.gov/nchs/icd/icd-10-cm/files.html). If using XML files from another origin, note that, in the official releases, the first two children of the root XML element are not part of the structure of the classification, and are therefore skipped by the library.
106
- Examples of both file types can be found in the [all-data folder](https://github.com/StefanoTrv/simple_icd_10_CM/tree/master/all-data), which includes data for the current default release and for a previous release.
111
+ Examples of both file types can be found in the [all-data folder](https://github.com/StefanoTrv/simple_icd_10_CM/tree/master/all-data), which includes data for the current default release and for previous releases.
107
112
 
108
113
  ## The format of the codes
109
114
  Subcategories codes can be written in two different ways: with a dot (for example "I13.1") and with no dot (for example "I131"). The functions in this library can receive as input codes in both these formats. The codes returned by the functions will always be in the format with the dot.
110
115
  You can easily change the format of a code by using the [`remove_dot`](#remove_dotcode) and [`add_dot`](#add_dotcode) functions.
111
116
 
112
117
  ## About the file "Instructional Notations.md"
113
- The file [Instructional Notations.md](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Instructional%20Notations.md) contains the introduction present in the file `icd10cm-tabular-April-2025.xml` (the file that contains the whole ICD-10-CM classification), copied there in a more accessible and readable format. There you can find an explanation about the meaning of most of the additional fields that can accompany a code.
118
+ The file [Instructional Notations.md](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Instructional%20Notations.md) contains the introduction present in the file `icd10cm-tabular-April-2026.xml` (the file that contains the whole ICD-10-CM classification), copied there in a more accessible and readable format. There you can find an explanation about the meaning of most of the additional fields that can accompany a code.
114
119
 
115
120
  ## Blocks containing only one category
116
121
  Unlike ICD-10, ICD-10-CM includes blocks of categories that contain only one category (and its subcategories). These blocks are named after the category that they contain, which means that ICD-10-CM contains blocks and categories that have the same exact code. This is a problem: because of this questionable decision, we can't know for sure if the code "B99", for example, refers to the category "B99" or to the block with the same name. This can be seen in the following example, where "B99" is recognized as both a block and a category:
@@ -136,9 +141,9 @@ cm.is_block("I12") and cm.is_category("I12")
136
141
  ```
137
142
 
138
143
  ## About the special seventh character
139
- The file `icd10cm-tabular-April-2025.xml`, which is the XML file that contains the whole ICD-10-CM classification, doesn't have an entry for all the codes generated by adding the "special" seventh character, but it often contains instead rules that explain how to generate these codes in the "sevenChrDef" field (and sometimes in the "sevenChrNote" field too, just to complicate things a little bit...). You can find more about the structure of these particular codes in [Instructional Notations.md](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Instructional%20Notations.md).
144
+ The file `icd10cm-tabular-April-2026.xml`, which is the XML file that contains the whole ICD-10-CM classification, doesn't have an entry for all the codes generated by adding the "special" seventh character, but it often contains instead rules that explain how to generate these codes in the "sevenChrDef" field (and sometimes in the "sevenChrNote" field too, just to complicate things a little bit...). You can find more about the structure of these particular codes in [Instructional Notations.md](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Instructional%20Notations.md).
140
145
  Due to the lack of a complete entry for these missing codes, I had to decide how they would be handled in this library. So I decided that their only field would be the description, composed of the description of their parent followed by the description of the meaning of the additional character, with a comma between the two: this description appears in official documents about ICD-10-CM, so it's not my invention but the actual official format. All the other fields are empty, but the optional argument `search_in_ancestors` of certain functions can be used to automatically retrieve the content of certain fields from the ancestors of the code (see the description of the specific functions in the [Documentation](#documentation) for more details).
141
- Seven-characters codes that have an entry in `icd10cm-tabular-April-2025.xml` are treated like any other code, and their data is taken directly from the file.
146
+ Seven-characters codes that have an entry in `icd10cm-tabular-April-2026.xml` are treated like any other code, and their data is taken directly from the file.
142
147
  If you need to know whether a code has been automatically generated using a rule described in a "sevenChrDef" field, you can use the [`is_extended_subcategory`](#is_extended_subcategorycode) function. Only the codes generated programmatically are classified as "extended subcategories", the seven-characters codes explicitly listed in the data are classified as "subcategories".
143
148
 
144
149
  ## Documentation
@@ -479,8 +484,8 @@ cm.add_dot("K00-K14")
479
484
  #'K00-K14'
480
485
  ```
481
486
 
482
- ### change_version(all_codes_file_path=None, classification_data_file_path=None)
483
- This function can be used to load any ICD-10-CM release provided by the user, or to revert to using the default release for the package. Its usage is explained in the paragraph [Using other ICD-10-CM releases](#using-other-icd-10-cm-releases).
487
+ ### change_version(all_codes_file_path=None, classification_data_file_path=None, suppress_warnings=None)
488
+ This function can be used to load any ICD-10-CM release provided by the user, or to revert to using the default release for the package. Its usage is explained in the paragraph [Using other ICD-10-CM releases](#using-other-icd-10-cm-releases). The optional argument `suppress_warnings` can be used to hide the warnings that are emitted when some kinds of small inconsistencies are detected in the loaded data. Setting this parameter to `True` will hide the warnings, setting it to `False` will show them, setting it to `None` or omitting it will not change whether warnings are hidden or shown. It is recommended that you always omit this parameter.
484
489
 
485
490
  ## Conclusion
486
491
  This should be everything you need to know about the simple_icd_10_cm library. Please contact me if you find any mistake, bug, missing feature or anything else that could be improved or made easier to comprehend, both in this documentation and in the library itself as well as in the [Showcase notebook](https://github.com/StefanoTrv/simple_icd_10_CM/blob/master/Showcase%20notebook.ipynb). You can also contact me if you need any help using this library, but I may not be able to help with questions about the ICD-10-CM classification itself.
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="simple_icd_10_cm",
8
- version="1.4.0",
8
+ version="1.5.0",
9
9
  author="Stefano Travasci",
10
10
  author_email="stefanotravasci@gmail.com",
11
11
  description="A simple python library for ICD-10-CM codes",