Skip to content

Commit

Permalink
Merge branch 'release-v0.30.0' into 'master'
Browse files Browse the repository at this point in the history
Release v0.30.0

See merge request Scientific-IT-Systems/SampleDB!1176
  • Loading branch information
danielkaiser committed Dec 9, 2024
2 parents 178ea2a + 5a202b9 commit 388d734
Show file tree
Hide file tree
Showing 85 changed files with 3,013 additions and 637 deletions.
18 changes: 9 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ variables:
test:
stage: test
needs: []
image: python:3.11-slim-bookworm
image: python:3.12-slim-bookworm
services:
- name: postgres:12
- name: postgres:15
alias: postgres-test
variables:
POSTGRES_HOST: postgres-test
Expand Down Expand Up @@ -52,7 +52,7 @@ test:
analyze:
stage: test
needs: []
image: python:3.11-slim-bookworm
image: python:3.12-slim-bookworm
script:
- apt-get update
# set up Python 3
Expand All @@ -63,7 +63,7 @@ analyze:
- python3 -m pyflakes sampledb
# install requirements to allow pylint and mypy to import them
- python3 -m pip install -r requirements.txt
- python3 -m pylint --score no --disable=R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R0916,R1702,R1704,R1705,R1711,R1720,R1721,R1723,R1724,R1730,R1731,C0103,C0112,C0114,C0115,C0116,C0123,C0301,C0302,C0413,C0415,W0212,W0511,W1202,W0603,W0613,W0621,W0622,W0703,W0707,E1101,E0213,E1136 --load-plugins=pylint.extensions.docparams sampledb/
- python3 -m pylint --score no --disable=R0401,R0801,R0902,R0903,R0911,R0912,R0913,R0914,R0915,R0916,R0917,R1702,R1704,R1705,R1711,R1720,R1721,R1723,R1724,R1730,R1731,C0103,C0112,C0114,C0115,C0116,C0123,C0301,C0302,C0413,C0415,W0212,W0511,W1202,W0603,W0613,W0621,W0622,W0703,W0707,E1101,E0213,E1136 --load-plugins=pylint.extensions.docparams sampledb/
- MYPYPATH=./stubs python3 -m mypy --strict --ignore-missing-imports --follow-imports=silent sampledb/

analyze-js:
Expand All @@ -80,7 +80,7 @@ analyze-js:
.template-check-migrations:
stage: test
needs: []
image: python:3.11-slim-bookworm
image: python:3.12-slim-bookworm
script:
# define environment variables needed for SampleDB demo
- export [email protected]
Expand Down Expand Up @@ -220,9 +220,9 @@ check-translations:
documentation:
stage: test
needs: []
image: python:3.11-slim-bookworm
image: python:3.12-slim-bookworm
services:
- name: postgres:12
- name: postgres:15
alias: postgres-documentation
variables:
POSTGRES_HOST: postgres-documentation
Expand Down Expand Up @@ -277,7 +277,7 @@ test-container-status:
-e POSTGRES_DB=postgres
-e POSTGRES_USER=postgres
-e POSTGRES_PASSWORD=postgres
postgres:12
postgres:15
- sleep 5 # allow container to start
- docker ps
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
Expand Down Expand Up @@ -407,7 +407,7 @@ deploy-to-dockerhub:

deploy-to-pypi:
stage: deploy
image: python:3.11-slim-bookworm
image: python:3.12-slim-bookworm
only:
- tags@Scientific-IT-Systems/SampleDB
script:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dockerfile for sampledb
FROM python:3.11-slim-bookworm as builder
FROM python:3.12-slim-bookworm as builder

# Install required system packages
# GCC is required to build python dependencies on ARM architectures
Expand Down Expand Up @@ -27,7 +27,7 @@ COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Final image
FROM python:3.11-slim-bookworm
FROM python:3.12-slim-bookworm

LABEL maintainer="[email protected]"
LABEL org.opencontainers.image.source=https://github.com/sciapp/sampledb
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ docker run \
-v `pwd`/pgdata:/var/lib/postgresql/data/pgdata:rw \
--restart=always \
--name sampledb-postgres \
postgres:12
postgres:15
```

Next, start the SampleDB container:
Expand All @@ -63,7 +63,7 @@ docker run \
--restart=always \
--name sampledb \
-p 8000:8000 \
sciapp/sampledb:0.29.1
sciapp/sampledb:0.30.0
```

### Once it's started
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: '3'

services:
web:
image: sciapp/sampledb:0.29.1
image: sciapp/sampledb:0.30.0
restart: always
container_name: sampledb
# Note: this config option works with docker-compose version >1.27
Expand All @@ -32,7 +32,7 @@ services:

# the postgres database image
db:
image: postgres:12
image: postgres:15
restart: always
container_name: sampledb-postgres
healthcheck:
Expand Down
2 changes: 1 addition & 1 deletion docs/administrator_guide/backup_and_restore.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ You can then recreate the database container and restore the backup using the ``
-v `pwd`/pgdata:/var/lib/postgresql/data/pgdata:rw \
--restart=always \
--name sampledb-postgres \
postgres:12
postgres:15
docker exec -i sampledb-postgres psql -U postgres postgres < backup.sql
If you have set different options for the database container before, e.g. setting it in a specific network and giving it a fixed IP, you should also set these options here.
Expand Down
2 changes: 2 additions & 0 deletions docs/administrator_guide/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ Miscellaneous
- The secret key for Flask and Flask extensions. See: https://flask.palletsprojects.com/en/1.1.x/config/#SECRET_KEY
* - SAMPLEDB_WTF_CSRF_TIME_LIMIT
- The time limit for WTForms CSRF tokens in seconds. See: https://flask-wtf.readthedocs.io/en/stable/config.html
* - SAMPLEDB_DISABLE_USER_INVITATIONS
- If set, existing users won't be able to invite new users to register an account.
* - SAMPLEDB_INVITATION_TIME_LIMIT
- The time limit for invitation links in seconds.
* - SAMPLEDB_ONLY_ADMINS_CAN_MANAGE_LOCATIONS
Expand Down
4 changes: 2 additions & 2 deletions docs/administrator_guide/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ First, start your database container:
-v `pwd`/pgdata:/var/lib/postgresql/data/pgdata:rw \
--restart=always \
--name sampledb-postgres \
postgres:12
postgres:15
Next, start the SampleDB container:
Expand All @@ -42,7 +42,7 @@ Next, start the SampleDB container:
--restart=always \
--name sampledb \
-p 8000:8000 \
sciapp/sampledb:0.29.1
sciapp/sampledb:0.30.0
This will start a minimal SampleDB installation at ``http://localhost:8000`` and allow you to sign in with the username ``admin`` and the password ``password``.

Expand Down
5 changes: 5 additions & 0 deletions docs/administrator_guide/upgrading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ Upgrading
To update an existing SampleDB installation, please create a :ref:`backup <backup_and_restore>` and then re-start SampleDB using the Docker image of the new version.

There is no supported path for downgrading SampleDB at this time.

Upgrading the database
----------------------

For upgrading the PostgreSQL database, you can create a backup using the older version of PostgreSQL and then restore that backup using the newer version PostgreSQL.
19 changes: 19 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
Changelog
=========

Version 0.30
------------

Released on December 9th, 2024.

- Added starting number in batch object creation
- Added support for filter_operator for object_reference properties and workflow views
- Added support for event_utc_datetime when creating instrument log entries via the HTTP API
- Improved .eln export and import
- Only show action types with usable actions in the navbar Actions dropdown
- Fixed search by array index
- Fixed notification for automatic creation of federated identities
- Introduce recursive workflow view
- Added an option to disable user invitations (configurable with SAMPLEDB_DISABLE_USER_INVITATIONS)
- Fixed notification for user languages change
- Changed PostgreSQL version in the documentation and the docker-compose.yml.dist from 12 to 15, as PostgreSQL 12 is now end-of-life
- Fixed handling of parentheses and chained operators in advanced search


Version 0.29.1
--------------

Expand Down
4 changes: 3 additions & 1 deletion docs/developer_guide/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,8 @@ Creating an instrument log entry
{
"object_id": 2
}
]
],
"event_utc_datetime": "2020-08-03T12:13:14.123456",
}

**Example response**:
Expand All @@ -1310,6 +1311,7 @@ Creating an instrument log entry
:<json list category_ids: an optional list of category IDs for the log entry
:<json list file_attachments: an optional list of file attachments as json objects with file_name and base64_content attributes
:<json list object_attachments: an optional list of object attachments as json objects with an object_id attribute
:<json string event_utc_datetime: an optional string containing the date and time of the event in UTC in ISO format
:statuscode 201: the log entry and optional attachments have been created successfully
:statuscode 400: there was an error in the given json data
:statuscode 403: only instrument scientists can write to the instrument log
Expand Down
36 changes: 33 additions & 3 deletions docs/user_guide/schemas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ workflow_views
This attribute can be used to enable and define one or more workflow views. Workflow views display contents of related objects referencing or referenced by this object
on the object page.

By default, all directly related objects will be displayed, however you can filter the objects by action or action type. By setting ``referencing_action_id`` or ``referenced_action_id`` to a single ID or a list of IDs, you can limit the referencing or referenced objects to specific actions IDs. By setting ``referencing_action_type_id`` or ``referenced_action_type_id`` you can do the same by action type. If both filters are set, both action and action type will have to match for an object to be included in the workflow view.
By default, all directly related objects will be displayed, however you can filter the objects by action or action type. By setting ``referencing_action_id`` or ``referenced_action_id`` to a single ID or a list of IDs, you can limit the referencing or referenced objects to specific actions IDs. By setting ``referencing_action_type_id`` or ``referenced_action_type_id`` you can do the same by action type. ``referencing_filter_operator`` and ``referenced_filter_operator`` can each be set to ``"and"`` or ``"or"`` to control whether both action ID and action type ID filters needs to be fulfilled. If both filters are set and ``filter_operator`` is set to ``"and"`` (the default), both action and action type will have to match for an object to be included in the workflow view. If ``filter_operator`` is instead set to ``"or"`` only one of those filters will have to match.

The workflow view also allows setting a custom ``title`` for the object page section section, e.g. ``{"en": "Processing"}`` or ``"Measurements"``.
By setting ``show_action_ínfo`` to ``false`` you can disable displaying action information, which is enabled by default.
Expand All @@ -262,6 +262,31 @@ The ``sorting_properties`` can be set to a list of property names which will be

A workflow view, containing previews of related measurements

Recursive workflows can be defined by defining filters in the ``recursion_filters`` dictionary.
These workflows also include objects referenced by or referencing other objects in the workflow based on the base workflow configuration.
To set up a recursive view ``recursion_filters`` dictionary, recursive workflows can be configured.
If ``referenced_action_id`` and/or ``referenced_action_type_id`` are provided as single IDs or lists of IDs only referenced objects having matching actions are included. To disable a filter you can also set it to ``null``.
Similarly, the filters ``referencing_action_id`` and ``referencing_action_type_id`` apply to referencing objects.
If these values are omitted or set to ``null``, no additional filter is applied for the recursion.
``referencing_filter_operator`` and ``referenced_filter_operator`` can be set to ``"and"`` or ``"or"`` for this as well, just as for the workflow view, to control whether only one (``"or"``) or both (``"and"``) filters need to be matched. Unlike the default for the workflow view, ``filter_operator`` defaults to ``"or"``.
The maximum recursion depth of the view can be configured by providing a positive integer for ``max_depth``.

.. code-block:: json
:caption: A recursive workflow view definition including samples (``-99``) and measurements (``-98``) referencing the object as well as referenced objects created using the action with ID ``1``. Only referenced objects created using the action with ID ``1`` are handled recursively to a maximum recursion depth of ``2``.
"workflow_views": [
{
"referencing_action_type_id": [-98, -99],
"referenced_action_id": 1,
"recursion_filters": {
"referenced_action_id": 1,
"referencing_action_id": [],
"max_depth": 2
},
"title": {"en": "Processing", "de": "Bearbeitung"}
}
]
workflow_show_more
^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -1136,10 +1161,15 @@ action_id

This attribute is a number or list of numbers that sets the IDs of actions to limit that only objects created with these actions may be referenced by this property, e.g. ``1`` or ``[1, 3]``.

filter_operator
^^^^^^^^^^^^^^^

This attribute is either ``"and"`` or ``"or"`` and when both ``action_type_id`` and ``action_id`` are set, this controls whether both these filters need to be fulfilled or only one. By default (``"and"``), objects referenced by an ``object_reference`` property need to match both the ``action_id`` and ``action_type_id`` filters, however when ``filter_operator`` is set to ``"or"`` it is enough for an object to match one of these filters.

Sample References
^^^^^^^^^^^^^^^^^

Properties of this type are a special case of object reference, limited to referencing samples. The same can be achieved using an object reference with ``action_type_id`` set to -99. These properties support the same attributes as those of type ``object_reference``, aside from ``action_id`` and ``action_type_id``. Their type must be ``sample``.
Properties of this type are a special case of object reference, limited to referencing samples. The same can be achieved using an object reference with ``action_type_id`` set to -99. These properties support the same attributes as those of type ``object_reference``, aside from ``action_id``, ``action_type_id`` and ``filter_operator``. Their type must be ``sample``.

.. code-block:: json
:caption: A sample reference property
Expand All @@ -1152,7 +1182,7 @@ Properties of this type are a special case of object reference, limited to refer
Measurement References
^^^^^^^^^^^^^^^^^^^^^^

Properties of this type are a special case of object reference, limited to referencing measurements. The same can be achieved using an object reference with ``action_type_id`` set to -98. These properties support the same attributes as those of type ``object_reference``, aside from ``action_id`` and ``action_type_id``. Their type must be ``measurement``.
Properties of this type are a special case of object reference, limited to referencing measurements. The same can be achieved using an object reference with ``action_type_id`` set to -98. These properties support the same attributes as those of type ``object_reference``, aside from ``action_id``, ``action_type_id`` and ``filter_operator``. Their type must be ``measurement``.

.. code-block:: json
:caption: A measurement reference property
Expand Down
1 change: 0 additions & 1 deletion docs/utils/generate_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options

import chromedriver_binary
from selenium.webdriver.common.by import By

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')))
Expand Down
1 change: 0 additions & 1 deletion requirements.documentation.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
chromedriver-binary-auto
pygments
pytest
selenium
Expand Down
3 changes: 2 additions & 1 deletion requirements.test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
chromedriver-binary-auto
coverage
jsonschema
lxml
Expand All @@ -7,4 +6,6 @@ pytest
pytest-cov
pytest-xdist
requests-mock
rocrate
roc-validator
selenium
Loading

0 comments on commit 388d734

Please sign in to comment.