Skip to content

feat(geo): extract country from geo locations and add world map - #822

Merged
vcnainala merged 8 commits into
developmentfrom
feat/695-geo-location-country-extraction
Jun 23, 2026
Merged

vcnainala merged 8 commits into
developmentfrom
feat/695-geo-location-country-extraction

Conversation

@vcnainala

@vcnainala vcnainala commented Jun 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add rule-based country extraction from geo_locations.name with configurable aliases, Mexican state heuristics, and Nominatim geocoding fallback
  • Centralize geo location creation in GeoLocationService and enrich country metadata during imports
  • Add coconut:enrich-geo-locations artisan command for backfilling existing records
  • Add public /globe choropleth page visualizing molecule, organism, and geo-location counts by country

Closes #695

Implementation notes

  • Uses rinvex/countries (already in the project) for ISO codes and flag emoji
  • Bulk imports use rules-only enrichment; geocoding is deferred to the backfill command to avoid API rate limits
  • Nominatim is used instead of Google Places API for open geocoding with caching and rate limiting

Test plan

  • ./vendor/bin/sail test tests/Unit/GeoLocationCountryExtractorTest.php tests/Unit/NominatimGeocoderTest.php
  • ./vendor/bin/sail artisan coconut:enrich-geo-locations --dry-run --rules-only
  • ./vendor/bin/sail artisan coconut:enrich-geo-locations --rules-only
  • Visit /globe and verify choropleth, metric toggles, and hover panel
  • Confirm new imports populate country_code via GeoLocationService

vcnainala added 6 commits June 8, 2026 21:41
Relax unique-name validation in the request-changes organism repeater so
users can link organisms that already exist in the database. Reject names
already attached to the target molecule instead.

Fixes #772
Align Filament v4 Select option keys with stored state for existing
synonyms, CAS, geo locations, organisms, and citations. Resolve the
target molecule from form state and report records so options remain
valid on Livewire submit requests.

Fixes #775
Use explicit null checks for molecule synonyms/CAS options and remove
unreachable is_string handling for mol_ids array cast.
Introduce rule-based country parsing from geo location names with
Nominatim fallback, backed by config-driven aliases and unit tests.

Refs #695
Centralize geo location creation in GeoLocationService and add
coconut:enrich-geo-locations for backfilling country metadata.

Refs #695
Add a public /globe page with country-level molecule, organism, and
geo-location stats using globe.gl choropleth visualization.

Refs #695
@codecov-commenter

codecov-commenter commented Jun 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.92937% with 132 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.43%. Comparing base (a4c26c6) to head (f02de2a).
⚠️ Report is 22 commits behind head on development.

Files with missing lines Patch % Lines
app/Services/GeoLocationGlobeStatsService.php 0.00% 38 Missing ⚠️
app/Services/GeoLocationEnricher.php 0.00% 25 Missing ⚠️
app/Services/GeoLocationService.php 0.00% 18 Missing ⚠️
app/Services/NominatimGeocoder.php 75.67% 18 Missing ⚠️
app/Services/GeoLocationEnrichmentResult.php 14.28% 12 Missing ⚠️
app/Services/GeoLocationCountryExtractor.php 88.63% 10 Missing ⚠️
app/Livewire/GeoGlobe.php 0.00% 6 Missing ⚠️
app/Jobs/ImportEntryAuto.php 0.00% 3 Missing ⚠️
...pp/Filament/Dashboard/Resources/ReportResource.php 0.00% 1 Missing ⚠️
app/Jobs/ImportEntry.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##             development     #822       +/-   ##
==================================================
+ Coverage           6.14%   22.43%   +16.28%     
- Complexity          1736     2333      +597     
==================================================
  Files                227      260       +33     
  Lines               8945    11035     +2090     
==================================================
+ Hits                 550     2476     +1926     
- Misses              8395     8559      +164     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Resolve conflicts keeping geo globe/nominatim features alongside
development tree-of-life, organism taxonomy, Scalar CSP, and blog nav.
Regenerate lockfile from development base so CI npm ci includes
@rollup/rollup-linux-x64-gnu alongside globe.gl dependencies.
@vcnainala
vcnainala merged commit 280039f into development Jun 23, 2026
6 checks passed
@vcnainala
vcnainala deleted the feat/695-geo-location-country-extraction branch June 23, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants