ZhipengHe / MIMIC-IV-event-log-extraction-for-ED

MIMIC-IV Event Log for Emergency Department
MIT License
2 stars 0 forks source link

The generated xes log cannot be imported into ProM #4

Closed ZhipengHe closed 1 year ago

ZhipengHe commented 1 year ago

Bugs Description

When importing the generated xes log into ProM, ProM will prompt the following errors.

Exception happened: javalang.Exception: For input string: "nan'

ProM Error Message

ZhipengHe commented 1 year ago

There are invalid event attributes with 'NaN' value in original XES file.

<trace>
        <int key="subject_id" value="15054299" />
        <float key="hadm_id" value="20473679.0" />
        <float key="acuity" value="3.0" />
        <string key="chiefcomplaint" value="R Flank pain, Dyspnea" />
        <string key="concept:name" value="30002104" />
        <event>
            <int key="stay_id" value="30002104" />
            <date key="timestamps" value="2112-10-22T05:48:00+00:00" />
            <string key="activity" value="Enter the ED" />
            <string key="gender" value="M" />
            <string key="race" value="WHITE" />
            <string key="arrival_transport" value="WALK IN" />
            <float key="disposition" value="nan" />
            <float key="seq_num" value="nan" />
            <float key="icd_code" value="nan" />
            <float key="icd_version" value="nan" />
            <float key="icd_title" value="nan" />
            <float key="temperature" value="nan" />
            <float key="heartrate" value="nan" />
            <float key="resprate" value="nan" />
            <float key="o2sat" value="nan" />
            <float key="sbp" value="nan" />
            <float key="dbp" value="nan" />
            <float key="pain" value="nan" />
            <float key="rhythm" value="nan" />
            <float key="name" value="nan" />
            <float key="gsn" value="nan" />
            <float key="ndc" value="nan" />
            <float key="etc_rn" value="nan" />
            <float key="etccode" value="nan" />
            <float key="etcdescription" value="nan" />
            <float key="med_rn" value="nan" />
            <float key="gsn_rn" value="nan" />
            <string key="concept:name" value="Enter the ED" />
            <date key="time:timestamp" value="2112-10-22T05:48:00+00:00" />
            <int key="@@index" value="0" />
            <int key="@@case_index" value="0" />
        </event>
...
</trace>
ZhipengHe commented 1 year ago

Remove NaN value with stream_postprocessing in pm4py

pm4py.convert_to_event_log(log_csv, stream_postprocessing=True)
    <trace>
        <string key="concept:name" value="30000012" />
        <string key="subject_id" value="11714491" />
        <string key="hadm_id" value="21562392" />
        <string key="acuity" value="2.0000" />
        <string key="chiefcomplaint" value="CHANGE IN MENTAL STATUS" />
        <event>
            <date key="time:timestamp" value="2126-02-14T20:22:00+00:00" />
            <string key="concept:name" value="Vital sign check" />
            <string key="temperature" value="98.8000" />
            <string key="heartrate" value="96.0000" />
            <string key="resprate" value="18.0000" />
            <string key="o2sat" value="93.0000" />
            <string key="sbp" value="160" />
            <string key="dbp" value="54" />
            <string key="pain" value="0" />
        </event>
...
</trace>