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

Latitude and Longitude coordinates without matching Lat1text and Long1text coordinate fields appear empty #5365

Open
grantfitzsimmons opened this issue Nov 1, 2024 · 0 comments · May be fixed by #5368
Labels
1 - Bug Incorrect behavior of the product 2 - Forms Issues that are related to the form system Migration Prs that contain migration

Comments

@grantfitzsimmons
Copy link
Member

Describe the bug
Latitude and Longitude coordinates without matching Lat1text and Long1text coordinate fields appear empty on the form, possibly leading to data loss when saved.

Though this is something that shouldn't happen anymore, we should create a migration to resolve this in all databases.

Solution:

/*
There are cases from Specify 6 where Longitude and Latitude are captured as decimal values but
the accompanying text fields are not populated. In cases where the text fields are not populated,
it appears the records do not have coordinates. This script will populate the text fields with the
decimal values where the text fields are empty but the decimal values are not.
*/

UPDATE locality
SET Lat1text = Latitude1
WHERE Lat1text IS NULL AND Latitude1 IS NOT NULL;

UPDATE locality 
SET Long1text = Longitude1 
WHERE Long1text IS NULL AND Longitude1 IS NOT NULL;

UPDATE locality
SET Lat2text = Latitude2
WHERE Lat2text IS NULL AND Latitude2 IS NOT NULL;

UPDATE locality 
SET Long2text = Longitude2 
WHERE Long2text IS NULL AND Longitude2 IS NOT NULL;

More Context:

I've found that records with missing data in Lat1text and Long1text won't render in S7, but do contain values in Latitude1 and Longitude1. Records with data in Lat1text and Long1text Latitude1 and Longitude1 and render correctly in S7.

It appears that a significant number of herbarium records have this issue, and many of them haven’t been edited in years, indicating that the data quality problem may date back quite some time.

In my ongoing investigation, I've identified a total of 33,664 herbarium locality records that contain data in Latitude1 and Longitude1 but are missing values in Lat1text and Long1text. All of these records were imported into the database in 2016 or 2017, indicating that this mismapping likely occurred during the upload process in Specify.

To Reproduce
Steps to reproduce the behavior:

  1. Delete the Lat1text and Long1text values for a particular record with a pair of coordinates using SQL
  2. Open the Locality form
  3. See that the coordinates are not visible

Issue Summary:

We’re experiencing an issue with LatLonUI field values displaying correctly in Specify 6 but not in Specify 7 in one database (herbarium). Here’s what’s happening:

  • In Specify 6 (Java-based), LatLonUI values display properly in both BotViews and EntoViews.
  • In Specify 7 (web-based), the LatLonUI fields show up, and the values populate correctly in EntoViews, but the values are blank in BotViews

What We’ve Found So Far:

  1. The records in question definitely have LatLonUI values, as they display correctly in Specify.
  2. The XML form view between the two views (Ento, Bot) appears nearly the same.
  3. However, in Specify 7, the JSON response from the server includes the LatLon values for EntoViews, but doesn’t include the LatLonUI fields or values at all for BotViews.

Request: Could you help us determine why these values aren’t showing up in Specify 7 for the herbarium database? We’re wondering if there’s a difference in how data is sent to the web app, like filtering or permissions, that’s causing this.

Reported By
Garth at The University of Michigan
Paul at College of Idaho
and several others

@grantfitzsimmons grantfitzsimmons added 1 - Bug Incorrect behavior of the product Migration Prs that contain migration 2 - Forms Issues that are related to the form system labels Nov 1, 2024
grantfitzsimmons added a commit that referenced this issue Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product 2 - Forms Issues that are related to the form system Migration Prs that contain migration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant