Skip to content

Commit

Permalink
changes for 24.12 version
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Dec 5, 2024
1 parent 7cb1b07 commit 6e9347e
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 160 deletions.
28 changes: 27 additions & 1 deletion developer-guide/03-Background jobs/03-avoiding-od.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,33 @@ class JustPause(BackgroundJobWithDodgingContrib):

```

3. We also want some "buffer" time before and after an OD reading. For example, if using a bubbler, we want the bubbles to dissipate completely before taking an OD reading. We should stop bubbling early then. To set these times, add the following to your config.ini:
3. You should also consider what the job should do if OD reading isn't turned on. That is, what should the default behaviour be without OD reading. Also, what should occur when the OD reading is turned on _late_.

You can handle the "dodging" case and "continuous" with the `initialize_*` methods:

```python
class JustPause(BackgroundJobWithDodgingContrib):

...

def initialize_dodging_operation(self):
self.logger("OD reading is ON and I'm enabled for dodging, so set up what I need...")

def initialize_continuous_operation(self):
self.logger("OD reading is off, or being ignored, so set up what I need for that...")

def action_to_do_before_od_reading(self):
# example
self.logger.debug("Pausing")
self.stop_pumping()

def action_to_do_after_od_reading(self):
# example
self.logger.debug("Unpausing")
self.start_pumping()
```

4. We also want some "buffer" time before and after an OD reading. For example, if using a bubbler, we want the bubbles to dissipate completely before taking an OD reading. We should stop bubbling early then. To set these times, add the following to your config.ini:

```
[<job_name>]
Expand Down
29 changes: 28 additions & 1 deletion developer-guide/07-Plugins/03-plugin-as-python-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ fields:

There are lots of examples of automation yaml files [here](https://github.com/Pioreactor/pioreactorui/tree/master/contrib/automations).

#### 5. Optional: adding tables to the SQL store
#### 5. Optional: adding tables to the SQL database and exposing them on the Export Data page

You can also add a file called `additional_sql.sql` that will run against the SQLite database. For example, a CO₂ sensor may want to create a new table in the database to store its sensor data. It's `additional_sql.sql` may look like:

Expand Down Expand Up @@ -267,6 +267,33 @@ include <PLUGIN_NAME>/additional_sql.sql

See an example plugin that uses this idea [here](https://github.com/Pioreactor/co2-reading-plugin).

----

Now that you've added the code for adding to the database, you can also allow users to export your data from the UI's Export Data page. To do this, added a new folder `/exportable_datasets` to your project's source folder (along side the `__init__.py` file), and add a YAML file:

```yaml
dataset_name: some_unique_dataset_name
default_order_by: timestamp # for example
description: A lovely description which shows up in the UI
display_name: A lovely name which shows up in the UI
has_experiment: true # does your SQL table have an experiment column.?
has_unit: true # does your SQL table have an pioreactor_unit column.?
source: your_plugin_name
table: the_target_table # see also query below
timestamp_columns:
- timestamp
always_partition_by_unit: false
query: SELECT * FROM the_target_table WHERE reading < 4 AND ... # optional: you can specify a query.
```
You can add multiple dataset YAML files, too.
:::note
Include the following in your MANIFEST.IN:
```
recursive-include your_plugin_name/exportable_datasets *.yaml
```
:::

#### 6. Optional: adding a custom chart to the UI

Expand Down
23 changes: 23 additions & 0 deletions developer-guide/20-User interface/04-adding-datasets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Adding datasets to the Export Data page
slug: /dataset-to-ui
---

You can allow users to export your data from the UI's Export Data page. To do this, add a YAML file to `~/.pioreactor/plugins/exportable_datasets` with the following information:

```yaml
dataset_name: some_unique_dataset_name
default_order_by: timestamp # for example
description: A lovely description which shows up in the UI
display_name: A lovely name which shows up in the UI
has_experiment: true # does your SQL table have an experiment column.?
has_unit: true # does your SQL table have an pioreactor_unit column.?
source: app
table: the_target_table # see also query below
timestamp_columns:
- timestamp
always_partition_by_unit: false
query: SELECT * FROM the_target_table WHERE reading < 4 AND ... # optional: you can specify a query.
```
After adding this file, visit the Export Page in the UI.
6 changes: 3 additions & 3 deletions developer-guide/30-Development/01-local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ slug: /local-development
pip3 install -e .
pip3 install -r requirements/requirements_dev.txt
```
4. In the pioreactor folder, create a folder called `.pioreactor/` and `.pioreactor/storage`.
4. In the pioreactor folder, create a folder called `.pioreactor/` and other important subdirectories.
```
mkdir .pioreactor
mkdir .pioreactor/storage
mkdir .pioreactor/storage .pioreactor/plugins .pioreactor/exportable_datasets
```
5. The configuration file that is used is `config.dev.ini`, and is provided in the repository.
5. The configuration file that is used is `config.dev.ini`, and is provided in the repository. Move this to `.pioreactor/`.
### MQTT
Expand Down
155 changes: 11 additions & 144 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@docusaurus/theme-classic": "^3.0.1",
"@docusaurus/theme-common": "^3.0.1",
"@easyops-cn/docusaurus-search-local": "^0.38.1",
"@emeraldpay/hashicon-react": "^0.5.2",
"@mdx-js/react": "^3.0.0",
"@svgr/webpack": "^5.5.0",
"clsx": "^1.1.1",
Expand All @@ -31,7 +30,8 @@
"rehype-katex": "^7.0.0",
"rehype-math": "^0.2.0",
"remark-math": "^6.0.0",
"url-loader": "^4.1.1"
"url-loader": "^4.1.1",
"boring-avatars": "^1.11.2"
},
"browserslist": {
"production": [
Expand Down
19 changes: 12 additions & 7 deletions src/components/HomepageFeatures.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,28 @@
width: auto;
margin-bottom: 10px;
transition: transform 0.4s ease, fill 0.4s ease;
}

.featureSvg, .featureCard {
transition: transform 0.3s ease, box-shadow 0.3s ease, fill 0.3s ease;
}

.featureCard {
transition: transform 0.4s ease, box-shadow 0.4s ease;
border-radius: 8px; /* Optional: for rounded corners */
padding: 16px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
border-radius: 8px;
padding: 24px; /* Increased padding for more breathing room */
text-align: center; /* Ensure content stays centered */
}


.featureCard:hover {
transform: translateY(-2px); /* Less lift */
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1); /* Softer shadow */
transform: translateY(-1px); /* Slight hover effect */
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.08); /* Softer shadow */
}


.featureCard:hover .featureSvg {
transform: scale(1.05); /* Slightly smaller scale */
fill: #FFB84D; /* Subtle color change */
transform: scale(1.03); /* Even smaller scale */
fill: #FFCC80; /* Softer, lighter color */
}

Loading

0 comments on commit 6e9347e

Please sign in to comment.