refactor: update researcher API endpoints to include batch search and statistics functionality
- Removed deprecated search logic and replaced it with a new structure for handling researcher statistics. - Introduced new schemas for batch search requests and responses. - Enhanced the search endpoint to return publication statistics alongside researcher data. - Updated docker-compose file to remove unnecessary versioning.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, Field
|
||||
from uuid import UUID
|
||||
from typing import Optional, List
|
||||
from typing import Optional, List, Dict
|
||||
from datetime import datetime
|
||||
from app.schema.publication import PublicationSchema
|
||||
|
||||
@@ -14,14 +14,35 @@ class ResearcherSchema(BaseModel):
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ResearcherStatsSchema(BaseModel):
|
||||
total_publications: int
|
||||
publication_types: Dict[str, int]
|
||||
|
||||
|
||||
class ResearcherWithPublicationsSchema(BaseModel):
|
||||
researcher: ResearcherSchema
|
||||
publications: List[PublicationSchema]
|
||||
stats: ResearcherStatsSchema
|
||||
|
||||
# NUEVOS CAMPOS
|
||||
new_records: int
|
||||
updated_records: int
|
||||
unchanged_records: int
|
||||
total_records: int
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ResearcherBatchSearchRequestSchema(BaseModel):
|
||||
orcid_ids: List[str] = Field(min_length=1)
|
||||
|
||||
|
||||
class ResearcherSearchErrorSchema(BaseModel):
|
||||
orcid_id: str
|
||||
detail: str
|
||||
|
||||
|
||||
class ResearcherBatchSearchResponseSchema(BaseModel):
|
||||
results: List[ResearcherWithPublicationsSchema]
|
||||
errors: List[ResearcherSearchErrorSchema]
|
||||
total_requested: int
|
||||
total_processed: int
|
||||
|
||||
Reference in New Issue
Block a user