CalCOFI / apps

Shiny app demo for CalCOFI
https://calcofi.io
MIT License
0 stars 0 forks source link

oceano app: "no observations were found"; + log all queries w/ response stats; + Shiny bookmark query state #24

Open bbest opened 7 months ago

bbest commented 7 months ago

from @evsatt:

I have been wanting to share Oceano's app with some of the folks I have been meeting about regarding utility for long term patterns related to Offshore Wind (e.g., showing a trend over time for temperature). But I can't easily get the CalCOFI data to load - it says "sorry no obs found". Am I doing something wrong?

image

This points to the very real need to:

bbest commented 7 months ago

Hi @evsatt ,

Sorry about the issue here, which I'm having trouble understanding and replicating. I see a contoured surface map, so not sure if it was for a different area or other setting not visible when you clicked Update. This points to the very real need to log all queries and basic stats on the response, but particularly for those queries which fail and need to be debugged. And ideally to also add a copy link button to return to the app in the same state (possible with Shiny Bookmarking).

Here's what I was able to successfully generate:

Screenshot 2023-11-29 at 10 51 27 AM

And some of the outputs from the bottom Downloads links:

oceano-app_query-5800caf2.zip

evsatt commented 7 months ago

Thanks! So it’s weird, I also can get the contour map (but it still has that repot message below (maybe residual). But I am trying to create a time series too and that gives an error too. Can send a screen shot if needed.

On Wed, Nov 29, 2023 at 8:55 AM Ben Best @.***> wrote:

Hi @evsatt https://urldefense.com/v3/__https://github.com/evsatt__;!!Mih3wA!Etve7mN5wPEc6s4V6xoR5jYsv9OGR9KuQZZ0_OG0fVKy1oA8y6cW8M6CZ2sssKnHtVUal_uSrJKqh2sBijFk4-FV8U9Few$ ,

Sorry about the issue here, which I'm having trouble understanding and replicating. I see a contoured surface map, so not sure if it was for a different area or other setting not visible when you clicked Update. This points to the very real need to log all queries and basic stats on the response, but particularly for those queries which fail and need to be debugged. And ideally to also add a copy link button to return to the app in the same state (possible with Shiny Bookmarking https://urldefense.com/v3/__https://mastering-shiny.org/action-bookmark.html__;!!Mih3wA!Etve7mN5wPEc6s4V6xoR5jYsv9OGR9KuQZZ0_OG0fVKy1oA8y6cW8M6CZ2sssKnHtVUal_uSrJKqh2sBijFk4-E1tBda6Q$ ).

Here's what I was able to successfully generate:

Screenshot.2023-11-29.at.10.51.27.AM.png (view on web) https://urldefense.com/v3/__https://github.com/CalCOFI/apps/assets/2837257/6697111b-ac4a-4f6b-a78f-992cb63b0478__;!!Mih3wA!Etve7mN5wPEc6s4V6xoR5jYsv9OGR9KuQZZ0_OG0fVKy1oA8y6cW8M6CZ2sssKnHtVUal_uSrJKqh2sBijFk4-GbzsDJ3A$

And some of the outputs from the bottom Downloads links:

oceano-app_query-5800caf2.zip https://urldefense.com/v3/__https://github.com/CalCOFI/apps/files/13502652/oceano-app_query-5800caf2.zip__;!!Mih3wA!Etve7mN5wPEc6s4V6xoR5jYsv9OGR9KuQZZ0_OG0fVKy1oA8y6cW8M6CZ2sssKnHtVUal_uSrJKqh2sBijFk4-HUbNINlQ$

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/CalCOFI/apps/issues/24*issuecomment-1832185480__;Iw!!Mih3wA!Etve7mN5wPEc6s4V6xoR5jYsv9OGR9KuQZZ0_OG0fVKy1oA8y6cW8M6CZ2sssKnHtVUal_uSrJKqh2sBijFk4-ERp2A6XQ$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AD356WJVLXNFLZBOAG4RRLTYG5LGVAVCNFSM6AAAAAA77WHPD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZSGE4DKNBYGA__;!!Mih3wA!Etve7mN5wPEc6s4V6xoR5jYsv9OGR9KuQZZ0_OG0fVKy1oA8y6cW8M6CZ2sssKnHtVUal_uSrJKqh2sBijFk4-EfQriCZg$ . You are receiving this because you were mentioned.Message ID: @.***>

bbest commented 7 months ago

Yes please! I'll try to have this sorted by our meeting Wednesday

evsatt commented 7 months ago

Here is the error message: [image: image.png]

Also, when I do get it to work with a different area, the year increments are incorrect (e.g., for "year" should have whole years not halves too).

On Wed, Nov 29, 2023 at 8:17 AM Ben Best @.***> wrote:

Yes please! I'll try to have this sorted by our meeting Wednesday

— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/CalCOFI/apps/issues/24*issuecomment-1832226443__;Iw!!Mih3wA!CKkSi5Kwce4LsF1K7ASMS4MfZVU_XSUVdBlSc5lUCfCccA-gt-DcITpexjarBntv-4ojw50X729Uq4_kQpCYCQifh4h67g$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AD356WLTK6AEFTV3W4XBBWDYG5N2FAVCNFSM6AAAAAA77WHPD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZSGIZDMNBUGM__;!!Mih3wA!CKkSi5Kwce4LsF1K7ASMS4MfZVU_XSUVdBlSc5lUCfCccA-gt-DcITpexjarBntv-4ojw50X729Uq4_kQpCYCQiorejAaQ$ . You are receiving this because you were mentioned.Message ID: @.***>

--


Erin Satterthwaite | she/her
Marine Ecologist & Sustainability Researcher
CalCOFI Program Coordinator
UC San Diego - Scripps Institution of Oceanography
California Sea Grant & CalCOFI
9500 Gilman Dr., La Jolla, CA 92093-0232
*work: *(858) 380-5835

*Play is the highest form of research *
                                 *   ~Albert Einstein*
bbest commented 7 months ago

Shiny Bookmarking in URL

Now the URL in the browser's location bar gets updated as the user changes input values, so the URL can be shared to return to the same state.

References:

Here are the URLs for two maps with entirely different inputs:

  1. initial URL decoded: https://shiny.calcofi.io/oceano/?_inputs_&

    • aoi_cat="CalCOFI Zones"&
    • aoi_ewkt=null&
    • aoi_keys=["cc_nearshore-extended","cc_offshore-extended","cc_nearshore-standard","cc_offshore-standard"]&
    • aoi_rows=[1,2,5,6]&
    • hash="ffefc04c"&
    • map_center={"lng":-122.080078125,"lat":33.9068955512887}&
    • map_init=true&
    • map_zoom=6&
    • mapedit_counter=1&
    • num_depth_bins=10&
    • sel_date_range=["2015-01-25","2020-01-26"]&
    • sel_depth_range=[0,515]&
    • sel_qtr=["1","2"]&
    • sel_time_step="year"&
    • sel_val="avg"&
    • sel_var="ctd_bottles.t_degc"&
    • tabs="map" image
  2. modified%22&tbl_places_init=true&aoi_keys=null&hash=%220885655b%22&map_init=true&mapedit_counter=2&aoi_cat=%22CalCOFI%20Zones%22) URL decoded: https://shiny.calcofi.io/oceano/?_inputs_&

    • aoi_cat="CalCOFI Zones"
    • aoi_keys=null&
    • aoi_ewkt="SRID=4326;POLYGON ((-122.239895 34.052659, -120.120392 32.915188, -120.952606 34.803091, -122.239895 34.052659))"&
    • aoi_rows=null&
    • hash="0885655b"&
    • map_zoom=7&
    • map_center={"lng":-121.1801435,"lat":33.8643573446832}&
    • num_depth_bins=10&
    • sel_date_range=["2010-01-01","2019-01-01"]&
    • sel_depth_range=[120,1000]&
    • sel_place_category="CalCOFI Zones"&
    • sel_qtr=["3","4"]&
    • sel_time_step="year"&
    • sel_val="avg"&
    • sel_var="ctd_bottles.salinity"&
    • tabs="map"&
    • map_init=true&
    • mapedit_counter=2& image
bbest commented 7 months ago

Logging with logger or loggit

Not sure logging is necessary now with bookmarkable URL, but # comments for logger and loggit included.

https://github.com/CalCOFI/apps/blob/560187feec4ccf91649f7b820df2fca498c4d058/oceano/global.R#L8-L18

https://github.com/CalCOFI/apps/blob/560187feec4ccf91649f7b820df2fca498c4d058/libs/functions.R#L339-L363

Skipping shinylogs since logging excessive and not customizable.

Surprisingly the client's IP address is not included in Shiny's session$clientData so can't easily include in log:

bbest commented 7 months ago

Logging with Google Analytics

a bit complicated ...