LorenFrankLab / spyglass

Neuroscience data analysis framework for reproducible research built by Loren Frank Lab at UCSF
https://lorenfranklab.github.io/spyglass/
MIT License
93 stars 42 forks source link

figurl-sortingview does not load/slow in loading #1079

Open shijiegu opened 2 months ago

shijiegu commented 2 months ago

Describe the bug figurl-sortingview does not load/slow in loading for newly inserted data but did load old links.

ss_key = {"nwb_file_name": nwb_copy_file_name,"sorter":"mountainsort4",
"sort_interval_name":"02_Seq2Session1","sort_group_id":0}
ss_key['curation_id'] = 1
print((sgs.CurationFigurl & ss_key).fetch("url")[0])

Using the resulting link, https://figurl.org/f?v=npm://@fi-sci/figurl-sortingview@12/dist&d=sha1://94c813b29e7f489b475b08aa2c7c885efa01a8e6&s= the view does not seem to load. It shows "waiting for data" forever.

On the contrary, old curations that I inserted last year loads instantly.

ss_key['curation_id'] = 0 # made in 2023
print((sgs.CurationFigurl & ss_key).fetch("url")[0])

https://figurl.org/f?v=gs://figurl/spikesortingview-10&d=sha1://acc66a9b2ebd4d030d785b0a9077feff0e1aa2a0&s=

I followed the tutorial notebook in inserting to sgs.CurationFigurl:

starting_curations = (sgs.Curation() & ss_key).fetch("KEY")  # you could also select any key from the sgs.Curation table here

username = "shijiegu"
fig_url_repo = f"gh://LorenFrankLab/sorting-curations/main/{username}/"  # settings for franklab members

sort_interval_name = ss_key["sort_interval_name"]
gh_url = (
    fig_url_repo
    + str(nwb_file_name + "_" + sort_interval_name)  # session id
    + "/{}"  # tetrode using auto_id['sort_group_id']
    + "/curation.json"
)  # url where the curation is stored

for auto_id in starting_curations:
    auto_curation_out_key = dict(
        **(sgs.Curation() & auto_id).fetch1("KEY"),
        new_curation_uri=gh_url.format(str(auto_id["sort_group_id"])),
    )
    sgs.CurationFigurlSelection.insert1(
        auto_curation_out_key, skip_duplicates=True
    )
    sgs.CurationFigurl.populate(auto_curation_out_key)

To Reproduce Steps to reproduce the behavior:

  1. This error is on file '....' at file path '....'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error
Error Stack ```python # Paste the error stack trace here ```

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

samuelbray32 commented 2 months ago

Just an easy check that's happened to me before: Are you sure you have the full link? The use of some characters in the figurl link causes some renderes to parse the string into a partial, incorrect hyperlink. If you click on the hyperlink generated or use copy_link you can be aiming at the wrong url address

samuelbray32 commented 2 months ago

@shijiegu was this resolved?