Skip to content

Add infores api endpoints#1162

Open
kevinschaper wants to merge 8 commits intomainfrom
infores-catalog-endpoint
Open

Add infores api endpoints#1162
kevinschaper wants to merge 8 commits intomainfrom
infores-catalog-endpoint

Conversation

@kevinschaper
Copy link
Member

@kevinschaper kevinschaper commented Jul 17, 2025

Fixes #1051

🎯 Core Changes: Added proper LinkML schema support for Information Resources

📋 Schema Changes (model.yaml & model.py)

  • Added 3 new slots: status, consumes, consumed_by for infores-specific fields
  • Added InformationResource class: Standalone class with proper slot definitions, required fields (id, status, knowledge_level,
    agent_type)
  • Regenerated Pydantic models: Complete model regeneration with updated LinkML structure

🔧 Implementation Changes

  • SolrImplementation: Updated methods to use direct unpacking (InformationResource(**doc)) instead of raw dicts
  • API Integration: Added infores router to main FastAPI app
  • Type Safety: Changed return types from Dict/List[dict] to InformationResource/List[InformationResource]
  • Clean TSV: Replaced manual TSV generation with pydantic model property access

🧪 Test Updates

  • API Tests: Updated mocks to use InformationResource instances with required fields
  • Integration Tests: Updated assertions to check pydantic model properties instead of dict keys
  • All 12 tests passing: 7 API tests + 5 integration tests

⚙️ Build/Config Changes

  • Makefile: Fixed --meta NONE parameter for gen-pydantic command
  • Dependencies: Updated LinkML version and fixed dependency groups syntax in pyproject.toml

✅ Benefits Achieved

  • Maximum Simplicity: Direct dictionary unpacking with **doc
  • Type Safety: Proper pydantic validation and OpenAPI spec generation
  • Schema Consistency: Aligned with Biolink Information Resource Registry standard
  • Clean Architecture: Standalone InformationResource class with explicit field definitions

Files Modified: 6 core files + comprehensive test updates, ~200 lines of meaningful changes after model regeneration.

@netlify
Copy link

netlify bot commented Jul 17, 2025

Deploy Preview for monarch-app canceled.

Name Link
🔨 Latest commit 3e08d89
🔍 Latest deploy log https://app.netlify.com/projects/monarch-app/deploys/687feea706574d0008845c11

…h to using the pydantic classes in the api, also update linkml and switch to the standard way of including dev packages so that they get installed with plain uv sync
@kevinschaper kevinschaper requested a review from iQuxLE July 17, 2025 05:30
@codecov
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

❌ Patch coverage is 69.59064% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.73%. Comparing base (ed8a58f) to head (3e08d89).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
backend/tests/integration/test_solr_infores.py 18.75% 39 Missing ⚠️
...rch_py/implementations/solr/solr_implementation.py 23.07% 10 Missing ⚠️
backend/src/monarch_py/api/infores.py 93.33% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1162      +/-   ##
==========================================
- Coverage   72.07%   71.73%   -0.34%     
==========================================
  Files          92       95       +3     
  Lines        3255     3404     +149     
==========================================
+ Hits         2346     2442      +96     
- Misses        909      962      +53     

☔ View full report in Codecov by Sentry.
📢 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.

@kevinschaper kevinschaper marked this pull request as ready for review July 17, 2025 21:12
@kevinschaper kevinschaper requested a review from Copilot July 18, 2025 18:47
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

This PR adds comprehensive API endpoints for Information Resources (infores) registry, implementing LinkML schema support with proper Pydantic models. The changes enable CRUD operations on information resources through RESTful endpoints with both JSON and TSV output formats.

Key Changes:

  • Added InformationResource class to LinkML schema with required fields (id, status, knowledge_level, agent_type)
  • Implemented infores API endpoints with full CRUD functionality and format support
  • Updated Solr implementation to use direct dictionary unpacking for type safety

Reviewed Changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
backend/src/monarch_py/datamodels/model.yaml Added InformationResource class definition with infores-specific slots
backend/src/monarch_py/api/infores.py New API router with catalog and individual infores endpoints
backend/src/monarch_py/implementations/solr/solr_implementation.py Added get_infores and get_infores_catalog methods
frontend/src/api/model.ts Added TypeScript interface for InformationResource
backend/tests/api/test_infores_router.py Comprehensive API tests for infores endpoints
backend/tests/integration/test_solr_infores.py Integration tests for Solr infores functionality
Comments suppressed due to low confidence (1)

backend/src/monarch_py/api/infores.py:50

  • The function name '_get_entity' is misleading as it actually retrieves an information resource, not an entity. It should be renamed to '_get_infores' to accurately reflect its purpose.
async def _get_entity(

kevinschaper and others added 2 commits July 22, 2025 13:03
…n.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

Add infores database as solr index, creat api method to expand infores content

1 participant

Comments