Skip to content

Conversation

@shreddd
Copy link
Contributor

@shreddd shreddd commented Jun 12, 2025

Initial support for API endpoints.

Note that we aren't using the Pydantic LinkML model for BERTron yet because the DB expects things to be in GeoJSON. This is converted on ingest, but once the schema supports GeoJSON it should simplify things.

shreddd and others added 7 commits June 11, 2025 22:42
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: eecavanna <134325062+eecavanna@users.noreply.github.com>
@shreddd shreddd requested review from Copilot and jeff-cohere June 12, 2025 21:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds initial API endpoints to serve and query the MongoDB entities collection, including generic and geospatial search functionality.

  • Introduces endpoints: /bertron (list all), /bertron/find (dynamic queries), /bertron/geo/nearby, /bertron/geo/bbox, and /bertron/{id}.
  • Defines MongoDBQuery Pydantic model for flexible query parameters.
  • docker-compose.yml shows unresolved merge conflict markers that must be cleaned up.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/server.py Implements new FastAPI routes for entity retrieval and querying (generic & geo).
docker-compose.yml Contains merge conflict markers that prevent a valid YAML configuration.
Comments suppressed due to low confidence (4)

src/server.py:239

  • [nitpick] Using 'id' shadows the built-in function id and is ambiguous; consider renaming to 'entity_id' for clarity.
def get_entity_by_id(id: str):

src/server.py:56

  • This new endpoint lacks associated tests; consider adding unit tests to cover the query functionality and edge cases.
@app.post("/bertron/find")

docker-compose.yml:53

  • Unresolved merge conflict marker '<<<<<<< HEAD' in docker-compose.yml; resolve the conflict and remove these markers.
<<<<<<< HEAD

docker-compose.yml:65

  • Unresolved merge conflict marker '>>>>>>> main' in docker-compose.yml; resolve the conflict and remove these markers.
>>>>>>> main

src/server.py Outdated
Comment on lines 7 to 8
import json

Copy link

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'json' import is not used and can be removed to clean up unused imports.

Suggested change
import json

Copilot uses AI. Check for mistakes.
- mongo
# Run ingest with data dir mounted to /data
command: ["uv", "run", "python", "/app/mongodb/ingest_data.py", "--mongo-uri", "mongodb://admin:root@mongo:27017", "--input", "/data"]
<<<<<<< HEAD
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an unresolved conflict.

Copy link
Collaborator

@jeff-cohere jeff-cohere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, aside from some unresolved conflict kibble and formatting changes. I'll approve after these are fixed.

@eecavanna eecavanna changed the title Api endpoints Implement API endpoints related to fetching BERtron data Jun 12, 2025
@shreddd shreddd merged commit 382d86e into main Jun 12, 2025
2 checks passed
@shreddd shreddd deleted the api-endpoints branch June 12, 2025 21:50
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.

4 participants