-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
108 lines (81 loc) · 2.58 KB
/
schemas.py
File metadata and controls
108 lines (81 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
"""
Pydantic schemas for pyplots API.
Centralized schema definitions for request/response models.
"""
from typing import Optional
from pydantic import BaseModel
class ImplementationResponse(BaseModel):
"""Implementation details for a single library."""
library_id: str
library_name: str
preview_url: Optional[str] = None
preview_thumb: Optional[str] = None
preview_html: Optional[str] = None
quality_score: Optional[float] = None
code: Optional[str] = None
generated_at: Optional[str] = None
generated_by: Optional[str] = None
python_version: Optional[str] = None
library_version: Optional[str] = None
# Review fields
review_strengths: list[str] = []
review_weaknesses: list[str] = []
review_image_description: Optional[str] = None
review_criteria_checklist: Optional[dict] = None
review_verdict: Optional[str] = None
class SpecDetailResponse(BaseModel):
"""Detailed spec response with implementations."""
id: str
title: str
description: Optional[str] = None
applications: list[str] = []
data: list[str] = []
notes: list[str] = []
tags: Optional[dict] = None
issue: Optional[int] = None
suggested: Optional[str] = None
created: Optional[str] = None
updated: Optional[str] = None
implementations: list[ImplementationResponse] = []
class SpecListItem(BaseModel):
"""Spec list item with summary info."""
id: str
title: str
description: Optional[str] = None
tags: Optional[dict] = None
library_count: int = 0
class ImageResponse(BaseModel):
"""Image/plot response for grid display."""
spec_id: str
library: str
url: Optional[str] = None
thumb: Optional[str] = None
html: Optional[str] = None
code: Optional[str] = None
class FilterCountsResponse(BaseModel):
"""Counts for filter categories."""
lib: dict[str, int] = {}
spec: dict[str, int] = {}
plot: dict[str, int] = {}
data: dict[str, int] = {}
dom: dict[str, int] = {}
feat: dict[str, int] = {}
class FilteredPlotsResponse(BaseModel):
"""Response for filtered plots endpoint."""
total: int
images: list[dict] # Using dict for flexibility, could be list[ImageResponse]
counts: dict
globalCounts: dict
orCounts: list[dict]
class LibraryInfo(BaseModel):
"""Library information."""
id: str
name: str
version: Optional[str] = None
documentation_url: Optional[str] = None
description: Optional[str] = None
class StatsResponse(BaseModel):
"""Platform statistics."""
specs: int
plots: int
libraries: int