Skip to content

feat: validate optional event coordinates and improve map fallback behavior#74

Open
Shivampal157 wants to merge 3 commits into
data-umbrella:mainfrom
Shivampal157:feat/map-coordinates-validation-73
Open

feat: validate optional event coordinates and improve map fallback behavior#74
Shivampal157 wants to merge 3 commits into
data-umbrella:mainfrom
Shivampal157:feat/map-coordinates-validation-73

Conversation

@Shivampal157
Copy link
Copy Markdown

Implemented issue #73 to make map mode more reliable without breaking existing event entries.

What changed

  • Added optional coordinate validation in generate_events_json.py:
    • if one of lat / lng is present, both are required
    • lat must be in [-90, 90]
    • lng must be in [-180, 180]
    • numeric values are normalized before writing JSON
  • Kept backward compatibility:
    • events without coordinates are still valid
    • geocoding still runs only when both coordinates are missing
  • Updated EventMap to render markers only for valid coordinates and use a safe center fallback.
  • Added coordinate validation unit tests (scripts/test_generate_events_json.py).
  • Updated README.md and CONTRIBUTING.md with optional lat/lng example and range rules.

Why

Map view existed, but behavior was inconsistent when coordinates were partial/invalid. This makes map behavior predictable for users and safer for maintainers adding data.

How to test

  • python scripts/test_generate_events_json.py
  • npm test -- --run
  • python scripts/generate_events_json.py
  • In UI:
    • switch to map view
    • confirm map renders markers only for valid coordinates
    • confirm empty-state fallback still appears when no valid coordinates are available

Closes #73

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 25, 2026

Deploy Preview for dueventboard ready!

Name Link
🔨 Latest commit dfeab55
🔍 Latest deploy log https://app.netlify.com/projects/dueventboard/deploys/69c63763f9c59600087d2415
😎 Deploy Preview https://deploy-preview-74--dueventboard.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Shivampal157
Copy link
Copy Markdown
Author

Hi @yuvimittal @xmnlab , could you review the PR when you have a moment? I’m happy to adjust anything you’d like changed.

@yuvimittal
Copy link
Copy Markdown
Contributor

@Shivampal157 , please add screenrecording of the working functionality

Add lat/lng pair and range validation in event generation, preserve backward compatibility for events without coordinates, and update map rendering to ignore invalid coordinates safely. Include coordinate validation unit tests and documentation updates.

Closes data-umbrella#73

Made-with: Cursor
@Shivampal157 Shivampal157 force-pushed the feat/map-coordinates-validation-73 branch from 9a1ef94 to dfeab55 Compare March 27, 2026 07:53
@Shivampal157
Copy link
Copy Markdown
Author

Shivampal157 commented Mar 27, 2026

@yuvimittal Thanks for the feedback. I’ve rebased this branch on latest upstream main and pushed the updated branch, so the check-branch CI issue should be resolved now.

Screen recording (working functionality):

6f0276ac-c174-4c76-84ac-225f2f25fbfb.1.mp4

Please re-review when you get a chance.

@Shivampal157
Copy link
Copy Markdown
Author

@yuvimittal ,plz review..

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.

[FEATURE] Make map view practical by adding optional event coordinates + validation

2 participants