Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list indices must be integers or slices, not str #1

Open
rybad80 opened this issue Feb 19, 2021 · 3 comments
Open

list indices must be integers or slices, not str #1

rybad80 opened this issue Feb 19, 2021 · 3 comments

Comments

@rybad80
Copy link

rybad80 commented Feb 19, 2021

Really awesome work here....I'm trying to get this to work on a GE MUSE ECG XML file but getting this error returned when passing ecg = ECGXMLReader(data, augmentLeads=True) where data is my file path+name

@will2hew
Copy link
Owner

Are you able to share the ECG file?

@rybad80
Copy link
Author

rybad80 commented Feb 21, 2021

So unfortunately it has patient information, but I did notice that the following works, so I wonder if addressing the specific index (or looking through somehow) is required?

rawRhythmWaveformLeadI = ECG['RestingECG']['Waveform'][1]['LeadData'][0]['WaveFormData']

rawRhythmWaveformLeadII   = ECG['RestingECG']['Waveform'][1]['LeadData'][1]['WaveFormData']

rawRhythmWaveformLeadV1   = ECG['RestingECG']['Waveform'][1]['LeadData'][2]['WaveFormData']

rawRhythmWaveformLeadV2   = ECG['RestingECG']['Waveform'][1]['LeadData'][3]['WaveFormData']

rawRhythmWaveformLeadV3   = ECG['RestingECG']['Waveform'][1]['LeadData'][4]['WaveFormData']

rawRhythmWaveformLeadV4   = ECG['RestingECG']['Waveform'][1]['LeadData'][5]['WaveFormData']

rawRhythmWaveformLeadV5   = ECG['RestingECG']['Waveform'][1]['LeadData'][6]['WaveFormData']

rawRhythmWaveformLeadV6   = ECG['RestingECG']['Waveform'][1]['LeadData'][7]['WaveFormData']

rawRhythmWaveformLeadV3R  = ECG['RestingECG']['Waveform'][1]['LeadData'][8]['WaveFormData']

rawRhythmWaveformLeadV4R  = ECG['RestingECG']['Waveform'][1]['LeadData'][9]['WaveFormData']

rawRhythmWaveformLeadV7   = ECG['RestingECG']['Waveform'][1]['LeadData'][10]['WaveFormData']

@turkalpmd
Copy link

In reference to the discussion regarding errors encountered when utilizing ECGXMLReader for GE MUSE ECG XML files, I believe the pull request I submitted addresses this specific issue.

The problem appears to stem from the structure of the XML file and the way certain indices are accessed within the nested elements, as highlighted in the workaround shared in the thread. My pull request introduces improvements to handle such structural nuances dynamically, eliminating the need for manually specifying indices or workarounds.

By implementing more robust indexing logic and incorporating error handling mechanisms, the updated code ensures compatibility with various XML file structures while preserving data integrity. This should effectively resolve the errors reported and streamline the processing of ECG data from GE MUSE files.

Please feel free to review the changes in detail, and I am open to any feedback or further refinements required to ensure broader applicability.

Here is my PR :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants