Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secondary Sample functionality #1284

merged 16 commits into from Mar 18, 2019


2 participants
Copy link

commented Mar 14, 2019

Description of the issue/feature this PR addresses

This functionality mimics the same functionality of secondary Analysis Requests from pre-1.3 versions.
A field "Primary Sample" has been added in Add form, so the user can choose any of the Samples active and received in the system. Once a primary sample is selected, some fields of the form get populated automatically (e.g. Client, Contact, Sample Type, Sample Point, Client Reference, Client Sample ID, Date Sampled, etc.) with same data as the primary one.

Once the secondary sample is created, the Sample status becomes "received" automatically and the values for fields Date Sampled and Date Received are no longer editable (displayed in read-only mode). Nevertheless, if any of these two fields are edited in the primary, values for all secondaries will be updated in accordance.

The id of secondary samples follow this format: {parent_ar_id}-S{secondary_count:02d}, so if the primary sample is AP-0003, the IDs of secondary Samples will be AP-0003-S01, AP-0003-S02, etc. The "S" (of "Secondary") has been used in order to prevent confusions with Partitions ("P" char) or Retests ("R" char).

Captura de 2019-03-14 23-46-17

Captura de 2019-03-14 23-47-34

Current behavior before PR

No support for secondary samples.

Desired behavior after PR is merged

Support for secondary samples.

I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

xispa added some commits Mar 14, 2019

xispa added some commits Mar 15, 2019


This comment has been minimized.

Copy link

commented Mar 15, 2019

Although the Secondary Sample get automatically received, the Analyses remain in the state "Registered" and can only be manually "Initialized":

H2O-0004-S02 — SENAITE 2019-03-15 20-29-17

xispa added some commits Mar 15, 2019


This comment has been minimized.

Copy link

commented Mar 16, 2019

Creating a single partition from a secondary sample fails with this error:

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module bika.lims.browser.partition_magic, line 80, in __call__
  Module bika.lims.utils.analysisrequest, line 416, in create_partition
  Module bika.lims.utils.analysisrequest, line 83, in create_analysisrequest
  Module bika.lims.idserver, line 546, in renameAfterCreation
KeyError: 'The ID H2O-0064-S02-P01 is already taken in the path /senaite/clients/client-1'

xispa added some commits Mar 16, 2019

xispa added some commits Mar 16, 2019

Copy link

left a comment

Great work, thanks!

@ramonski ramonski merged commit c0d002b into master Mar 18, 2019

3 checks passed

Scrutinizer Analysis: 2 new issues, 13 updated code elements – Tests: passed
continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed

@ramonski ramonski deleted the secondary-sample branch Mar 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.