Skip to content

Commit

Permalink
Merge branch 'master' of github.com:senaite/senaite.ast into fix-smal…
Browse files Browse the repository at this point in the history
…ler-decimals
  • Loading branch information
xispa committed Jun 25, 2024
2 parents a723e06 + d04d00c commit 56b8f89
Show file tree
Hide file tree
Showing 40 changed files with 821 additions and 295 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: build and test senaite.ast
on:
- push
- pull_request
env:
PLONE_VERSION: "5.2"
jobs:
build-and-test:
runs-on: 'ubuntu-20.04'
container:
image: python:2.7.18-buster
steps:
- uses: actions/checkout@v3
- name: cache eggs
uses: actions/cache@v3
with:
key: eggs-cache-${{ hashFiles('buildout.cfg', 'requirements.txt') }}
path: |
eggs/
- name: install
run: |
pip install virtualenv
virtualenv -p `which python` .
bin/pip install --upgrade pip
bin/pip install -r requirements.txt
bin/buildout -N -t 3 annotate
bin/buildout -N -t 3
- name: test
run: |
bin/test -s senaite.ast.tests
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Antibiotic Sensitivity Testing (AST) for SENAITE
.. image:: https://img.shields.io/pypi/v/senaite.ast.svg?style=flat-square
:target: https://pypi.python.org/pypi/senaite.ast

.. image:: https://img.shields.io/travis/com/senaite/senaite.ast/master.svg?style=flat-square
:target: https://app.travis-ci.com/github/senaite/senaite.ast
.. image:: https://img.shields.io/github/actions/workflow/status/senaite/senaite.ast/build-and-test.yml?branch=2.x
:target: https://github.com/senaite/senaite.ast/actions/workflows/build-and-test.yml?query=branch:2.x

.. image:: https://readthedocs.org/projects/pip/badge/
:target: https://senaiteast.readthedocs.org
Expand Down
100 changes: 1 addition & 99 deletions buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,105 +1,7 @@
[buildout]
index = https://pypi.org/simple/
extends = https://dist.plone.org/release/5.2-latest/versions.cfg
find-links =
https://dist.plone.org/release/5.2-latest/
https://dist.plone.org/thirdparty/

parts =
instance
test
omelette
i18ndude
zopepy
update_translations
write_code_headers

eggs =
senaite.core
senaite.app.listing
senaite.app.spotlight
senaite.app.supermodel
senaite.impress
senaite.jsonapi
senaite.lims
senaite.abx
senaite.microorganism
senaite.ast
plone.reload
Products.PrintingMailHost

extensions = mr.developer

extends = https://raw.githubusercontent.com/senaite/senaite.core/2.x/buildout.base.cfg
package-name = senaite.ast

versions = versions
show-picked-versions = true

plone-user = admin:admin

develop = .
sources = sources
auto-checkout = *

[sources]
senaite.core = git https://github.com/senaite/senaite.core.git branch=2.x
senaite.app.listing = git https://github.com/senaite/senaite.app.listing.git branch=2.x
senaite.app.spotlight = git https://github.com/senaite/senaite.app.spotlight.git branch=2.x
senaite.app.supermodel = git https://github.com/senaite/senaite.app.supermodel.git branch=2.x
senaite.impress = git https://github.com/senaite/senaite.impress.git branch=2.x
senaite.jsonapi = git https://github.com/senaite/senaite.jsonapi.git branch=2.x
senaite.lims = git https://github.com/senaite/senaite.lims.git branch=2.x
senaite.abx = git https://github.com/senaite/senaite.abx.git
senaite.microorganism = git https://github.com/senaite/senaite.microorganism.git

[instance]
recipe = plone.recipe.zope2instance
http-address = 127.0.0.1:8080
user = ${buildout:plone-user}
wsgi = on
eggs =
Plone
plone.app.upgrade
${buildout:package-name}
${buildout:eggs}
deprecation-warnings = on
environment-vars =
zope_i18n_compile_mo_files true
zcml =

[i18ndude]
unzip = true
recipe = zc.recipe.egg
eggs = i18ndude

[update_translations]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/update_translations
input = ${buildout:directory}/templates/update_translations.in
mode = 755

[write_code_headers]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/write_code_headers
input = ${buildout:directory}/templates/write_code_headers.py.in
mode = 755

[test]
recipe = zc.recipe.testrunner
defaults = ['--auto-color', '--auto-progress']
eggs =
senaite.ast [test]

[omelette]
recipe = collective.recipe.omelette
eggs = ${buildout:eggs}

[zopepy]
recipe = zc.recipe.egg
eggs = ${instance:eggs}
interpreter = zopepy
scripts = zopepy

[versions]
setuptools =
zc.buildout =
9 changes: 9 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Changelog
1.2.0 (unreleased)
------------------

- #37 Compatibility with core#2567 (AnalysisCategory to DX)
- #37 Compatibility with core#2471 (Department to DX)
- #36 Fix user can edit ast built-in services after upgrades
- #35 Compatibility with core#2521 - AT2DX ARTemplate/SampleTemplate
- #34 Add transition "Reject antibiotics"
- #33 Display the Antibiotic Sensitivity section only when necessary
- #32 Compatibility with senaite.core#2492 (AnalysisProfile to DX)


1.1.0 (2024-01-04)
------------------
Expand All @@ -17,6 +25,7 @@ Changelog
- #21 Fix AST entry is empty when analyses categorization for sample is checked
- #20 Compatibility with senaite.app.listing#87


1.0.0 (2022-06-18)
------------------

Expand Down
25 changes: 24 additions & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,30 @@ From this view, user can choose the tuples Microorganism-Antibiotic to be
reported in results. Once the button "Save" is pressed, the value for analyses
with name "Report" for all microorganisms are updated accordingly.

.. Links

.. _RejectAntibiotics:

Flag antibiotics as Not Tested
------------------------------

Quite often, laboratory manager will want to report "Not tested" for some
antibiotics and microorganisms, while keeping them in the AST panel. This can
be easily achieved with the transition "Reject antibiotics". This transition is
available for analyses that are part of a sensitivity testing panel. Once
clicked, a modal view is displayed, where user can choose the antibiotics to be
flagged as "Not Tested":

.. image:: static/reject_antibiotics.png
:width: 640
:alt: Reject antibiotics

Once done, "NT" is displayed as a result for the selected antibiotics, both in
results entry and in results report:

.. image:: static/not_tested.png
:width: 640
:alt: Antibiotics flagged as Not Tested


.. _SENAITE LIMS: https://www.senaite.com
.. _senaite.ast: https://pypi.python.org/pypi/senaite.ast
Expand Down
Binary file added docs/static/not_tested.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/static/reject_antibiotics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
setuptools==42.0.2
setuptools==44.1.1
zc.buildout==2.13.3
wheel
10 changes: 5 additions & 5 deletions src/senaite/ast/adapters/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
AST-like analyses are always added manually afterwards, based on the result
oif the "Microorganism Identification" analysis -->
<subscriber
for="bika.lims.browser.widgets.analysisprofileanalyseswidget.AnalysisProfileAnalysesView
bika.lims.interfaces.IAnalysisProfile"
for="senaite.core.browser.widgets.analysisprofileswidget.AnalysisProfilesWidget
senaite.core.interfaces.IAnalysisProfile"
provides="senaite.app.listing.interfaces.IListingViewAdapter"
factory=".listing.services.NonASTServicesViewAdapter" />

<!-- Do not display AST-type services for selection in Analysis Template -->
<!-- Do not display AST-type services for selection in Sample Template -->
<subscriber
for="bika.lims.browser.widgets.artemplateanalyseswidget.ARTemplateAnalysesView
bika.lims.interfaces.IARTemplate"
for="senaite.core.browser.widgets.sampletemplate_services_widget.SampleTemplateServicesWidget
senaite.core.interfaces.ISampleTemplate"
provides="senaite.app.listing.interfaces.IListingViewAdapter"
factory=".listing.services.NonASTServicesViewAdapter" />

Expand Down
11 changes: 11 additions & 0 deletions src/senaite/ast/adapters/guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from senaite.ast.config import DISK_CONTENT_KEY
from senaite.ast.config import MIC_KEY
from senaite.ast.config import ZONE_SIZE_KEY
from senaite.ast.utils import is_ast_analysis
from zope.interface import implementer

OPERATORS = ["<=", ">=", "<", ">"]
Expand Down Expand Up @@ -103,6 +104,10 @@ def guard_submit(self):
# Skip extrapolated antibiotics
continue

if utils.is_rejected_interim(antibiotic):
# Skip rejected antibiotics
continue

if utils.is_interim_empty(antibiotic):
# Cannot submit if no result
return False
Expand Down Expand Up @@ -135,3 +140,9 @@ def guard_submit(self):
return False

return True

def guard_reject_antibiotics(self):
"""Rejection of antibiotics is only possible for sensitivity testing
(AST) analyses
"""
return is_ast_analysis(self.context)
1 change: 1 addition & 0 deletions src/senaite/ast/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<!-- Package includes -->
<include package=".content"/>
<include package=".modals"/>
<include package=".theme"/>

<!-- Static directory for js, css and image resources -->
Expand Down
19 changes: 19 additions & 0 deletions src/senaite/ast/browser/modals/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
#
# This file is part of SENAITE.AST.
#
# SENAITE.AST is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright 2020-2024 by it's authors.
# Some rights reserved, see README and LICENSE.
13 changes: 13 additions & 0 deletions src/senaite/ast/browser/modals/configure.zcml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">

<!-- Modal for antibiotic rejection -->
<browser:page
name="reject_antibiotics"
for="*"
class=".rejectantibiotics.RejectAntibioticsModal"
permission="zope2.View"
layer="senaite.ast.interfaces.ISenaiteASTLayer" />

</configure>
Loading

0 comments on commit 56b8f89

Please sign in to comment.