Assertion Error (Continued with MIMIC3 question...))

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

In the previous question, the diagnostic code is "7054" in the excel file, but it seems that the yaml file was "07054", so there was a key error.

So there was no key error by removing all zeros in front of the yaml file.

/mnt/c/dev/mimic3-benchmarks$ python3 -m mimic3benchmark.scripts.create_phenotyping data/root/ data/phenotyping/
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
  File "/mnt/c/dev/mimic3-benchmarks/mimic3benchmark/scripts/create_phenotyping.py", line 125, in <module>
    main()
  File "/mnt/c/dev/mimic3-benchmarks/mimic3benchmark/scripts/create_phenotyping.py", line 112, in main
assert code_to_group[code] == group
AssertionError

I'm getting this error, but I'm asking why I get this error and how to solve it.

The appropriate neighbor codes are as follows:

code_to_group = {}
for group in definitions:
    codes = definitions[group]['codes']
    for code in codes:
        if code not in code_to_group:
            code_to_group[code] = group
        else:
            assert code_to_group[code] == group

python

2022-09-20 11:08

1 Answers

In a definition with a group and its diagnostic codes,

Logic is creating code_to_group, a simple dictionary that tells you which group the diagnostic code is.

Code_to_group["1111"] must indicate which group the diagnostic code "1111" belongs to. This is what code_to_gropu does.

However, the diagnostic code definition of the group and the group should not overlap with the diagnostic code of the other group in the first place. If there is "1111" in group A's diagnostic code, there should not be "1111" in other groups.

Perhaps in the process of removing the preceding zero, the error occurred when "01111" and "1111" were different diagnostic codes and were changed to the same "1111".

assert code_to_group[code] == group 

Print the print door that checks it in front of the part and turn it around.

print(code_to_group[code], group)
assert code_to_group[code] == group

I think we need to check if the original file used was 7054. Originally, it was 07054, but Excel automatically changed it to 7054, and the problem occurred because it was stored incorrectly.


2022-09-20 11:08

If you have any answers or tips


© 2022 pinfo. All rights reserved.