squirrels 0.3.3__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of squirrels might be problematic. Click here for more details.

Files changed (74) hide show
  1. {squirrels-0.3.3 → squirrels-0.4.0}/PKG-INFO +9 -21
  2. {squirrels-0.3.3 → squirrels-0.4.0}/README.md +6 -18
  3. {squirrels-0.3.3 → squirrels-0.4.0}/pyproject.toml +7 -5
  4. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/__init__.py +7 -3
  5. squirrels-0.4.0/squirrels/_api_response_models.py +141 -0
  6. squirrels-0.4.0/squirrels/_api_server.py +552 -0
  7. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/_authenticator.py +23 -22
  8. squirrels-0.4.0/squirrels/_command_line.py +122 -0
  9. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/_connection_set.py +23 -25
  10. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/_constants.py +29 -78
  11. squirrels-0.4.0/squirrels/_dashboards_io.py +61 -0
  12. squirrels-0.4.0/squirrels/_environcfg.py +84 -0
  13. squirrels-0.4.0/squirrels/_initializer.py +221 -0
  14. squirrels-0.4.0/squirrels/_manifest.py +217 -0
  15. squirrels-0.4.0/squirrels/_models.py +548 -0
  16. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/_package_loader.py +7 -8
  17. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/_parameter_configs.py +173 -141
  18. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/_parameter_sets.py +49 -38
  19. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/_py_module.py +7 -7
  20. squirrels-0.4.0/squirrels/_seeds.py +39 -0
  21. squirrels-0.4.0/squirrels/_utils.py +256 -0
  22. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/_version.py +1 -1
  23. squirrels-0.4.0/squirrels/arguments/init_time_args.py +40 -0
  24. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/arguments/run_time_args.py +89 -24
  25. squirrels-0.4.0/squirrels/dashboards.py +82 -0
  26. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/data_sources.py +212 -232
  27. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/dateutils.py +29 -26
  28. squirrels-0.4.0/squirrels/package_data/assets/index.css +1 -0
  29. squirrels-0.4.0/squirrels/package_data/assets/index.js +58 -0
  30. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/.gitignore +2 -2
  31. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/connections.yml +1 -1
  32. squirrels-0.4.0/squirrels/package_data/base_project/dashboards/dashboard_example.py +32 -0
  33. squirrels-0.4.0/squirrels/package_data/base_project/dashboards.yml +10 -0
  34. squirrels-0.4.0/squirrels/package_data/base_project/docker/.dockerignore +13 -0
  35. squirrels-0.4.0/squirrels/package_data/base_project/docker/Dockerfile +16 -0
  36. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/docker/compose.yml +1 -1
  37. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/env.yml +2 -2
  38. squirrels-0.3.3/squirrels/package_data/base_project/models/dbviews/database_view1.py → squirrels-0.4.0/squirrels/package_data/base_project/models/dbviews/dbview_example.py +2 -1
  39. squirrels-0.3.3/squirrels/package_data/base_project/models/dbviews/database_view1.sql → squirrels-0.4.0/squirrels/package_data/base_project/models/dbviews/dbview_example.sql +3 -2
  40. squirrels-0.3.3/squirrels/package_data/base_project/models/federates/dataset_example.py → squirrels-0.4.0/squirrels/package_data/base_project/models/federates/federate_example.py +6 -6
  41. squirrels-0.3.3/squirrels/package_data/base_project/models/federates/dataset_example.sql → squirrels-0.4.0/squirrels/package_data/base_project/models/federates/federate_example.sql +1 -1
  42. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/parameters.yml +6 -4
  43. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/pyconfigs/auth.py +1 -1
  44. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/pyconfigs/connections.py +1 -1
  45. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/pyconfigs/context.py +38 -10
  46. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/pyconfigs/parameters.py +15 -7
  47. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/squirrels.yml.j2 +14 -7
  48. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/templates/index.html +3 -3
  49. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/parameter_options.py +103 -106
  50. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/parameters.py +347 -195
  51. squirrels-0.4.0/squirrels/project.py +378 -0
  52. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/user_base.py +14 -6
  53. squirrels-0.3.3/squirrels/_api_response_models.py +0 -117
  54. squirrels-0.3.3/squirrels/_api_server.py +0 -378
  55. squirrels-0.3.3/squirrels/_command_line.py +0 -98
  56. squirrels-0.3.3/squirrels/_environcfg.py +0 -81
  57. squirrels-0.3.3/squirrels/_initializer.py +0 -178
  58. squirrels-0.3.3/squirrels/_manifest.py +0 -244
  59. squirrels-0.3.3/squirrels/_models.py +0 -681
  60. squirrels-0.3.3/squirrels/_seeds.py +0 -38
  61. squirrels-0.3.3/squirrels/_timer.py +0 -23
  62. squirrels-0.3.3/squirrels/_utils.py +0 -196
  63. squirrels-0.3.3/squirrels/arguments/init_time_args.py +0 -34
  64. squirrels-0.3.3/squirrels/package_data/assets/index.css +0 -1
  65. squirrels-0.3.3/squirrels/package_data/assets/index.js +0 -49
  66. squirrels-0.3.3/squirrels/package_data/base_project/docker/.dockerignore +0 -8
  67. squirrels-0.3.3/squirrels/package_data/base_project/docker/Dockerfile +0 -15
  68. {squirrels-0.3.3 → squirrels-0.4.0}/LICENSE +0 -0
  69. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/assets/favicon.ico +0 -0
  70. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/assets/expenses.db +0 -0
  71. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/assets/weather.db +0 -0
  72. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/seeds/seed_categories.csv +0 -0
  73. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/seeds/seed_subcategories.csv +0 -0
  74. {squirrels-0.3.3 → squirrels-0.4.0}/squirrels/package_data/base_project/tmp/.gitignore +0 -0
@@ -1,16 +1,15 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: squirrels
3
- Version: 0.3.3
3
+ Version: 0.4.0
4
4
  Summary: Squirrels - API Framework for Data Analytics
5
5
  Home-page: https://squirrels-analytics.github.io
6
6
  License: Apache-2.0
7
7
  Author: Tim Huang
8
8
  Author-email: tim.yuting@hotmail.com
9
- Requires-Python: >=3.9,<4.0
9
+ Requires-Python: >=3.10,<4.0
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: License :: OSI Approved :: Apache Software License
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
@@ -27,6 +26,7 @@ Requires-Dist: jinja2 (>=3.1.3,<4.0.0)
27
26
  Requires-Dist: matplotlib (>=3.8.3,<4.0.0)
28
27
  Requires-Dist: networkx (>=3.2.1,<4.0.0)
29
28
  Requires-Dist: pandas (>=2.1.4,<3.0.0)
29
+ Requires-Dist: pydantic (>=2.8.2,<3.0.0)
30
30
  Requires-Dist: pyjwt (>=2.8.0,<3.0.0)
31
31
  Requires-Dist: python-multipart (>=0.0.9,<0.0.10)
32
32
  Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
@@ -77,19 +77,7 @@ The sections below describe how to set up your local environment for squirrels d
77
77
 
78
78
  ### Setup
79
79
 
80
- This project requires python version 3.9 or above to be installed. It also uses the python build tool `poetry` which can be installed as follows.
81
-
82
- **Linux, MacOS, Windows (WSL):**
83
-
84
- ```bash
85
- curl -sSL https://install.python-poetry.org | python3 -
86
- ```
87
-
88
- **Windows (Powershell):**
89
-
90
- ```bash
91
- (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
92
- ```
80
+ This project requires python version 3.10 or above to be installed. It also uses the python build tool `poetry`. Information on setting up poetry can be found at: https://python-poetry.org/docs/.
93
81
 
94
82
  Then, to install all dependencies, run:
95
83
 
@@ -106,10 +94,10 @@ poetry shell
106
94
  To confirm that the setup worked, run the following to show the help page for all squirrels CLI commands:
107
95
 
108
96
  ```bash
109
- squirrels -h
97
+ sqrl -h
110
98
  ```
111
99
 
112
- You can enter `exit` to exit the virtual environment shell. You can also run `poetry run squirrels -h` to run squirrels commands without activating the virtual environment.
100
+ You can enter `exit` to exit the virtual environment shell. You can also run `poetry run sqrl -h` to run squirrels commands without activating the virtual environment.
113
101
 
114
102
  ### Testing
115
103
 
@@ -121,9 +109,9 @@ From the root of the git repo, the source code can be found in the `squirrels` f
121
109
 
122
110
  To understand what a specific squirrels command is doing, start from the `_command_line.py` file as your entry point.
123
111
 
124
- The library version is maintained in both the `pyproject.toml` and the `squirrels/__init__.py` files.
112
+ The library version is maintained in both the `pyproject.toml` and the `squirrels/_version.py` files.
125
113
 
126
- When a user initializes a squirrels project using `squirrels init`, the files are copied from the `squirrels/package_data/base_project` folder. The contents in the `database` subfolder were constructed from the scripts in the `database_elt` folder.
114
+ When a user initializes a squirrels project using `sqrl init`, the files are copied from the `squirrels/package_data/base_project` folder. The contents in the `database` subfolder were constructed from the scripts in the `database_elt` folder.
127
115
 
128
- For the Squirrels UI activated by `squirrels run`, the HTML, CSS, and Javascript files can be found in the `static` and `templates` subfolders of `squirrels/package_data`.
116
+ For the Squirrels UI activated by `sqrl run`, the HTML, CSS, and Javascript files can be found in the `static` and `templates` subfolders of `squirrels/package_data`. The CSS and Javascript files are minified and built from the source files in this project: https://github.com/squirrels-analytics/squirrels-testing-ui.
129
117
 
@@ -39,19 +39,7 @@ The sections below describe how to set up your local environment for squirrels d
39
39
 
40
40
  ### Setup
41
41
 
42
- This project requires python version 3.9 or above to be installed. It also uses the python build tool `poetry` which can be installed as follows.
43
-
44
- **Linux, MacOS, Windows (WSL):**
45
-
46
- ```bash
47
- curl -sSL https://install.python-poetry.org | python3 -
48
- ```
49
-
50
- **Windows (Powershell):**
51
-
52
- ```bash
53
- (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
54
- ```
42
+ This project requires python version 3.10 or above to be installed. It also uses the python build tool `poetry`. Information on setting up poetry can be found at: https://python-poetry.org/docs/.
55
43
 
56
44
  Then, to install all dependencies, run:
57
45
 
@@ -68,10 +56,10 @@ poetry shell
68
56
  To confirm that the setup worked, run the following to show the help page for all squirrels CLI commands:
69
57
 
70
58
  ```bash
71
- squirrels -h
59
+ sqrl -h
72
60
  ```
73
61
 
74
- You can enter `exit` to exit the virtual environment shell. You can also run `poetry run squirrels -h` to run squirrels commands without activating the virtual environment.
62
+ You can enter `exit` to exit the virtual environment shell. You can also run `poetry run sqrl -h` to run squirrels commands without activating the virtual environment.
75
63
 
76
64
  ### Testing
77
65
 
@@ -83,8 +71,8 @@ From the root of the git repo, the source code can be found in the `squirrels` f
83
71
 
84
72
  To understand what a specific squirrels command is doing, start from the `_command_line.py` file as your entry point.
85
73
 
86
- The library version is maintained in both the `pyproject.toml` and the `squirrels/__init__.py` files.
74
+ The library version is maintained in both the `pyproject.toml` and the `squirrels/_version.py` files.
87
75
 
88
- When a user initializes a squirrels project using `squirrels init`, the files are copied from the `squirrels/package_data/base_project` folder. The contents in the `database` subfolder were constructed from the scripts in the `database_elt` folder.
76
+ When a user initializes a squirrels project using `sqrl init`, the files are copied from the `squirrels/package_data/base_project` folder. The contents in the `database` subfolder were constructed from the scripts in the `database_elt` folder.
89
77
 
90
- For the Squirrels UI activated by `squirrels run`, the HTML, CSS, and Javascript files can be found in the `static` and `templates` subfolders of `squirrels/package_data`.
78
+ For the Squirrels UI activated by `sqrl run`, the HTML, CSS, and Javascript files can be found in the `static` and `templates` subfolders of `squirrels/package_data`. The CSS and Javascript files are minified and built from the source files in this project: https://github.com/squirrels-analytics/squirrels-testing-ui.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "squirrels"
3
- version = "0.3.3"
3
+ version = "0.4.0"
4
4
  description = "Squirrels - API Framework for Data Analytics"
5
5
  license = "Apache-2.0"
6
6
  authors = ["Tim Huang <tim.yuting@hotmail.com>"]
@@ -20,21 +20,22 @@ squirrels = "squirrels._command_line:main"
20
20
  sqrl = "squirrels._command_line:main"
21
21
 
22
22
  [tool.poetry.dependencies]
23
- python = "^3.9"
23
+ python = "^3.10"
24
24
  cachetools = "^5.3.2"
25
25
  fastapi = "^0.112.1"
26
26
  gitpython = "^3.1.41"
27
27
  inquirer = "^3.2.1"
28
28
  jinja2 = "^3.1.3"
29
+ matplotlib = "^3.8.3"
30
+ networkx = "^3.2.1"
29
31
  pandas = "^2.1.4"
32
+ pydantic = "^2.8.2"
30
33
  pyjwt = "^2.8.0"
34
+ python-multipart = "^0.0.9"
31
35
  pyyaml = "^6.0.1"
32
36
  sqlalchemy = "^2.0.25"
33
37
  uvicorn = "^0.30.6"
34
38
  duckdb-engine = { version = ">=0.13.0,<1.0.0", optional = true }
35
- matplotlib = "^3.8.3"
36
- networkx = "^3.2.1"
37
- python-multipart = "^0.0.9"
38
39
 
39
40
 
40
41
  [tool.poetry.extras]
@@ -46,6 +47,7 @@ pytest = "^7.4.4"
46
47
 
47
48
  [tool.poetry.group.dev.dependencies]
48
49
  ipykernel = "^6.29.4"
50
+ plotly = "^5.24.0"
49
51
 
50
52
  [build-system]
51
53
  requires = ["poetry-core"]
@@ -1,15 +1,19 @@
1
- __version__ = '0.3.3'
1
+ from ._version import __version__
2
2
 
3
3
  from .arguments.init_time_args import ConnectionsArgs, ParametersArgs
4
- from .arguments.run_time_args import AuthArgs, ContextArgs, ModelDepsArgs, ModelArgs
4
+ from .arguments.run_time_args import AuthArgs, ContextArgs, ModelDepsArgs, ModelArgs, DashboardArgs
5
5
 
6
6
  from .parameter_options import SelectParameterOption, DateParameterOption, DateRangeParameterOption
7
7
  from .parameter_options import NumberParameterOption, NumberRangeParameterOption, TextParameterOption
8
8
 
9
9
  from .parameters import SingleSelectParameter, MultiSelectParameter, DateParameter, DateRangeParameter
10
- from .parameters import NumberParameter, NumberRangeParameter, TextParameter
10
+ from .parameters import NumberParameter, NumberRangeParameter, TextParameter, TextValue
11
11
 
12
12
  from .data_sources import SingleSelectDataSource, MultiSelectDataSource, SelectDataSource, DateDataSource, DateRangeDataSource
13
13
  from .data_sources import NumberDataSource, NumberRangeDataSource, TextDataSource
14
14
 
15
15
  from .user_base import User, WrongPassword
16
+
17
+ from .dashboards import PngDashboard, HtmlDashboard
18
+
19
+ from .project import SquirrelsProject
@@ -0,0 +1,141 @@
1
+ from typing import Annotated
2
+ from pydantic import BaseModel, Field
3
+ from datetime import datetime, date
4
+
5
+
6
+ class LoginReponse(BaseModel):
7
+ access_token: Annotated[str, Field(examples=["encoded_jwt_token"], description="An encoded JSON web token to use subsequent API requests")]
8
+ token_type: Annotated[str, Field(examples=["bearer"], description='Always "bearer" for Bearer token')]
9
+ username: Annotated[str, Field(examples=["johndoe"], description='The username authenticated with from the form data')]
10
+ expiry_time: Annotated[datetime, Field(examples=["2023-08-01T12:00:00.000000Z"], description="The expiry time of the access token in yyyy-MM-dd'T'hh:mm:ss.SSSSSS'Z' format")]
11
+
12
+
13
+ ## Datasets / Dashboards Catalog Response Models
14
+
15
+ name_description = "The name of the dataset / dashboard (usually in snake case)"
16
+ label_description = "The human-friendly display name for the dataset / dashboard"
17
+ description_description = "The description of the dataset / dashboard"
18
+ parameters_path_description = "The API path to the parameters for the dataset / dashboard"
19
+ result_path_description = "The API path to the results for the dataset / dashboard"
20
+
21
+ class DatasetItemModel(BaseModel):
22
+ name: Annotated[str, Field(examples=["mydataset"], description=name_description)]
23
+ label: Annotated[str, Field(examples=["My Dataset"], description=label_description)]
24
+ description: Annotated[str, Field(examples=[""], description=description_description)]
25
+ parameters_path: Annotated[str, Field(examples=["/squirrels-v0/myproject/v1/dataset/mydataset/parameters"], description=parameters_path_description)]
26
+ result_path: Annotated[str, Field(examples=["/squirrels-v0/myproject/v1/dataset/mydataset"], description=result_path_description)]
27
+
28
+ class DashboardItemModel(BaseModel):
29
+ name: Annotated[str, Field(examples=["mydashboard"], description=name_description)]
30
+ label: Annotated[str, Field(examples=["My Dashboard"], description=label_description)]
31
+ description: Annotated[str, Field(examples=[""], description=description_description)]
32
+ parameters_path: Annotated[str, Field(examples=["/squirrels-v0/myproject/v1/dashboard/mydashboard/parameters"], description=parameters_path_description)]
33
+ result_path: Annotated[str, Field(examples=["/squirrels-v0/myproject/v1/dashboard/mydashboard"], description=result_path_description)]
34
+ result_format: Annotated[str, Field(examples=["png", "html"], description="The format of the dashboard's result API response (one of 'png' or 'html')")]
35
+
36
+ class CatalogModel(BaseModel):
37
+ datasets: Annotated[list[DatasetItemModel], Field(description="The list of accessible datasets")]
38
+ dashboards: Annotated[list[DashboardItemModel], Field(description="The list of accessible dashboards")]
39
+
40
+
41
+ ## Parameters Response Models
42
+
43
+ class ParameterOptionModel(BaseModel):
44
+ id: Annotated[str, Field(examples=["my_option_id"], description="The unique identifier for the option")]
45
+ label: Annotated[str, Field(examples=["My Option"], description="The human-friendly display name for the option")]
46
+
47
+ class ParameterModelBase(BaseModel):
48
+ widget_type: Annotated[str, Field(examples=["none"], description="The parameter type (set to 'none' for this model)")]
49
+ name: Annotated[str, Field(examples=["my_unique_param_name"], description="The name of the parameter. Use this as the key when providing the API request parameters")]
50
+ label: Annotated[str, Field(examples=["My Parameter"], description="The human-friendly display name for the parameter")]
51
+ description: Annotated[str, Field(examples=[""], description="The description of the parameter")]
52
+
53
+ class NoneParameterModel(ParameterModelBase):
54
+ pass
55
+
56
+ class SelectParameterModel(ParameterModelBase):
57
+ options: Annotated[list[ParameterOptionModel], Field(description="The list of dropdown options as JSON objects containing 'id' and 'label' fields")]
58
+ trigger_refresh: Annotated[bool, Field(description="A boolean that's set to true for parent parameters that require a new parameters API call when the selection changes")]
59
+
60
+ class SingleSelectParameterModel(SelectParameterModel):
61
+ widget_type: Annotated[str, Field(examples=["single_select"], description="The parameter type (set to 'single_select' for this model)")]
62
+ selected_id: Annotated[str | None, Field(examples=["my_option_id"], description="The ID of the selected / default option")]
63
+
64
+ class MultiSelectParameterModel(SelectParameterModel):
65
+ widget_type: Annotated[str, Field(examples=["multi_select"], description="The parameter type (set to 'multi_select' for this model)")]
66
+ show_select_all: Annotated[bool, Field(description="A boolean for whether there should be a toggle to select all options")]
67
+ order_matters: Annotated[bool, Field(description="A boolean for whether the ordering of the input selections would affect the result of the dataset")]
68
+ selected_ids: Annotated[list[str], Field(examples=[["my_option_id"]], description="A list of ids of the selected / default options")]
69
+
70
+ class _DateTypeParameterModel(ParameterModelBase):
71
+ min_date: Annotated[date | None, Field(examples=["2023-01-01"], description='A string in "yyyy-MM-dd" format for the minimum date')]
72
+ max_date: Annotated[date | None, Field(examples=["2023-12-31"], description='A string in "yyyy-MM-dd" format for the maximum date')]
73
+
74
+ class DateParameterModel(_DateTypeParameterModel):
75
+ widget_type: Annotated[str, Field(examples=["date"], description="The parameter type (set to 'date' for this model)")]
76
+ selected_date: Annotated[date, Field(examples=["2023-01-01"], description='A string in "yyyy-MM-dd" format for the selected / default date')]
77
+
78
+ class DateRangeParameterModel(_DateTypeParameterModel):
79
+ widget_type: Annotated[str, Field(examples=["date_range"], description="The parameter type (set to 'date_range' for this model)")]
80
+ selected_start_date: Annotated[date, Field(examples=["2023-01-01"], description='A string in "yyyy-MM-dd" format for the selected / default start date')]
81
+ selected_end_date: Annotated[date, Field(examples=["2023-12-31"], description='A string in "yyyy-MM-dd" format for the selected / default end date')]
82
+
83
+ class _NumericParameterModel(ParameterModelBase):
84
+ min_value: Annotated[float, Field(examples=[0], description="A number for the lower bound of the selectable number")]
85
+ max_value: Annotated[float, Field(examples=[10], description="A number for the upper bound of the selectable number")]
86
+ increment: Annotated[float, Field(examples=[1], description="A number for the selectable increments between the lower bound and upper bound")]
87
+
88
+ class NumberParameterModel(_NumericParameterModel):
89
+ widget_type: Annotated[str, Field(examples=["number"], description="The parameter type (set to 'number' for this model)")]
90
+ selected_value: Annotated[float, Field(examples=[2], description="A number for the selected / default number")]
91
+
92
+ class NumberRangeParameterModel(_NumericParameterModel):
93
+ widget_type: Annotated[str, Field(examples=["number_range"], description="The parameter type (set to 'number_range' for this model)")]
94
+ selected_lower_value: Annotated[float, Field(examples=[2], description="A number for the selected / default lower number")]
95
+ selected_upper_value: Annotated[float, Field(examples=[8], description="A number for the selected / default upper number")]
96
+
97
+ class TextParameterModel(ParameterModelBase):
98
+ widget_type: Annotated[str, Field(examples=["text"], description="The parameter type (set to 'text' for this model)")]
99
+ entered_text: Annotated[str, Field(examples=["sushi"], description="A string for the default entered text")]
100
+ input_type: Annotated[str, Field(
101
+ examples=["text", "textarea", "number", "date", "datetime-local", "month", "time", "color", "password"],
102
+ description='A string for the input type (one of "text", "textarea", "number", "date", "datetime-local", "month", "time", "color", or "password")'
103
+ )]
104
+
105
+ class ParametersModel(BaseModel):
106
+ parameters: list[
107
+ NoneParameterModel | SingleSelectParameterModel | MultiSelectParameterModel | DateParameterModel | DateRangeParameterModel |
108
+ NumberParameterModel | NumberRangeParameterModel | TextParameterModel
109
+ ]
110
+
111
+
112
+ ## Dataset Results Response Models
113
+
114
+ class ColumnModel(BaseModel):
115
+ name: Annotated[str, Field(examples=["mycol"], description="Name of column")]
116
+ type: Annotated[str, Field(examples=["string", "number", "integer", "boolean", "datetime"], description='Column type. One of "string", "number", "integer", "boolean", and "datetime"')]
117
+
118
+ class SchemaModel(BaseModel):
119
+ fields: Annotated[list[ColumnModel], Field(description="A list of JSON objects containing the 'name' and 'type' for each of the columns in the result")]
120
+ dimensions: Annotated[list[str], Field(examples=[["mycol"]], description="A list of column names that are dimensions")]
121
+
122
+ class DatasetResultModel(BaseModel):
123
+ data_schema: Annotated[SchemaModel, Field(alias="schema", description="JSON object describing the schema of the dataset")]
124
+ data: Annotated[list[dict], Field(
125
+ examples=[[{"mycol": "myval"}]],
126
+ description="A list of JSON objects where each object is a row of the tabular results. The keys and values of the object are column names (described in fields) and values of the row."
127
+ )]
128
+
129
+
130
+ ## Project Metadata Response Models
131
+
132
+ class ProjectVersionModel(BaseModel):
133
+ major_version: int
134
+ minor_versions: list[int]
135
+ token_path: Annotated[str, Field(examples=["/squirrels-v0/myproject/v1/token"])]
136
+ data_catalog_path: Annotated[str, Field(examples=["/squirrels-v0/myproject/v1/datasets"])]
137
+
138
+ class ProjectModel(BaseModel):
139
+ name: Annotated[str, Field(examples=["myproject"])]
140
+ label: Annotated[str, Field(examples=["My Project"])]
141
+ versions: list[ProjectVersionModel]