Example #1
0
     ),
 ),
 StringField(
     'Elevation',
     schemata='Location',
     widget=StringWidget(
         label=_("Elevation"),
         description=_(
             "The height or depth at which the sample has to be taken"),
     ),
 ),
 DurationField(
     'SamplingFrequency',
     vocabulary_display_path_bound=sys.maxint,
     widget=DurationWidget(
         label=_("Sampling Frequency"),
         description=
         _("If a sample is taken periodically at this sample point, enter frequency here, e.g. weekly"
           ),
     ),
 ),
 ReferenceField(
     'SampleTypes',
     required=0,
     multiValued=1,
     allowed_types=('SampleType', ),
     vocabulary='SampleTypesVocabulary',
     relationship='SamplePointSampleType',
     widget=brw(
         label=_("Sample Types"),
         description=_("The list of sample types that can be collected "
                       "at this sample point.  If no sample types are "
Example #2
0
schema = BikaSchema.copy() + Schema((
    StringField(
        'Category',
        default='lab',
        vocabulary=PRESERVATION_CATEGORIES,
        widget=SelectionWidget(
            format='flex',
            label=_("Preservation Category"),
        ),
    ),
    DurationField(
        'RetentionPeriod',
        widget=DurationWidget(
            label=_("Retention Period"),
            description=_(
                'Once preserved, the sample must be disposed of within this '
                'time period.  If not specified, the sample type retention '
                'period will be used.')),
    ),
))
schema['description'].widget.visible = True
schema['description'].schemata = 'default'


class Preservation(BaseContent):
    implements(IDeactivable)
    security = ClassSecurityInfo()
    displayContentsTab = False
    schema = schema
    widget=SelectionWidget(
        format="select",
        label=_("Default Method"),
        description=_(
            "If 'Allow instrument entry of results' is selected, the method "
            "from the default instrument will be used. Otherwise, only the "
            "methods selected above will be displayed.")))

# Maximum time (from sample reception) allowed for the analysis to be performed.
# After this amount of time, a late alert is printed, and the analysis will be
# flagged in turnaround time report.
MaxTimeAllowed = DurationField(
    'MaxTimeAllowed',
    schemata="Analysis",
    widget=DurationWidget(
        label=_("Maximum turn-around time"),
        description=_(
            "Maximum time allowed for completion of the analysis. A late "
            "analysis alert is raised when this period elapses"),
    ))

# The amount of difference allowed between this analysis, and any duplicates.
DuplicateVariation = FixedPointField(
    'DuplicateVariation',
    default='0.00',
    schemata="Method",
    widget=DecimalWidget(
        label=_("Duplicate Variation %"),
        description=_(
            "When the results of duplicate analyses on worksheets, carried "
            "out on the same sample, differ with more than this percentage, "
Example #4
0
     widget=SelectionWidget(
         label=_("Analysis Attachment Option"),
         description=_(
             "Same as the above, but sets the default on analysis services. "
             "This setting can be set per individual analysis on its "
             "own configuration"),
         format='select',
     )),
 DurationField(
     'DefaultSampleLifetime',
     schemata="Analyses",
     required=1,
     default={
         "days": 30,
         "hours": 0,
         "minutes": 0
     },
     widget=DurationWidget(
         label=_("Default sample retention period"),
         description=
         _("The number of days before a sample expires and cannot be analysed "
           "any more. This setting can be overwritten per individual sample type "
           "in the sample types setup"),
     )),
 StringField('ResultsDecimalMark',
             schemata="Analyses",
             vocabulary=DECIMAL_MARKS,
             default=".",
             widget=SelectionWidget(
                 label=_("Default decimal mark"),
                 description=_("Preferred decimal mark for results"),
                 format='select',
Example #5
0
     widget=SelectionWidget(
         format='select',
         label=_("Analysis Attachment Option"),
         description=_(
             "Same as the above, but sets the default on analysis services. "
             "This setting can be set per individual analysis on its "
             "own configuration"),
     )),
 DurationField(
     'DefaultSampleLifetime',
     schemata="Analyses",
     required=1,
     default={
         "days": 30,
         "hours": 0,
         "minutes": 0
     },
     widget=DurationWidget(
         label=_("Default sample retention period"),
         description=_(
             "The number of days before a sample expires and cannot be "
             "analysed any more. This setting can be overwritten per "
             "individual sample type in the sample types setup"),
     )),
 DurationField(
     'DefaultTurnaroundTime',
     schemata="Analyses",
     required=1,
     default={
         "days": 5,
         "hours": 0,
         "minutes": 0
Example #6
0
        required=0,
        multiValued=0,
    ),
    ReferenceField('Analyses',
        allowed_types=('Analysis',),
        relationship='SamplePartitionAnalysis',
        #referenceClass=HoldingReference,
        required=0,
        multiValued=1,
    ),
    DateTimeField('DatePreserved',
    ),
    StringField('Preserver',
        searchable=True
    ),
    DurationField('RetentionPeriod',
    ),
    ComputedField('DisposalDate',
        expression = 'context.disposal_date()',
        widget = ComputedWidget(
            visible = False,
        ),
    ),
),
)

schema['title'].required = False

class SamplePartition(BaseContent, HistoryAwareMixin):
    implements(ISamplePartition)
    security = ClassSecurityInfo()
    displayContentsTab = False
Example #7
0
    def _get_field(self):
        """Returns the field that stores the SampleType object, if any
        """
        field = self.getField("SampleType", None)
        if not field:
            field = self.getField("SampleTypes", None)

        return field


schema = BikaSchema.copy() + Schema((
    DurationField('RetentionPeriod',
        required = 1,
        default_method = 'getDefaultLifetime',
        widget = DurationWidget(
            label=_("Retention Period"),
            description =_(
                "The period for which un-preserved samples of this type can be kept before "
                "they expire and cannot be analysed any further"),
        )
    ),
    BooleanField('Hazardous',
        default = False,
        widget = BooleanWidget(
            label=_("Hazardous"),
            description=_("Samples of this type should be treated as hazardous"),
        ),
    ),
    ReferenceField('SampleMatrix',
        required = 0,
        allowed_types = ('SampleMatrix',),
        vocabulary = 'SampleMatricesVocabulary',