forked from CARE-SM/beaconAPI4CARESM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
beaconObjects.py
103 lines (78 loc) · 2.64 KB
/
beaconObjects.py
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
from typing import List, Optional, Union
from pydantic import BaseModel
## Beacon Request, same for /catalog and /individuals
class AlphanumericRequestFilterList(BaseModel):
type: str
operator: str
id: List[str]
class AlphanumericRequestFilter(BaseModel):
type: str
operator: str
id: str
class OntologyRequestFilter(BaseModel):
id: str
operator: Optional[str] = None
type: Optional[str] = None
class OntologyRequestFilterList(BaseModel):
id: List[str]
operator: Optional[str] = None
type: Optional[str] = None
class RequestQuery(BaseModel):
filters :List[Union[AlphanumericRequestFilter, OntologyRequestFilter, AlphanumericRequestFilterList, OntologyRequestFilterList]] = []
# class ReturnedSchemas(BaseModel):
# entityType: Optional[str] = None
# scheme: Optional[str] = None
class MetaContent(BaseModel):
apiVersion: str
# beaconID: Optional[str] = None
# returnedSchemas: List[ReturnedSchemas] = None NO longer a requirement
class Request(BaseModel):
meta: MetaContent
query: RequestQuery
## Catalog Response:
# class CatalogsResults(BaseModel): #TODO Beacon have added v3.0 as well.
# # id: str
# name: str
# description: str
# # externalUrl: str
# resourceTypes: str
# # organisation: str
# class ResultsetsResponseContent(BaseModel):
# id: str
# setType: str
# exists: bool
# resultsCount: int
# results: List[CatalogsResults]
# class CatalogsResponseContent(BaseModel):
# resultSets: List[ResultsetsResponseContent]
# class CatalogsResponseSummaryContent(BaseModel):
# exists: bool
# numTotalResults: int
# class CatalogsMetaResponseContent(BaseModel):
# apiVersion: str
# beaconId: str
# returnedGranularity: str
# returnedSchemas: Optional[ReturnedSchemas] = None
# class CatalogResponse(BaseModel):
# meta: CatalogsMetaResponseContent
# responseSummary: CatalogsResponseSummaryContent
# response: CatalogsResponseContent
## Individual Response:
class IndividualResponseContent(BaseModel):
exists: bool
numTotalResults: int
# class IndividualResultSets(BaseModel):
# id: str
# type: str
# exists: bool
# resultCount: int
# class IndividualsResults(BaseModel):
# resultSets: List[IndividualResultSets] ## No very well explained in the Spec
class IndividualsMetaResponseContent(BaseModel):
apiVersion: str
beaconId: str
returnedGranularity: str
class IndividualResponse(BaseModel):
meta: IndividualsMetaResponseContent
#response: IndividualsResults # Blocked due to security outcome, only counts.
responseSummary: IndividualResponseContent