Skip to content

Instantly share code, notes, and snippets.

@jibrel
Forked from cryocaustik/README.md
Created May 13, 2023 23:50
Show Gist options
  • Select an option

  • Save jibrel/bb2164bc2b7838d89e9f34ea5ce42dd0 to your computer and use it in GitHub Desktop.

Select an option

Save jibrel/bb2164bc2b7838d89e9f34ea5ce42dd0 to your computer and use it in GitHub Desktop.

Revisions

  1. Alex Skobelev revised this gist Jan 27, 2019. 2 changed files with 1 addition and 28 deletions.
    2 changes: 1 addition & 1 deletion icd10_codes.json
    1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
    27 changes: 0 additions & 27 deletions icd10_txt_to_json.py
    Original file line number Diff line number Diff line change
    @@ -1,27 +0,0 @@
    import json

    """Convert CMS GEM ICD Dump to ICD Code:Desc JSON dump.
    Data downloaded from: https://www.cms.gov/Medicare/Coding/ICD10/2018-ICD-10-CM-and-GEMs.html
    """

    # import raw txt
    path_import = r'./icd10cm_codes_2018.txt'
    with open(path_import, 'r') as _f:
    raw = _f.read()
    _f.close()

    # convert raw txt to json
    data = []
    for rcd in raw.split('\n'):
    if rcd:
    data.append({
    'code': rcd[:8].strip(),
    'desc': rcd[9:],
    })

    # export converted json
    path_export = './codes_icd10.json'
    with open(path_export, 'w') as _f:
    json.dump(data, _f)
    _f.close()
  2. Alex Skobelev revised this gist Jan 27, 2019. 2 changed files with 54 additions and 1 deletion.
    53 changes: 53 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,53 @@
    # CMS ICD GEMs JSON Dump

    JSON Dump of ICD 10 Codes & Desc

    ## Data Sample (formatted)

    ```json
    [
    {
    "code": "A000",
    "desc": "holera due to Vibrio cholerae 01, biovar cholerae"
    }, {
    "code": "A001",
    "desc": "holera due to Vibrio cholerae 01, biovar eltor"
    },
    ]
    ```

    ## Source

    Data raw text data downloaded from [CMS ICD GEMs](https://www.cms.gov/Medicare/Coding/ICD10/2018-ICD-10-CM-and-GEMs.html)

    ## Conversion

    ```python
    import json

    """Convert CMS GEM ICD Dump to ICD Code:Desc JSON dump.
    Data downloaded from: https://www.cms.gov/Medicare/Coding/ICD10/2018-ICD-10-CM-and-GEMs.html
    """

    # import raw txt
    path_import = r'./icd10cm_codes_2018.txt'
    with open(path_import, 'r') as _f:
    raw = _f.read()
    _f.close()

    # convert raw txt to json
    data = []
    for rcd in raw.split('\n'):
    if rcd:
    data.append({
    'code': rcd[:8].strip(),
    'desc': rcd[9:],
    })

    # export converted json
    path_export = './codes_icd10.json'
    with open(path_export, 'w') as _f:
    json.dump(data, _f)
    _f.close()
    ```
    2 changes: 1 addition & 1 deletion icd10_codes.json
    1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
  3. Alex Skobelev revised this gist Jan 27, 2019. 2 changed files with 28 additions and 1 deletion.
    2 changes: 1 addition & 1 deletion icd10_codes.json
    1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
    27 changes: 27 additions & 0 deletions icd10_txt_to_json.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    import json

    """Convert CMS GEM ICD Dump to ICD Code:Desc JSON dump.
    Data downloaded from: https://www.cms.gov/Medicare/Coding/ICD10/2018-ICD-10-CM-and-GEMs.html
    """

    # import raw txt
    path_import = r'./icd10cm_codes_2018.txt'
    with open(path_import, 'r') as _f:
    raw = _f.read()
    _f.close()

    # convert raw txt to json
    data = []
    for rcd in raw.split('\n'):
    if rcd:
    data.append({
    'code': rcd[:8].strip(),
    'desc': rcd[9:],
    })

    # export converted json
    path_export = './codes_icd10.json'
    with open(path_export, 'w') as _f:
    json.dump(data, _f)
    _f.close()
  4. Alex Skobelev created this gist Jan 27, 2019.
    1 change: 1 addition & 0 deletions icd10_codes.json
    1 addition, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.