DESDEO REST API
The DESDEO REST API is a FastAPI application that provides a RESTful interface to the DESDEO framework. The API is designed to be used by the DESDEO WebUI, but it can also be used by other applications. The best way to get the API
docs is to use the Swagger/Redoc UI provided by the API. You can access the Swagger UI at http://localhost:8000/docs
and the Redoc UI at http://localhost:8000/redoc
after starting the API. This assumes that the API is running on your local machine and the default port is used.
The Main Application
desdeo.api.app
Database initializer
desdeo.api.db_init
This module initializes the database.
Main Database method
desdeo.api.db
Database configuration file for the API.
Database Models
desdeo.api.db_models
All models for the API. I put them all in a single file for simplicity.
Log
Bases: Base
A model to store logs of user actions. I have no idea what to put in this table.
Source code in desdeo/api/db_models.py
Method
Bases: Base
A model to store a method and its associated data.
Source code in desdeo/api/db_models.py
MethodState
Bases: Base
A model to store the state of a method. Contains all the information needed to restore the state of a method.
Source code in desdeo/api/db_models.py
Preference
Bases: Base
A model to store user preferences provided by the DM.
Source code in desdeo/api/db_models.py
Problem
Bases: Base
A model to store a problem and its associated data.
Source code in desdeo/api/db_models.py
Results
Bases: Base
A model to store the results of a method run.
The results can be partial or complete, depending on the method. For example, NAUTILUS can return ranges instead of solutions. The overlap between the Results and SolutionArchive tables is intentional. Though if you have a better idea, feel free to change it.
Source code in desdeo/api/db_models.py
SolutionArchive
Bases: Base
A model to store a solution archive.
The archive can be used to store the results of a method run. Note that each entry must be a single, complete solution. This is different from the Results table, which can store partial results.
Source code in desdeo/api/db_models.py
User
Bases: Base
A user with a password, stored problems, role, and user group.
Source code in desdeo/api/db_models.py
UserProblemAccess
Bases: Base
A model to store user's access to problems.
Source code in desdeo/api/db_models.py
Utopia
Bases: Base
A model to store user specific information relating to Utopia problems.
Source code in desdeo/api/db_models.py
Miscellaneous dataclasses used in the database
desdeo.api.schema
Pydantic schemas for the API.
MethodProperties
Methods
ObjectiveKind
ProblemKind
Solvers
Bases: Enum
Enum of available solvers.
Source code in desdeo/api/schema.py
User
Bases: BaseModel
Model for a user. Temporary.
Source code in desdeo/api/schema.py
UserPrivileges
Bases: Enum
Enum of user privileges.
Source code in desdeo/api/schema.py
Routes provided by the API
NAUTILUS Navigator
desdeo.api.routers.NAUTILUS_navigator
Endpoints for NAUTILUS Navigator.
InitRequest
Bases: BaseModel
The request to initialize the NAUTILUS Navigator.
Source code in desdeo/api/routers/NAUTILUS_navigator.py
problem_id
class-attribute
instance-attribute
The ID of the problem to navigate.
InitialResponse
Bases: BaseModel
The response from the initial endpoint of NAUTILUS Navigator.
Source code in desdeo/api/routers/NAUTILUS_navigator.py
NavigateRequest
Bases: BaseModel
The request to navigate the NAUTILUS Navigator.
Source code in desdeo/api/routers/NAUTILUS_navigator.py
Response
Bases: BaseModel
The response from most NAUTILUS Navigator endpoints.
Contains information about the full navigation process.
Source code in desdeo/api/routers/NAUTILUS_navigator.py
init_navigator
init_navigator(init_request: InitRequest, user: Annotated[User, Depends(get_current_user)], db: Annotated[Session, Depends(get_db)]) -> InitialResponse
Initialize the NAUTILUS Navigator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
init_request
|
InitRequest
|
The request to initialize the NAUTILUS Navigator. |
required |
user
|
Annotated[User, Depends(get_current_user)]
|
The current user. |
required |
db
|
Annotated[Session, Depends(get_db)]
|
The database session. |
required |
Returns:
Name | Type | Description |
---|---|---|
InitialResponse |
InitialResponse
|
The initial response from the NAUTILUS Navigator. |
Source code in desdeo/api/routers/NAUTILUS_navigator.py
navigate
navigate(request: NavigateRequest, user: Annotated[User, Depends(get_current_user)], db: Annotated[Session, Depends(get_db)]) -> Response
Navigate the NAUTILUS Navigator.
Runs the entire navigation process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
NavigateRequest
|
The request to navigate the NAUTILUS Navigator. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
description |
HTTPException
|
description |
HTTPException
|
description |
HTTPException
|
description |
Returns:
Name | Type | Description |
---|---|---|
Response |
Response
|
description |
Source code in desdeo/api/routers/NAUTILUS_navigator.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|