lrsoenksen / HAIM

This repository contains the code to replicate the data processing, modeling and reporting of our Holistic AI in Medicine (HAIM) Publication in Nature Machine Intelligence (Soenksen LR, Ma Y, Zeng C et al. 2022).
Apache License 2.0
104 stars 27 forks source link

How to use when missing files #6

Closed xunmzii closed 1 year ago

xunmzii commented 1 year ago

Hi~Due to the missing file 'mimic-cxr-2.0.0-jpeg-txt.csv' , I intend to use the extracted HAIM embeddings you've posted on [https://physionet.org/content/haim-multimodal/1.0.1/] . When I use 'Sample_Multimodal_Patient_Files' in '2_Generate Embeddings from Pickle Files.ipynb', it reports an error : ModuleNotFoundError: No module named 'src' . have already downloaded all the files on this website, and I want to know how to use them in the repo.
1680605493496

xunmzii commented 1 year ago

In 3_Use Embedding for Prediction.ipynb , fname occurs in the second cell without defining or importing packages. So when I run this cell, it reports an error : NameError: name 'fname' is not defined. I wonder what fname means here. 1680607749032

lrsoenksen commented 1 year ago

If you look at the files updated in the Git, you will find there is no dependency on a "src" folder any longer. Also fname is the name of the single embedding files .

AliRasekh commented 1 year ago

Hi,

I also could not load your .pkl files nad I faced the error: ModuleNotFoundError: No module named 'src'. It seems that inside the pickle files there are some paths related to 'src' and it causes this problem. For example when I opened one of the pickle files, it has a content like this: '���src.MIMIC_IV_HAIM_API�� Patient_ICU���)��}�(�'

@xunmzii Could you handle and open the pickle files at the end?

@lrsoenksen Or can you generate the pickle files again with your updated code and project structure?

Thanks

lrsoenksen commented 1 year ago

Hi @AliRasekh , you have to download the Pickle files from our repo in Physionet, and then position them in the right folder to be loaded

AliRasekh commented 1 year ago

@lrsoenksen

You mean the Sample_Multimodal_Patient_Files Folder in this repo: https://www.physionet.org/content/haim-multimodal/1.0.1/ ?

lrsoenksen commented 1 year ago

Yes, and there it is described how to load them and get the embeddings from them.

AliRasekh commented 1 year ago

I have downloaded the same folder Sample_Multimodal_Patient_Files from this repo: https://www.physionet.org/content/haim-multimodal/1.0.1/

And when I want to load for example this file: 00000004.pkl I get the mentioned error: ModuleNotFoundError: No module named 'src'

And I am using the same method in your code and repo: load_patient_object I have tried both of the code versions(the one in your git repo and the jupyter notebook in the Physionet). But they do not work and I see this error.

AliRasekh commented 1 year ago

If you just put the pickle file in a repo and try to open it with your this method, you will get this error:


def load_patient_object(filepath):
    # Inputs:
    #   filepath -> Pickle file path to save object to
    #
    # Outputs:
    #   obj -> Loaded timebound ICU patient stay object

    # Overwrites any existing file.
    with open(filepath, 'rb') as input:  
        return pickle.load(input)

And as you mentioned in the project there is not src folder or directory. But the error exists.

lrsoenksen commented 1 year ago

I ignore why this is happening, but probably you can fix it by putting a copy of the API (/MIMIC_IV_HAIM_API.py) into a new folder you create in your project called "src", so that you also have the API in the folder where the pickle is complaining src/MIMIC_IV_HAIM_API.py. That should not happen at the pickle file level but that maybe a quick fix.