MushroomObserver / mushroom-observer

A website for sharing observations of mushrooms.
https://mushroomobserver.org
MIT License
78 stars 25 forks source link

Herbarium form modal (reusable Location-creation UI) #2260

Closed nimmolo closed 1 month ago

nimmolo commented 2 months ago

Screen Shot 2024-08-06 at 11 32 11 AM

Screen Shot 2024-08-06 at 11 29 42 AM

Successfully creating a Fungarium in the modal form now populates that new fungarium in the Observation form, and allows you to continue creating the obs.

Background: on the observation form, the "Create fungarium" link kind of interrupts the flow of creating an obs.

Screen Shot 2024-08-03 at 3 07 37 PM

coveralls commented 2 months ago

Coverage Status

coverage: 93.422% (-0.04%) from 93.46% when pulling 67b7a5d017f8517df37c3fed1c30bdd8b2231961 on herbarium-form-modal into 3b7e193bc94d76d2d4fad048bc30485dcdb49e83 on main.

nimmolo commented 1 month ago

@mo-nathan @JoeCohen Please take a minute to test this manually at two places:

Fungaria is admittedly a minor use case, but I would like to roll this UI out also for Projects and User Profiles, potentially reducing a step in both of these forms.

JoeCohen commented 1 month ago

Very slick. Picks up lots of stuff automatically. Problem: clicking Create Locality does not create the Locality. So it gets stuck in the Create New Fungarium modal when trying to Create Locality while creating new Herbarium while creating an Obs. What I did:

Screenshot 2024-08-24 at 4 59 51 AM

If I close the modal, click Create New Fungarium, I'm back to the modal, where click Create does nothing.

nimmolo commented 1 month ago

Joe, I heard about all that mushroom rustling up in McMinnville, and I put two and two together, and, well... this was the only way I knew to bring the suspect to justice.

I'm afraid you'll have to wait here in the modal until the sheriff comes.

nimmolo commented 1 month ago

Thanks Joe for all the feedback. I’m just trying out the flow you did, and i get a different result, when i click “Create” on the fungarium modal:

mo-nathan commented 1 month ago

I spent a while on the Create Fungarium stuff inside the Create Observation stuff and my assessment is that it isn’t worth it. The use case I spent the most time on was creating an observation that I want to deposit at the MBLWHOI Library Herbarium (see https://mblwhoilibrary.org/special-collections/mblwhoi-library-herbarium/). The first issue I ran into is that it isn’t clear from the Create Observation UI whether the fungarium/herbarium even exists when I enter the name for it. Given that it doesn’t seem worth adding to the Create Observation workflow. Creating a fungarium should be a rare event. I don’t see the justification for making it really easy to do from the UI. Out of the 7477 herbaria in the system, only 1629 have any associated observations, and only 746 have more than one. Beyond that, the embedded location creation UI seems to be wonky. I can create this herbarium through the Create Fungaria UI and I can create the location itself through the create location UI. It’s only when it’s embedded in the Create Observation UI that it gets weird. I did a screen capture showing the weirdness and uploaded it through Slack since it's too big for GitHub.

nimmolo commented 1 month ago

I think i've resolved the Location-name-editing issue @mo-nathan discovered as well as we can.

In terms of Google Maps API's responses, our constraint here is that when we're geolocating a place name, Google only returns one (what they deem the “BEST MATCHING PLACE”) unless we use their Places API and spend an order of magnitude more credits per request.

With lat/lngs, the situation is different. Google freely returns an array of matching locations of descending specificity, and we sift through them to only show the types of locations we are interested in.

But when geolocating a place name, we don’t get any choice. If Google picks a street address, as it does when we enter

Data Library & Archives, McLean Laboratory, Woods Hole Oceanographic Institution Quissett Campus

and Google returns

360, Woods Hole Road, Woods Hole, Falmouth, Barnstable Co., Massachusetts, USA

all we can do is remove the street number component from the hash of address components. This will not change the bounding box, which is still that of the street number/address.

@mo-nathan I noticed incidentally that the mysterious number "1531" is also appended to the location if you try to geolocate "Quissett Campus" as an observation location on main, currently.

UPDATE It's the ZIP+4 code. Adding this to the list of keys ignored in recomposing addresses.

nimmolo commented 1 month ago

@mo-nathan @JoeCohen

I revised the PR description at the top with the actual priorities motivating all this work, and a description of what's reusable. Realized the original description overemphasized the fungarium creation aspect, which I agree is not very important or valuable.

nimmolo commented 1 month ago

Going to go ahead and merge this.