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

EEGAnnotationList not JSON serializable #119

Closed
scott-huberty opened this issue May 8, 2023 · 7 comments · Fixed by #199
Closed

EEGAnnotationList not JSON serializable #119

scott-huberty opened this issue May 8, 2023 · 7 comments · Fixed by #199
Labels
bug Something isn't working
Milestone

Comments

@scott-huberty
Copy link
Member

scott-huberty commented May 8, 2023

There is a silent failure when serving the QC dashboard:

  File "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type EEGAnnotationList is not JSON serializable

I think EEGAnnotationList.annotations is a pandas series where it should be a dictionary (see this thread). This is necessary because EEGAnnotationsList is wrapped in a dcc.Store component.

I spent the weekend in a battle to deploy the dashboard to a PAAS service (Heroku/Google Cloud/Azure) to no avail. After exhausting all other avenues, I have a hunch this is the underlying issue.

I expect that deploying to a PAAS service won't be possible until this is corrected.

@christian-oreilly
Copy link
Collaborator

A full stack error would be more useful than just the last lines. Note that, in the end, we don't need the dcc.Store... this could just be replaced by a plain old dictionary I think.

@scott-huberty scott-huberty added the bug Something isn't working label May 10, 2023
@christian-oreilly christian-oreilly added this to the 0.03 milestone Dec 9, 2024
@christian-oreilly christian-oreilly linked a pull request Dec 10, 2024 that will close this issue
@christian-oreilly
Copy link
Collaborator

It is currently unclear how to reproduce this issue. In #199, I created a code to test EEGAnnotationList, but I'd like to understand when and how the serialization gets triggered in the operation of Dash to create this issue. It is currently unclear, so it is unclear what is the best path to solve this issue.

@christian-oreilly
Copy link
Collaborator

Maybe implementing #46 could give us an opportunity to trigger that bug. Before doing this, we need to fix #185 to allow running tests using our test data.

@christian-oreilly
Copy link
Collaborator

I suggest to close this with PR #199. This PR makes a fair attempt at triggering this issue, but without more information, I cannot reproduce. The EEGAnnotationsList is not JSON serializable as is and making it intrinsically serializable is probably not the way to go. It is more common to add for example a to_json method which returns a JSON string for the object. However, implementing such an approach requires being able to trigger the issues, and testing what circumstances make the software crash. I propose to close this issue with PR #199 and reopen if/when we can reproduce it. So far, Dash tests do not trigger this issue.

@scott-huberty
Copy link
Member Author

Sorry - It's been too long for me to remember how to trigger it (and thanks for taking the time for trying to do so).

Next time I am using the dashboard, I will see if I can reproduce, and will open it up if necessary.

@scott-huberty
Copy link
Member Author

And yes feel free to close.

@christian-oreilly
Copy link
Collaborator

Sorry - It's been too long for me to remember how to trigger it (and thanks for taking the time for trying to do so)

No problem. I figured that it was probably the case. Hence why I proposed to close at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants