Esempio n. 1
0
from Products.Archetypes.public import BaseContent
from Products.Archetypes.public import DateTimeField
from Products.Archetypes.public import registerType
from Products.Archetypes.public import Schema
from bika.lims.browser.widgets import DateTimeWidget
from bika.lims.content.bikaschema import BikaSchema
from bika.health.config import PROJECTNAME
from bika.lims import bikaMessageFactory as _b
from bika.health import bikaMessageFactory as _

schema = BikaSchema.copy() + Schema((
    DateTimeField(
        'StartDate',
        schemata='default',
        required=True,
        widget=DateTimeWidget(label=_("Epidemiological year start date"), ),
    ),
    DateTimeField(
        'EndDate',
        schemata='default',
        required=True,
        widget=DateTimeWidget(label=_("Epidemiological year end date"), ),
    ),
))

schema['description'].widget.visible = False
schema['description'].schemata = 'default'


class EpidemiologicalYear(BaseContent):
    security = ClassSecurityInfo()
Esempio n. 2
0
             'label': _('Title')
         }, {
             'columnName': 'ClientID',
             'width': '20',
             'label': _('Client ID')
         }],
     ),
 ),
 StringField('ClientBatchID',
             searchable=True,
             required=0,
             widget=StringWidget(label=_("Client Batch ID"))),
 DateTimeField(
     'BatchDate',
     required=False,
     widget=DateTimeWidget(label=_('Date'), ),
 ),
 LinesField('BatchLabels',
            vocabulary="BatchLabelVocabulary",
            accessor="getLabelNames",
            widget=MultiSelectionWidget(
                label=_("Batch Labels"),
                format="checkbox",
            )),
 TextField('Remarks',
           searchable=True,
           default_content_type='text/x-web-intelligent',
           allowable_content_types=('text/plain', ),
           default_output_type="text/plain",
           widget=TextAreaWidget(
               macro="bika_widgets/remarks",
Esempio n. 3
0
     'Invoice',
     vocabulary_display_path_bound=sys.maxsize,
     allowed_types=('Invoice', ),
     referenceClass=HoldingReference,
     relationship='OrderInvoice',
 ),
 DateTimeField(
     'OrderDate',
     required=1,
     default_method='current_date',
     widget=DateTimeWidget(
         label=_("Order Date"),
         size=12,
         render_own_label=True,
         visible={
             'edit': 'visible',
             'view': 'visible',
             'add': 'visible',
             'secondary': 'invisible'
         },
     ),
 ),
 DateTimeField(
     'DateDispatched',
     widget=DateTimeWidget(label=_("Date Dispatched"), ),
 ),
 RemarksField(
     'Remarks',
     searchable=True,
     widget=RemarksWidget(label=_("Remarks"), ),
 ),
Esempio n. 4
0
        type="recipients",
        subfields=(
            "UID",
            "Username",
            "Fullname",
            "EmailAddress",
            "PublicationModes"
        ),
    ),
    DateTimeField(
        "DatePrinted",
        mode="rw",
        widget=DateTimeWidget(
            label=_("Date Printed"),
            visible={
                "edit": "visible",
                "view": "visible",
            }
        ),
    ),
))

schema['id'].required = False
schema['title'].required = False


class ARReport(BaseFolder):
    """An AnalysisRequest report, containing the report itself in pdf and html
       format. It includes information about the date when was published, from
       whom, the report recipients (and their emails) and the publication mode
    """
Esempio n. 5
0
class BatchSchemaExtender(object):
    adapts(IBatch)
    implements(IOrderableSchemaExtender)

    fields = [
        # ExtComputedField('ClientID',
        #     expression="context.Schema()['Client'].get(context) and context.Schema()['Client'].get(context).ID() or None",
        # ),
        # ExtComputedField('ClientUID',
        #     expression="context.Schema()['Client'].get(context) and context.Schema()['Client'].get(context).UID() or None",
        # ),
        # ExtComputedField('ClientTitle',
        #     expression="context.Schema()['Client'].get(context) and context.Schema()['Client'].get(context).Title() or None",
        # ),
        ExtReferenceField(
            'Doctor',
            required=1,
            multiValued=0,
            allowed_types=('Doctor', ),
            referenceClass=HoldingReference,
            relationship='BatchDoctor',
            widget=ReferenceWidget(
                label=_("Doctor"),
                description="",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible'
                },
                base_query={'inactive_state': 'active'},
                catalog_name='portal_catalog',
                showOn=True,
                colModel=[
                    {
                        'columnName': 'DoctorID',
                        'width': '20',
                        'label': _('Doctor ID')
                    },
                    {
                        'columnName': 'Title',
                        'width': '80',
                        'label': _('Full Name')
                    },
                ],
                add_button={
                    'visible': True,
                    'url': 'doctors/portal_factory/Doctor/new/edit',
                    'return_fields': ['Firstname', 'Surname'],
                    'js_controllers': [
                        '#doctor-base-edit',
                    ],
                    'overlay_handler': 'HealthDoctorOverlayHandler',
                },
                edit_button={
                    'visible': True,
                    # url with the root to create/edit a object.
                    'url': 'doctors/portal_factory/Doctor',
                    'return_fields': ['Firstname', 'Surname'],
                    'js_controllers': [
                        '#doctor-base-edit',
                    ],
                    'overlay_handler': 'HealthDoctorOverlayHandler',
                }),
        ),
        # ExtComputedField('DoctorID',
        #     expression="context.Schema()['Doctor'].get(context) and context.Schema()['Doctor'].get(context).ID() or None",
        # ),
        # ExtComputedField('DoctorUID',
        #     expression="context.Schema()['Doctor'].get(context) and context.Schema()['Doctor'].get(context).UID() or None",
        # ),
        # ExtComputedField('DoctorTitle',
        #     expression="context.Schema()['Doctor'].get(context) and context.Schema()['Doctor'].get(context).Title() or None",
        # ),
        ExtReferenceField(
            'Patient',
            required=1,
            multiValued=0,
            allowed_types=('Patient', ),
            referenceClass=HoldingReference,
            relationship='BatchPatient',
            widget=ReferenceWidget(
                label=_("Patient"),
                description="",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible'
                },
                base_query={'inactive_state': 'active'},
                catalog_name='bika_patient_catalog',
                showOn=True,
                colModel=[{
                    'columnName': 'getPatientID',
                    'width': '20',
                    'label': _('Patient ID')
                }, {
                    'columnName': 'Title',
                    'width': '40',
                    'label': _('Full Name')
                }, {
                    'columnName': 'PatientIdentifiers',
                    'width': '40',
                    'label': _('Additional Identifiers')
                }],
                add_button={
                    'visible': True,
                    'url': 'patients/portal_factory/Patient/new/edit',
                    'return_fields': ['Firstname', 'Surname'],
                    'js_controllers': [
                        '#patient-base-edit',
                    ],
                    'overlay_handler': 'HealthPatientOverlayHandler',
                },
                edit_button={
                    'visible': True,
                    # url with the root to create/edit a object.
                    'url': 'patients/portal_factory/Patient',
                    'return_fields': ['Firstname', 'Surname'],
                    'js_controllers': [
                        '#patient-base-edit',
                    ],
                    'overlay_handler': 'HealthPatientOverlayHandler',
                }),
        ),
        # ExtComputedField('PatientID',
        #     expression="context.Schema()['Patient'].get(context) and context.Schema()['Patient'].get(context).ID() or None",
        # ),
        # ExtComputedField('PatientUID',
        #     expression="context.Schema()['Patient'].get(context) and context.Schema()['Patient'].get(context).UID() or None",
        # ),
        # ExtComputedField('PatientTitle',
        #     expression="context.Schema()['Patient'].get(context) and context.Schema()['Patient'].get(context).Title() or None",
        # ),
        ExtDateTimeField(
            'OnsetDate',
            widget=DateTimeWidget(label=_('Onset Date'), ),
        ),
        ExtStringField(
            'PatientBirthDate',
            widget=StringWidget(visible=False, ),
        ),
        ExtRecordsField(
            'PatientAgeAtCaseOnsetDate',
            widget=SplittedDateWidget(
                label=_('Patient Age at Case Onset Date'), ),
        ),
        ExtBooleanField(
            'OnsetDateEstimated',
            default=False,
            widget=BooleanWidget(label=_("Onset Date Estimated"), ),
        ),
        ExtRecordsField(
            'ProvisionalDiagnosis',
            type='provisionaldiagnosis',
            subfields=('Code', 'Title', 'Description', 'Onset'),
            # Temporary fix: https://github.com/bikalabs/bika.health/issues/89
            #required_subfields=('Title'),
            subfield_sizes={
                'Code': 7,
                'Title': 20,
                'Description': 35,
                'Onset': 10
            },
            subfield_labels={
                'Code': _('Code'),
                'Title': _('Provisional diagnosis'),
                'Description': _('Description'),
                'Onset': _('Onset')
            },
            subfield_types={'Onset': 'datepicker_nofuture'},
            widget=RecordsWidget(
                label='Provisional diagnosis',
                combogrid_options={
                    'Title': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbytitle',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                    'Code': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbycode',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                    'Description': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbydesc',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                },
            ),
        ),
        ExtTextField(
            'AdditionalNotes',
            default_content_type='text/plain',
            allowable_content_types=('text/plain', ),
            default_output_type="text/plain",
            widget=TextAreaWidget(label=_('Additional notes'), ),
        ),
        ExtLinesField(
            'CaseStatus',
            vocabulary=getCaseStatus(),
            widget=MultiSelectionWidget(format='checkbox',
                                        label=_("Case status")),
        ),
        ExtLinesField(
            'CaseOutcome',
            vocabulary=getCaseOutcome(),
            widget=MultiSelectionWidget(format='checkbox',
                                        label=_("Case outcome")),
        ),
        ExtRecordsField(
            'Symptoms',
            type='symptoms',
            subfields=('UID', 'Title', 'Description', 'Severity'),
            widget=CaseSymptomsWidget(label='Symptoms', ),
        ),
        ExtRecordsField(
            'AetiologicAgents',
            type='aetiologicagents',
            subfields=('Title', 'Description', 'Subtype'),
            subfield_sizes={
                'Title': 15,
                'Description': 25,
                'Subtype': 10
            },
            subfield_labels={
                'Title': _('Aetiologic agent'),
                'Description': _b('Description'),
                'Subtype': _('Subtype')
            },
            # Temporary fix: https://github.com/bikalabs/bika.health/issues/89
            # required_subfields=('Title'),
            widget=RecordsWidget(
                label='Aetiologic agents',
                combogrid_options={
                    'Title': {
                        'colModel': [{
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Aetiologic agent')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _b('Description')
                        }, {
                            'columnName': 'Subtype',
                            'width': '30',
                            'label': _('Subtype')
                        }],
                        'url':
                        'getaetiologicagents',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                },
            ),
        ),
        ExtIntegerField(
            'HoursFasting',
            required=0,
            widget=IntegerWidget(label=_('Hours fasting'), ),
        ),
        ExtRecordsField(
            'PatientCondition',
            widget=CasePatientConditionWidget(label='Patient condition', ),
        ),
        ExtRecordsField(
            'MenstrualStatus',
            widget=CaseMenstrualStatusWidget(label='Menstrual status', ),
        ),
        ExtRecordsField(
            'BasalBodyTemperature',
            widget=CaseBasalBodyTempWidget(label='Basal body temperature', ),
        ),
        ExtStringField(
            'ClientPatientID',
            searchable=True,
            required=0,
            widget=ReferenceWidget(
                label=_b("Client Patient ID"),
                size=12,
                colModel=[
                    {
                        'columnName': 'id',
                        'width': '20',
                        'label': _('Patient ID'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'ClientPatientID',
                        'width': '20',
                        'label': _('Client PID'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'Title',
                        'width': '60',
                        'label': _('Fullname'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'UID',
                        'hidden': True
                    },
                ],
                ui_item='ClientPatientID',
                search_query='',
                discard_empty=('ClientPatientID', ),
                search_fields=('ClientPatientID', ),
                portal_types=('Patient', ),
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'visible'
                },
                catalog_name='bika_patient_catalog',
                base_query={'inactive_state': 'active'},
                showOn=True,
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        schematas['default'] = [
            'id',
            'title',
            'description',
            'BatchID',
            'ClientPatientID',
            'Patient',
            # 'PatientID',
            # 'PatientUID',
            # 'PatientTitle',
            'Client',
            # 'ClientID',
            # 'ClientUID',
            # 'ClientTitle',
            'ClientBatchID',
            'Doctor',
            # 'DoctorID',
            # 'DoctorUID',
            # 'DoctorTitle',
            'BatchDate',
            'OnsetDate',
            'PatientAgeAtCaseOnsetDate',
            'OnsetDateEstimated',
            'HoursFasting',
            'PatientCondition',
            'BasalBodyTemperature',
            'MenstrualStatus',
            'Symptoms',
            'ProvisionalDiagnosis',
            'CaseStatus',
            'CaseOutcome',
            'AetiologicAgents',
            'AdditionalNotes',
            'Remarks',
            'PatientBirthDate',
            'BatchLabels',
            'InheritedObjects',
            'InheritedObjectsUI',
        ]
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 6
0
        default_method=DateTime,
        widget=CalendarWidget(
            label='Date and Time Received',
            description='Select the date and time the biospecimen is received.',
            ampm=1,
            visible={'edit': 'visible', 'view': 'visible'}
        )
    ),

    DateTimeField(
        'DateCreated',
        mode="rw",
        read_permission=permissions.View,
        write_permission=permissions.ModifyPortalContent,
        widget=DateTimeWidget(
            label=_("Date Created"),
            visible={'edit': 'invisible', 'view': 'invisible'},
        )
    ),
))

schema['title'].widget.visible = {'edit': 'visible', 'view': 'visible'}
schema['description'].widget.visible = {'edit': 'visible', 'view': 'visible'}
schema['description'].schemata = 'default'


class Biospecimen(ATFolder):
    implements(IBiospecimen, IConstrainTypes)
    security = ClassSecurityInfo()
    displayContentsTab = False
    schema = schema
    StringField('Type',
        vocabulary = "getMaintenanceTypes",
        widget = ReferenceWidget(
            checkbox_bound = 1,
            label = _("Maintenance type",
                      "Type"),
        ),
    ),

    DateTimeField('DownFrom',
        with_time = 1,
        with_date = 1,
        required = 1,
        widget = DateTimeWidget(
            label = _("From"),
            description = _("Date from which the instrument is under maintenance"),
            show_hm = True,
        ),
    ),

    DateTimeField('DownTo',
        with_time = 1,
        with_date = 1,
        widget = DateTimeWidget(
            label = _("To"),
            description = _("Date until the instrument will not be available"),
            show_hm = True,
        ),
    ),

    StringField('Maintainer',
Esempio n. 8
0
# from Products.Archetypes.interfaces.vocabulary import IVocabulary
# from plone.registry.interfaces import IRegistry
# from Products.Archetypes.utils import DisplayList
#
# import sys

AuditDate = DateTimeField(
    'AuditDate',
    mode="rw",
    required=True,
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    widget=DateTimeWidget(
        label=_("Audit Date"),
        description=_("Date that this audit entry was created."),
        show_time=True,
        visible={
            'edit': 'visible',
            'view': 'visible'
        }))

AuditUser = StringField(
    'AuditUser',
    widget=StringWidget(
        label=_('Audit User'),
        description=_(
            'User that was involved in the creation of this audit entry.'),
        visible={
            'view': 'visible',
            'edit': 'visible'
        }))
Esempio n. 9
0
class AnalysisRequestSchemaExtender(object):
    adapts(IAnalysisRequest)
    implements(IOrderableSchemaExtender)

    def __init__(self, context):
        self.context = context

    fields = [
        ExtProxyField("ParticipantID",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      widget=StringWidget(
                          label=_("Participant ID"),
                          maxlength=22,
                          size=22,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField("OtherParticipantReference",
                      proxy="context.getSample()",
                      mode="rw",
                      required=0,
                      widget=StringWidget(
                          label=_("Other Participant Ref"),
                          maxlength=12,
                          size=12,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField("ParticipantInitials",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      widget=StringWidget(
                          label=_("Participant Initials"),
                          maxlength=3,
                          size=2,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField("Gender",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      vocabulary=GENDERS,
                      widget=SelectionWidget(
                          format="radio",
                          label=_("Gender"),
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField("Visit",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      widget=StringWidget(
                          label=_("Visit Number"),
                          maxlength=4,
                          size=4,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField(
            "Fasting",
            proxy="context.getSample()",
            mode="rw",
            required=0,
            default=False,
            widget=BooleanWidget(
                format="radio",
                label=_("Fasting"),
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible'
                },
            ),
        ),
        ExtProxyField(
            'DateOfBirth',
            proxy="context.getSample()",
            mode="rw",
            required=1,
            widget=DateTimeWidget(
                label=_('Date of Birth'),
                datepicker_nofuture=1,
                show_time=False,
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible'
                },
            ),
        ),
        ExtProxyField("Volume",
                      proxy="context.getSample()",
                      mode="rw",
                      required=1,
                      widget=StringWidget(
                          label=_("Estimated Sample Volume"),
                          maxlength=8,
                          size=8,
                          render_own_label=True,
                          visible={
                              'edit': 'visible',
                              'view': 'visible',
                              'add': 'edit',
                              'header_table': 'visible'
                          },
                      )),
        ExtProxyField(
            "OtherInformation",
            proxy="context.getSample()",
            mode="rw",
            default_content_type="text/plain",
            allowable_content_types=("text/plain", ),
            default_output_type="text/plain",
            widget=TextAreaWidget(
                label=_("Other relevant clinical information"),
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible'
                },
            ),
        ),
        ExtProxyField(
            "Courier",
            proxy="context.getSample()",
            required=0,
            allowed_types='Courier',
            relationship='AnalysisRequestCourier',
            mode="rw",
            read_permission=View,
            write_permission=ModifyPortalContent,
            widget=ReferenceWidget(
                label=_("Courier"),
                description=_("The person who delivered the sample"),
                render_own_label=True,
                visible={
                    'view': 'visible',
                    'edit': 'visible',
                    'add': 'invisible',
                    'header_table': 'visible',
                    'secondary': 'disabled',
                    'sample_registered': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'to_be_sampled': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'scheduled_sampling': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'to_be_preserved': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'sample_ordered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_prep': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'attachment_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'verified': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'published': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'invalid': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'rejected': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                catalog_name='bika_setup_catalog',
                base_query={'review_state': 'active'},
                showOn=True,
            ),
        ),

        # This Analysis Request is only for internal use?
        # This field is useful when we create Partitions (AR-like), so we don't
        # want the client to see Analysis Requests / Samples that are meant to
        # be used in the lab.
        ExtProxyField(
            "InternalUse",
            proxy="context.getSample()",
            mode="rw",
            required=0,
            default=False,
            widget=BooleanWidget(
                format="radio",
                label=_("Internal use"),
                render_own_label=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'add': 'edit',
                    'header_table': 'visible'
                },
            ),
        ),
        ExtProxyField(
            "PrimarySample",
            proxy="context.getSample()",
            required=0,
            allowed_types=('Sample'),
            relationship='SamplePrimarySample',
            mode="rw",
            read_permission=View,
            write_permission=ModifyPortalContent,
            widget=ReferenceWidget(
                label=_("Primary Sample"),
                description=_("The sample this is originated from"),
                size=20,
                render_own_label=True,
                visible={
                    'view': 'visible',
                    'edit': 'invisible',
                    'add': 'invisible',
                    'header_table': 'visible',
                    'secondary': 'disabled',
                },
                catalog_name='bika_catalog',
                base_query={'review_state': 'active'},
                showOn=False,
            ),
        ),
        ExtReferenceField(
            'PrimaryAnalysisRequest',
            allowed_types=('AnalysisRequest', ),
            relationship='AnalysisRequestPrimaryAnalysisRequest',
            referenceClass=HoldingReference,
            mode="rw",
            read_permission=View,
            write_permission=ModifyPortalContent,
            widget=ReferenceWidget(visible=False, ),
        ),
        ExtBooleanField(
            "PanicEmailAlertSent",
            default=False,
            widget=BooleanWidget(visible={
                'edit': 'invisible',
                'view': 'invisible',
                'add': 'invisible'
            }, ),
        )
    ]

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 10
0
         visible={
             'add': 'edit',
         },
     ),
 ),
 ExtDateTimeField(
     'DateOfBirth',
     mode="rw",
     required=1,
     read_permission=View,
     write_permission=ModifyPortalContent,
     widget=DateTimeWidget(
         label=_('Date of Birth'),
         datepicker_nofuture=1,
         show_time=False,
         render_own_label=True,
         visible={
             'add': 'edit',
         },
     ),
 ),
 VolumeUnitField("Volume",
                 mode="rw",
                 required=1,
                 read_permission=View,
                 write_permission=ModifyPortalContent,
                 vocabulary=VOLUME_UNITS,
                 widget=VolumeUnitWidget(
                     label=_("Estimated Sample Volume"),
                     maxlength=8,
                     size=8,
Esempio n. 11
0
        required=1,
    ),
    BlobField('Pdf', ),
    StringField('SMS', ),
    RecordsField(
        'Recipients',
        type='recipients',
        subfields=('UID', 'Username', 'Fullname', 'EmailAddress',
                   'PublicationModes'),
    ),
    DateTimeField(
        'DatePrinted',
        mode="rw",
        widget=DateTimeWidget(label=_("Date Printed"),
                              visible={
                                  'edit': 'visible',
                                  'view': 'visible'
                              }),
    ),
))

schema['id'].required = False
schema['title'].required = False


class ARReport(BaseFolder):
    security = ClassSecurityInfo()
    displayContentsTab = False
    schema = schema

    _at_rename_after_creation = True
Esempio n. 12
0
            'edit': 'visible',
            'view': 'visible'
        },
    ))

SampleCollectionDate = DateTimeField(
    'SampleCollectionDate',
    schemata='Sample Collection and Processing',
    mode="rw",
    required=True,
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    widget=DateTimeWidget(
        label=_("Sample Collection Date"),
        description=_("The date on which the sample was collection."),
        visible={
            'edit': 'visible',
            'view': 'visible'
        }))

SampleReceivedDate = DateTimeField(
    'SampleReceivedDate',
    schemata='Sample Collection and Processing',
    mode="rw",
    required=True,
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    widget=DateTimeWidget(
        label=_("Sample Received Date"),
        description=_("The date on which the sample was received."),
        # show_time=True,
                allowed_types=('Instrument', ),
                relationship='InstrumentCalibrationInstrument',
                widget=StringWidget(visible=False, )),
 ComputedField(
     'InstrumentUID',
     expression=
     'context.getInstrument() and context.getInstrument().UID() or None',
     widget=ComputedWidget(visible=False, ),
 ),
 DateTimeField(
     'DownFrom',
     with_time=1,
     with_date=1,
     widget=DateTimeWidget(
         label=_("From"),
         description=_(
             "Date from which the instrument is under calibration"),
     ),
 ),
 DateTimeField(
     'DownTo',
     with_time=1,
     with_date=1,
     widget=DateTimeWidget(
         label=_("To"),
         description=_("Date until the instrument will not be available"),
     ),
 ),
 StringField('Calibrator',
             widget=StringWidget(
                 label=_("Calibrator"),
Esempio n. 14
0
    default_output_type="text/plain",
    widget=TextAreaWidget(
        label=_('Client Batch Comment'),
        description=_(
            "Additional comment to the batch provided by the client"),
    ))

SamplingDate = ExtDateTimeField(
    'SamplingDate',
    mode="rw",
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    widget=DateTimeWidget(
        label=_("Sampling Date"),
        size=20,
        visible={
            'edit': 'visible',
            'view': 'visible',
        },
    ))

StorageLocation = ExtReferenceField(
    'StorageLocation',
    allowed_types='StorageLocation',
    relationship='AnalysisRequestStorageLocation',
    mode="rw",
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    widget=brw(
        label=_("Storage Location"),
        description=_("Location where sample is kept"),
        size=20,
Esempio n. 15
0
 StringField('SamplePoint',
     searchable = True,
     widget = StringWidget(
         label = _("Sample Point"),
     ),
 ),
 StringField('Temperature',
     widget = StringWidget(
         label = _("Temperature"),
     ),
 ),
 DateTimeField('DateImported',
     required = 1,
     widget = DateTimeWidget(
         label = _("Date Imported"),
         size=12,
         visible={'edit': 'visible', 'view': 'visible', 'add': 'visible',
                  'secondary': 'invisible'},
     ),
 ),
 DateTimeField('DateApplied',
     widget = DateTimeWidget(
         label = _("Date Applied"),
         size=12,
         visible={'edit': 'visible', 'view': 'visible', 'add': 'visible',
                  'secondary': 'invisible'},
     ),
 ),
 IntegerField('NumberSamples',
     widget = IntegerWidget(
         label = _("Number of samples"),
     ),
Esempio n. 16
0
class BatchSchemaExtender(object):
    adapts(IBatch)
    implements(IOrderableSchemaExtender, IBrowserLayerAwareExtender)
    layer = INalLimsLayer
    security = ClassSecurityInfo()

    fields = [
        ExtDateTimeField(
            "SDGDate",
            required=True,
            widget=DateTimeWidget(
                label="Date Received",
                description="The Date the Sample Delivery Group was received by the lab.",
                show_time=False,
                datepicker_nofuture=1,
            )
        ),

        ExtStringField(
            'SDGTime',
            required=True,
            widget=StringWidget(
                label=_("Time Received"),
                description=_("The Time the Sample Delivery Group was received by the lab."),
            ),
        ),

        ExtStringField(
            'ReportContact',
            widget=StringWidget(
                label=_("Report Contact"),
                description=_("Optional field. Used if there is a secondary client the results are being tested for."),
            ),
        ),

        ExtReferenceField(
            'ProjectContact',
            required=True,
            default_method='getContactUIDForUser',
            allowed_types=('Contact',),
            referenceClass=HoldingReference,
            relationship="SDGProjectContact",
            mode="rw",
            widget=ReferenceWidget(
                label=_("Project Contact"),
                size=20,
                helper_js=("bika_widgets/referencewidget.js",
                           "++resource++bika.lims.js/contact.js"),
                description=_("The main contact for the project"),
                catalog_name="portal_catalog",
                base_query={"is_active": True,
                            "sort_limit": 50,
                            "sort_on": "sortable_title",
                            "sort_order": "ascending"},
                showOn=True,
                popup_width='400px',
                colModel=[
                    {'columnName': 'Fullname', 'width': '50',
                     'label': _('Name')},
                    {'columnName': 'EmailAddress', 'width': '50',
                     'label': _('Email Address')},
                ],
                ui_item='Fullname',
            ),
        ),

        ExtReferenceField(
            'SamplerContact',
            required=True,
            default_method='getContactUIDForUser',
            allowed_types=('Contact',),
            referenceClass=HoldingReference,
            relationship="SDGSamplerContact",
            mode="rw",
            widget=ReferenceWidget(
                label=_("Sampled By"),
                size=20,
                helper_js=("bika_widgets/referencewidget.js",
                           "++resource++bika.lims.js/contact.js"),
                description=_("The person who performed the sampling method."),
                catalog_name="portal_catalog",
                base_query={"is_active": True,
                            "sort_limit": 50,
                            "sort_on": "sortable_title",
                            "sort_order": "ascending"},
                showOn=True,
                popup_width='400px',
                colModel=[
                    {'columnName': 'Fullname', 'width': '50',
                     'label': _('Name')},
                    {'columnName': 'EmailAddress', 'width': '50',
                     'label': _('Email Address')},
                ],
                ui_item='Fullname',
            ),
        ),
        ExtFileField(
            'COC',
            widget=FileWidget(
                label="Chain Of Custody",
                description="Select a printed COC to attach.",
                visible=False,
            )
        ),
    ]

#Custom function for Contact Fields
    security.declarePublic('getContactUIDForUser')
    security.declarePublic('getCurrentDate')

    def getContactUIDForUser(self):
        """get the UID of the contact associated with the authenticated user
        """
        mt = getToolByName(self, 'portal_membership')
        user = mt.getAuthenticatedMember()
        user_id = user.getUserName()
        pc = getToolByName(self, 'portal_catalog')
        r = pc(portal_type='Contact',
               getUsername=user_id)
        if len(r) == 1:
            return r[0].UID

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 17
0
                {"columnName": "Hierarchy", "align": "left", "label": "Hierarchy", "width": "70"},
                {"columnName": "FreePositions", "align": "left", "label": "Free", "width": "10"},
            ],

        )
    )

DateCreation = DateTimeField(
    'DateCreated',
    mode="rw",
    required=True,
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    widget=DateTimeWidget(
        label=_("Date Created"),
        description=_("Define when the sample has been created."),
        show_time=True,
        visible={'edit': 'visible', 'view': 'visible'}
    )
)


SerumColour = StringField(
    'SerumColour',
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    vocabulary='getSerumColours',
    widget=BikaSelectionWidget(
        format='select',
        label=_("Colour of Plasma or Serum"),
        description=_("Indicate the colour of plasma or serum"),
        size=40,
Esempio n. 18
0
class BatchSchemaExtender(object):
    adapts(IBatch)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Doctor',
            required=1,
            multiValued=0,
            allowed_types=('Doctor', ),
            referenceClass=HoldingReference,
            relationship='BatchDoctor',
            widget=ReferenceWidget(
                label=_("Doctor"),
                description="",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible'
                },
                base_query={'is_active': True},
                catalog_name='portal_catalog',
                showOn=True,
                colModel=[
                    {
                        'columnName': 'DoctorID',
                        'width': '20',
                        'label': _('Doctor ID')
                    },
                    {
                        'columnName': 'Title',
                        'width': '80',
                        'label': _('Full Name')
                    },
                ],
            ),
        ),
        ExtReferenceField(
            'Patient',
            required=1,
            multiValued=0,
            allowed_types=('Patient', ),
            referenceClass=HoldingReference,
            relationship='BatchPatient',
            widget=ReferenceWidget(
                label=_("Patient"),
                description="",
                render_own_label=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible'
                },
                catalog_name='bikahealth_catalog_patient_listing',
                search_fields=('listing_searchable_text', ),
                base_query={
                    'is_active': True,
                    'sort_limit': 50,
                    'sort_on': 'getPatientID',
                    'sort_order': 'ascending'
                },
                colModel=[
                    {
                        'columnName': "getPatientID",
                        'width': '30',
                        'label': _('PID'),
                        'align': 'left'
                    },
                    {
                        'columnName': "getClientPatientID",
                        'width': '30',
                        'label': _('CPID'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'Title',
                        'width': '30',
                        'label': _('Title'),
                        'align': 'left'
                    },
                ],
                showOn=True,
            ),
        ),
        ExtDateTimeField(
            'OnsetDate',
            required=1,
            widget=DateTimeWidget(label=_('Onset Date'), ),
        ),
        ExtRecordsField(
            'PatientAgeAtCaseOnsetDate',
            widget=SplittedDateWidget(
                label=_('Patient Age at Case Onset Date'), ),
        ),
        ExtBooleanField(
            'OnsetDateEstimated',
            default=False,
            widget=BooleanWidget(label=_("Onset Date Estimated"), ),
        ),
        ExtRecordsField(
            'ProvisionalDiagnosis',
            type='provisionaldiagnosis',
            subfields=('Code', 'Title', 'Description', 'Onset'),
            # Temporary fix: https://github.com/bikalabs/bika.health/issues/89
            #required_subfields=('Title'),
            subfield_sizes={
                'Code': 7,
                'Title': 20,
                'Description': 35,
                'Onset': 10
            },
            subfield_labels={
                'Code': _('Code'),
                'Title': _('Provisional diagnosis'),
                'Description': _('Description'),
                'Onset': _('Onset')
            },
            subfield_types={'Onset': 'datepicker_nofuture'},
            widget=RecordsWidget(
                label='Provisional diagnosis',
                combogrid_options={
                    'Title': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbytitle',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                    'Code': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbycode',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                    'Description': {
                        'colModel': [{
                            'columnName': 'Code',
                            'width': '10',
                            'label': _('Code')
                        }, {
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Title')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _('Description')
                        }],
                        'url':
                        'getsymptomsbydesc',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                },
            ),
        ),
        ExtTextField(
            'AdditionalNotes',
            default_content_type='text/plain',
            allowable_content_types=('text/plain', ),
            default_output_type="text/plain",
            widget=TextAreaWidget(label=_('Additional notes'), ),
        ),
        ExtLinesField(
            'CaseStatus',
            vocabulary=getCaseStatus(),
            widget=MultiSelectionWidget(format='checkbox',
                                        label=_("Case status")),
        ),
        ExtLinesField(
            'CaseOutcome',
            vocabulary=getCaseOutcome(),
            widget=MultiSelectionWidget(format='checkbox',
                                        label=_("Case outcome")),
        ),
        ExtRecordsField(
            'Symptoms',
            type='symptoms',
            subfields=('UID', 'Title', 'Description', 'Severity'),
            widget=CaseSymptomsWidget(label='Symptoms', ),
        ),
        ExtRecordsField(
            'AetiologicAgents',
            type='aetiologicagents',
            subfields=('Title', 'Description', 'Subtype'),
            subfield_sizes={
                'Title': 15,
                'Description': 25,
                'Subtype': 10
            },
            subfield_labels={
                'Title': _('Aetiologic agent'),
                'Description': _b('Description'),
                'Subtype': _('Subtype')
            },
            # Temporary fix: https://github.com/bikalabs/bika.health/issues/89
            # required_subfields=('Title'),
            widget=RecordsWidget(
                label='Aetiologic agents',
                combogrid_options={
                    'Title': {
                        'colModel': [{
                            'columnName': 'Title',
                            'width': '30',
                            'label': _('Aetiologic agent')
                        }, {
                            'columnName': 'Description',
                            'width': '60',
                            'label': _b('Description')
                        }, {
                            'columnName': 'Subtype',
                            'width': '30',
                            'label': _('Subtype')
                        }],
                        'url':
                        'getaetiologicagents',
                        'showOn':
                        True,
                        'width':
                        "650px",
                    },
                },
            ),
        ),
        ExtIntegerField(
            'HoursFasting',
            required=0,
            widget=IntegerWidget(label=_('Hours fasting'), ),
        ),
        ExtRecordsField(
            'PatientCondition',
            widget=CasePatientConditionWidget(label='Patient condition', ),
        ),
        ExtRecordsField(
            'MenstrualStatus',
            widget=CaseMenstrualStatusWidget(label='Menstrual status', ),
        ),
        ExtRecordsField(
            'BasalBodyTemperature',
            widget=CaseBasalBodyTempWidget(label='Basal body temperature', ),
        ),
        ExtStringField(
            'ClientPatientID',
            required=0,
            widget=ReferenceWidget(
                label=_b("Client Patient ID"),
                size=20,
                visible={
                    'edit': 'invisible',
                    'view': 'visible',
                    'add': 'edit'
                },
                catalog_name='bikahealth_catalog_patient_listing',
                portal_types=('Patient', ),
                search_fields=('getClientPatientID', ),
                base_query={
                    'is_active': True,
                    'sort_limit': 50,
                    'sort_on': 'getClientPatientID',
                    'sort_order': 'ascending'
                },
                force_all=False,
                colModel=[
                    {
                        'columnName': "getPatientID",
                        'width': '30',
                        'label': _('PID'),
                        'align': 'left'
                    },
                    {
                        'columnName': "getClientPatientID",
                        'width': '30',
                        'label': _('CPID'),
                        'align': 'left'
                    },
                    {
                        'columnName': 'Title',
                        'width': '30',
                        'label': _('Fullname'),
                        'align': 'left'
                    },
                    # UID is required in colModel
                    {
                        'columnName': 'UID',
                        'hidden': True
                    },
                ],
                ui_item="getClientPatientID",
                showOn=False,
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        schematas['default'] = [
            'id',
            'title',
            'description',
            'BatchID',
            'Client',
            'ClientBatchID',
            'ClientPatientID',
            'Patient',
            'Doctor',
            'BatchDate',
            'OnsetDate',
            'OnsetDateEstimated',
            'PatientAgeAtCaseOnsetDate',
            'HoursFasting',
            'PatientCondition',
            'BasalBodyTemperature',
            'MenstrualStatus',
            'Symptoms',
            'ProvisionalDiagnosis',
            'CaseStatus',
            'CaseOutcome',
            'AetiologicAgents',
            'AdditionalNotes',
            'Remarks',
            'BatchLabels',
        ]
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 19
0
class AnalysisRequestSchemaExtender(object):
    adapts(IAnalysisRequest)
    implements(IOrderableSchemaExtender, IBrowserLayerAwareExtender)
    layer = INalLimsLayer

    fields = [
        ExtStringField(
            'PlantType',
            widget=StringWidget(
                label="Plant Type (Sap Samples)",
                description="The Plant Species or Crop the sample was taken from",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtStringField(
            'Variety',
            widget=StringWidget(
                label="Variety (Sap Samples)",
                description="The Plant Variety or Cultivar the sample was taken from",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtStringField(
            'GrowthStage',
            widget=StringWidget(
                label="Growth Stage (Sap Samples)",
                description="The development stage of the plant the sample was taken from",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtBooleanField(
            'NewLeaf',
            widget=BooleanWidget(
                label="New Leaf (Sap Samples)",
                description="The sample is from the new growth of a plant",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtStringField(
            'InternalLabID',
            widget=StringWidget(
                label="Internal Lab Sample ID",
                description="The Lab ID from a printed COC (Ex. '001')",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtDateTimeField(
            'DateOfSampling',
            required=1,
            widget=DateTimeWidget(
                label="Date Sampled",
                description="The Date the sample was taken",
                render_own_label=True,
                show_time=False,
                datepicker_nofuture=1,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),

        ExtStringField(
            'TimeOfSampling',
            widget=StringWidget(
                label="Time Sampled",
                description="The time of day the sample was taken",
                render_own_label=True,
                visible={
                    'edit':'visible',
                    'view':'visible',
                    'add':'edit',
                    'header_table':'visible',
                },
            )
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 20
0
class SampleSchemaExtender(object):
    adapts(ISample)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Project',
            required=True,
            allowed_types=('Project', ),
            relationship='SampleProject',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=bika_ReferenceWidget(
                label=_("Project"),
                description=_("Select the project of the sample."),
                render_own_label=True,
                size=50,
                # catalog_name='bika_catalog',
                # visible=False,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                base_query={'inactive_state': 'active'},
                colModel=[{
                    "columnName": "UID",
                    "hidden": True
                }, {
                    "columnName": "Title",
                    "align": "left",
                    "width": "60",
                    "label": "Title"
                }, {
                    "columnName": "Description",
                    "align": "left",
                    "label": "Description",
                    "width": "40"
                }],
                showOn=True,
            )),
        ExtBooleanField(
            'WillReturnFromShipment',
            default=False,
            # write_permission = ManageClients,
            widget=BooleanWidget(
                label=_("Will Return From Shipment"),
                description=_("Indicates if sample will return if shipped."),
                visible={
                    'edit': 'invisible',
                    'view': 'invisible',
                    'header_table': 'invisible',
                    'sample_registered': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            ),
        ),
        ExtReferenceField(
            'Kit',
            vocabulary_display_path_bound=sys.maxint,
            allowed_types=('Kit', ),
            relationship='SampleKit',
            referenceClass=HoldingReference,
            widget=bika_ReferenceWidget(
                label=_("Kit"),
                catalog_name='bika_catalog',
                # visible=False,
                visible={
                    'view': 'visible',
                    'edit': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                showOn=True,
                render_own_label=True,
                description=_("Select the kit of the sample if exists."),
            ),
        ),
        ExtReferenceField(
            'SampleType',
            required=1,
            vocabulary_display_path_bound=sys.maxsize,
            allowed_types=('SampleType', ),
            relationship='SampleSampleType',
            referenceClass=HoldingReference,
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=bika_ReferenceWidget(
                label=_("Sample Type"),
                render_own_label=True,
                size=60,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'to_be_sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'scheduled_sampling': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'to_be_preserved': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'rejected': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                catalog_name='bika_setup_catalog',
                base_query={'inactive_state': 'active'},
                colModel=[{
                    'columnName': 'UID',
                    'hidden': True
                }, {
                    'columnName': 'Title',
                    "align": "left",
                    'width': '60',
                    'label': _('Title')
                }, {
                    "columnName": "Description",
                    "align": "left",
                    "label": "Description",
                    "width": "40"
                }],
                showOn=True,
            ),
        ),
        ExtReferenceField(
            'Batch',
            vocabulary_display_path_bound=sys.maxint,
            allowed_types=('SampleBatch', ),
            relationship='SampleBatch',
            referenceClass=HoldingReference,
            widget=bika_ReferenceWidget(
                label=_("Batch"),
                catalog_name='bika_catalog',
                visible={
                    'view': 'invisible',
                    'edit': 'invisible',
                    'header_table': 'invisible',
                    'sample_registered': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                },
                showOn=True,
                render_own_label=True,
                description=_("Batch."),
            ),
        ),
        ExtReferenceField(
            'StorageLocation',
            #required=True,
            allowed_types=('StoragePosition', ),
            relationship='ItemStorageLocation',
            widget=bika_ReferenceWidget(
                label=_("Storage Location"),
                description=_("Location where item is kept"),
                size=50,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                catalog_name='portal_catalog',
                showOn=True,
                render_own_label=True,
                base_query={
                    'inactive_state': 'active',
                    'review_state': 'available',
                    'object_provides': ISampleStorageLocation.__identifier__
                },
                colModel=[{
                    'columnName': 'UID',
                    'hidden': True
                }, {
                    'columnName': 'Title',
                    "align": "left",
                    'width': '100',
                    'label': _('Title')
                }],
            )),
        ExtReferenceField(
            'ReservedLocation',
            # required=True,
            allowed_types=('StoragePosition', ),
            relationship='ReservedItemStorageLocation',
            widget=bika_ReferenceWidget(
                label=_("Reserved Storage Location"),
                description=_("Location reserved for this sample"),
                size=40,
                visible={
                    'edit': 'invisible',
                    'view': 'invisible'
                },
                catalog_name='portal_catalog',
            )),
        ExtReferenceField(
            'SampleCondition',
            allowed_types=('SampleCondition', ),
            relationship='SampleSampleCondition',
            widget=bika_ReferenceWidget(visible=False, ),
        ),
        ExtStringField(
            'SubjectID',
            required=1,
            searchable=True,
            widget=StringWidget(
                label=_("Subject ID"),
                description=_("Human-subject ID the specimen is taken from."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField('Barcode',
                       required=0,
                       searchable=True,
                       widget=StringWidget(
                           label=_("Barcode"),
                           description=_("Biospecimen barcode."),
                           visible={
                               'edit': 'visible',
                               'view': 'visible',
                               'header_table': 'visible',
                               'sample_registered': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'sample_due': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'sampled': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_received': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'expired': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'disposed': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                           },
                           render_own_label=True,
                       )),
        ExtFixedPointField(
            'Volume',
            required=1,
            default="0.00",
            widget=DecimalWidget(
                label=_("Volume"),
                size=15,
                description=
                _("The volume of the biospecimen taken from the subject. For placenta parent biospecimen, enter Placenta Weight here."
                  ),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField(
            'ChangeUserName',
            widget=StringWidget(
                label=_('ChangeUserName'),
                description=_(
                    'The user who created or last made a change to this sample.'
                ),
                visible={
                    'view': 'invisible',
                    'edit': 'invisible'
                })),
        ExtDateTimeField(
            'ChangeDateTime',
            widget=StringWidget(
                label=_('ChangeDateTime'),
                description=
                _('The date and time when the sample was created or last updated.'
                  ),
                visible={
                    'view': 'invisible',
                    'edit': 'invisible'
                })),
        ExtStringField(
            'Unit',
            required=1,
            default="",
            # vocabulary=UnitsVocabulary(),
            vocabulary='getUnits',
            # widget=SelectionWidget(
            widget=BikaSelectionWidget(
                format='select',
                label=_("Unit"),
                description=_('The unit for Volume'),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
                showOn=True,
            )),
        ExtStringField(
            'BabyNumber',
            default="0",
            vocabulary='getBabyNumber',
            # widget=SelectionWidget(
            widget=BikaSelectionWidget(
                format='select',
                label=_("Baby No. (if applicable)"),
                description=
                _('Indicate baby number if the sample is collected from a baby.'
                  ),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                },
                render_own_label=True,
                showOn=True,
            )),
        ExtReferenceField(
            'LinkedSample',
            vocabulary_display_path_bound=sys.maxsize,
            multiValue=1,
            allowed_types=('Sample', ),
            relationship='SampleSample',
            referenceClass=HoldingReference,
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=bika_ReferenceWidget(
                label=_("Parent Biospecimen"),
                description=_(
                    "Create an Aliquot of the biospecimen selected."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                showOn=True,
                render_own_label=True,
                base_query={
                    'cancellation_state': 'active',
                    'review_state': 'sample_received'
                },
                colModel=[{
                    'columnName': 'UID',
                    'hidden': True
                }, {
                    'columnName': 'Title',
                    'width': '50',
                    'label': _('Title')
                }, {
                    "columnName": "LocationTitle",
                    "align": "left",
                    "label": "Location",
                    "width": "50"
                }],
            ),
        ),
        ExtDateTimeField(
            'DateCreated',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=DateTimeWidget(
                label=_("Date Created"),
                description=_("Define when the sample has been created."),
                show_time=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'invisible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            ),
        ),
        ExtComputedField(
            'LocationTitle',
            searchable=True,
            expression=
            "here.getStorageLocation() and here.getStorageLocation().Title() or ''",
            widget=ComputedWidget(visible=False, ),
        ),
        ExtDateTimeField(
            'FrozenTime',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=DateTimeWidget(
                label=_("Frozen Time"),
                description=_("Define when this aliquot was frozen."),
                show_time=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'invisible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        sch = schematas['default']
        sch.remove('Project')
        sch.remove('Kit')
        sch.insert(sch.index('SampleType'), 'Project')
        sch.insert(sch.index('SampleType'), 'Kit')
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 21
0
              widget=BooleanWidget(
                  label=_("Internal Certificate"),
                  description=_(
                      "Select if is an in-house calibration certificate"))),
 StringField(
     'Agency',
     widget=StringWidget(
         label=_("Agency"),
         description=
         _("Organization responsible of granting the calibration certificate"
           )),
 ),
 DateTimeField(
     'Date',
     widget=DateTimeWidget(
         label=_("Date"),
         description=_("Date when the calibration certificate was granted"),
     ),
 ),
 StringField(
     'ExpirationInterval',
     vocabulary="getInterval",
     widget=ComboBoxWidget(
         label=_("Interval"),
         description=_("The interval is calculated from the 'From' field "
                       "and defines when the certificate expires in days. "
                       "Setting this inverval overwrites the 'To' field "
                       "on save."),
         default="",
         # configures the HTML input attributes for the additional field
         field_config={
             "type": "number",
Esempio n. 22
0
class SampleSchemaExtender(object):
    adapts(ISample)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField('Kit',
                          vocabulary_display_path_bound=sys.maxint,
                          allowed_types=('Kit', ),
                          relationship='SampleKit',
                          referenceClass=HoldingReference,
                          widget=bika_ReferenceWidget(
                              label=_("Kit"),
                              catalog_name='bika_catalog',
                              visible={
                                  'view': 'invisible',
                                  'edit': 'visible',
                                  'header_table': 'visible',
                                  'sample_registered': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_due': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sampled': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_received': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'expired': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'disposed': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                              },
                              render_own_label=True,
                          )),
        ExtReferenceField('StorageLocation',
                          allowed_types=('UnmanagedStorage',
                                         'StoragePosition'),
                          relationship='ItemStorageLocation',
                          widget=bika_ReferenceWidget(
                              label=_("Storage Location"),
                              description=_("Location where item is kept"),
                              size=40,
                              visible={
                                  'edit': 'visible',
                                  'view': 'visible',
                                  'header_table': 'visible',
                                  'sample_registered': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_due': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sampled': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_received': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'expired': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'disposed': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                              },
                              catalog_name='bika_setup_catalog',
                              showOn=True,
                              render_own_label=True,
                              base_query={
                                  'inactive_state':
                                  'active',
                                  'review_state':
                                  'available',
                                  'object_provides':
                                  IBioSpecimenStorage.__identifier__
                              },
                              colModel=[{
                                  'columnName': 'UID',
                                  'hidden': True
                              }, {
                                  'columnName': 'Title',
                                  'width': '50',
                                  'label': _('Title')
                              }, {
                                  "columnName": "Hierarchy",
                                  "align": "left",
                                  "label": "Hierarchy",
                                  "width": "50"
                              }],
                          )),
        ExtStringField(
            'SubjectID',
            searchable=True,
            widget=StringWidget(
                label=_("Subject ID"),
                description=_("Human-subject ID the specimen is taken from."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField('Barcode',
                       searchable=True,
                       widget=StringWidget(
                           label=_("Barcode"),
                           description=_("Biospecimen barcode."),
                           visible={
                               'edit': 'visible',
                               'view': 'visible',
                               'header_table': 'visible',
                               'sample_registered': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_due': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sampled': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_received': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'expired': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'disposed': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                           },
                           render_own_label=True,
                       )),
        ExtFixedPointField(
            'Volume',
            required=1,
            default="0.00",
            widget=DecimalWidget(
                label=_("Volume"),
                size=15,
                description=_(
                    "The The volume of the biospecimen taken from the subject."
                ),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField('Unit',
                       widget=StringWidget(
                           label=_("Unit"),
                           visible={
                               'edit': 'visible',
                               'view': 'visible',
                               'header_table': 'visible',
                               'sample_registered': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'sample_due': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sampled': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_received': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'expired': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'disposed': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                           },
                           render_own_label=True,
                       )),
        ExtReferenceField(
            'LinkedSample',
            vocabulary_display_path_bound=sys.maxsize,
            multiValue=1,
            allowed_types=('Sample', ),
            relationship='SampleSample',
            referenceClass=HoldingReference,
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=ReferenceWidget(
                label=_("Biospecimen"),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            ),
        ),
        ExtDateTimeField(
            'DateCreated',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=DateTimeWidget(
                label=_("Date Created"),
                description=_("Define when the sample has been created."),
                show_time=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'invisible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 23
0
            label=_("Location"),
            description=_(
                "The room and location where the instrument is installed"),
        )),
    ImageField(
        'Photo',
        schemata='Additional info.',
        widget=ImageWidget(
            label=_("Photo image file"),
            description=_("Photo of the instrument"),
        ),
    ),
    DateTimeField('InstallationDate',
                  schemata='Additional info.',
                  widget=DateTimeWidget(
                      label=_("InstallationDate"),
                      description=_("The date the instrument was installed"),
                  )),
    FileField('InstallationCertificate',
              schemata='Additional info.',
              widget=FileWidget(
                  label=_("Installation Certificate"),
                  description=_("Installation certificate upload"),
              )),
))

schema.moveField('AssetNumber', before='description')
schema.moveField('ManufacturerName', before='Supplier')
schema.moveField('InstrumentTypeName', before='ManufacturerName')

schema['description'].widget.visible = True
schema['description'].schemata = 'default'
Esempio n. 24
0
         label=_('Gender'),
     ),
 ),
 StringField(
     'Age',
     widget=StringWidget(
         label=_('Age'),
         visible=0,
         width=3,
     ),
 ),
 DateTimeField(
     'BirthDate',
     required=0,
     validators=('isDateFormat', ),
     widget=DateTimeWidget(label=_('Birth date'), ),
 ),
 BooleanField(
     'BirthDateEstimated',
     default=False,
     widget=BooleanWidget(label=_('Birth date is estimated'), ),
 ),
 RecordsField(
     'AgeSplitted',
     required=1,
     widget=SplittedDateWidget(label=_('Age'), ),
 ),
 AddressField(
     'CountryState',
     widget=AddressWidget(
         label=_("Country and state"),
Esempio n. 25
0
            checkbox_bound=0,
            format='select',
            visible=True,
            default='a',
        ),
    ),
    StringField(
        'AttachmentKeys',
        searchable=True,
        widget=StringWidget(label=_("Attachment Keys"), ),
    ),
    DateTimeField(
        'DateLoaded',
        required=1,
        default_method='current_date',
        widget=DateTimeWidget(label=_("Date Loaded"), ),
    ),
    ComputedField(
        'AttachmentTypeUID',
        expression=
        "context.getAttachmentType().UID() if context.getAttachmentType() else ''",
        widget=ComputedWidget(visible=False, ),
    ),
    ComputedField(
        'ClientUID',
        expression='here.aq_parent.UID()',
        widget=ComputedWidget(visible=False, ),
    ),
))

schema['id'].required = False
Esempio n. 26
0
class SampleSchemaExtender(object):
    adapts(ISample)
    implements(IOrderableSchemaExtender)

    fields = [
        ExtReferenceField(
            'Project',
            required=True,
            allowed_types=('Project', ),
            relationship='InvoiceProject',
            referenceClass=HoldingReference,
            widget=bika_ReferenceWidget(
                label=_("Project"),
                # catalog_name='bika_catalog',
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                size=30,
                showOn=True,
                render_own_label=True,
                description=_("Select the project of the sample."),
            )),
        ExtReferenceField(
            'DiseaseOntology',
            allowed_types=('DiseaseOntology', ),
            relationship='SampleOntology',
            referenceClass=HoldingReference,
            widget=bika_ReferenceWidget(
                label=_("Disease Ontology"),
                catalog_name='bika_catalog',
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                size=30,
                showOn=True,
                render_own_label=True,
                description=_("Select disease ontology of the sample."),
            )),
        ExtBooleanField(
            'AllowSharing',
            default=False,
            # write_permission = ManageClients,
            widget=BooleanWidget(
                label=_("Allow Sharing"),
                description=_(
                    "Check to allow researchers to share sample freely."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                },
                render_own_label=True,
            ),
        ),
        ExtBooleanField(
            'WillReturnFromShipment',
            default=False,
            # write_permission = ManageClients,
            widget=BooleanWidget(
                label=_("Will Return From Shipment"),
                description=_("Indicates if sample will return if shipped."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                },
                render_own_label=True,
            ),
        ),
        ExtReferenceField('Donor',
                          required=0,
                          allowed_types=('SampleDonor', ),
                          relationship='SampleDonor',
                          referenceClass=HoldingReference,
                          widget=bika_ReferenceWidget(
                              label=_("Sample Donor"),
                              catalog_name='bika_catalog',
                              visible={
                                  'edit': 'visible',
                                  'view': 'visible',
                                  'header_table': 'visible',
                                  'sample_registered': {
                                      'view': 'visible',
                                      'edit': 'visible'
                                  },
                                  'sample_due': {
                                      'view': 'visible',
                                      'edit': 'visible'
                                  },
                                  'sampled': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'sample_received': {
                                      'view': 'visible',
                                      'edit': 'visible'
                                  },
                                  'expired': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                                  'disposed': {
                                      'view': 'visible',
                                      'edit': 'invisible'
                                  },
                              },
                              size=30,
                              showOn=True,
                              description=_("Select the sample donor."),
                          )),
        ExtReferenceField(
            'Kit',
            vocabulary_display_path_bound=sys.maxint,
            allowed_types=('Kit', ),
            relationship='SampleKit',
            referenceClass=HoldingReference,
            widget=bika_ReferenceWidget(
                label=_("Kit"),
                catalog_name='bika_catalog',
                visible={
                    'view': 'visible',
                    'edit': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                showOn=True,
                render_own_label=True,
                description=_("Select the kit of the sample if exists."),
            ),
        ),
        ExtReferenceField(
            'Batch',
            vocabulary_display_path_bound=sys.maxint,
            allowed_types=('SampleBatch', ),
            relationship='SampleBatch',
            referenceClass=HoldingReference,
            widget=bika_ReferenceWidget(
                label=_("Batch"),
                catalog_name='bika_catalog',
                visible={
                    'view': 'invisible',
                    'edit': 'invisible',
                    'header_table': 'invisible',
                    'sample_registered': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'sample_due': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'invisible',
                        'edit': 'invisible'
                    },
                },
                showOn=True,
                render_own_label=True,
                description=_("Batch."),
            ),
        ),
        ExtReferenceField(
            'StorageLocation',
            #required=True,
            allowed_types=('StoragePosition', ),
            relationship='ItemStorageLocation',
            widget=bika_ReferenceWidget(
                label=_("Storage Location"),
                description=_("Location where item is kept"),
                size=40,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                catalog_name='portal_catalog',
                showOn=True,
                render_own_label=True,
                base_query={
                    'inactive_state': 'active',
                    'review_state': 'available',
                    'object_provides': ISampleStorageLocation.__identifier__
                },
                colModel=[{
                    'columnName': 'UID',
                    'hidden': True
                }, {
                    'columnName': 'Title',
                    'width': '50',
                    'label': _('Title')
                }],
            )),
        ExtReferenceField(
            'ReservedLocation',
            # required=True,
            allowed_types=('StoragePosition', ),
            relationship='ReservedItemStorageLocation',
            widget=bika_ReferenceWidget(
                label=_("Reserved Storage Location"),
                description=_("Location reserved for this sample"),
                size=40,
                visible={
                    'edit': 'invisible',
                    'view': 'invisible'
                },
                catalog_name='portal_catalog',
            )),
        ExtStringField(
            'SubjectID',
            searchable=True,
            widget=StringWidget(
                label=_("Subject ID"),
                description=_("Human-subject ID the specimen is taken from."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField('Barcode',
                       required=0,
                       searchable=True,
                       widget=StringWidget(
                           label=_("Barcode"),
                           description=_("Biospecimen barcode."),
                           visible={
                               'edit': 'visible',
                               'view': 'visible',
                               'header_table': 'visible',
                               'sample_registered': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'sample_due': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'sampled': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_received': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'expired': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'disposed': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                           },
                           render_own_label=True,
                       )),
        ExtFixedPointField(
            'Volume',
            required=1,
            default="0.00",
            widget=DecimalWidget(
                label=_("Volume"),
                size=15,
                description=_(
                    "The volume of the biospecimen taken from the subject."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField('Unit',
                       default="ml",
                       widget=StringWidget(
                           label=_("Unit"),
                           visible={
                               'edit': 'visible',
                               'view': 'visible',
                               'header_table': 'visible',
                               'sample_registered': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'sample_due': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'sampled': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'sample_received': {
                                   'view': 'visible',
                                   'edit': 'visible'
                               },
                               'expired': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                               'disposed': {
                                   'view': 'visible',
                                   'edit': 'invisible'
                               },
                           },
                           render_own_label=True,
                       )),
        ExtReferenceField(
            'LinkedSample',
            vocabulary_display_path_bound=sys.maxsize,
            multiValue=1,
            allowed_types=('Sample', ),
            relationship='SampleSample',
            referenceClass=HoldingReference,
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=bika_ReferenceWidget(
                label=_("Parent Biospecimen"),
                description=_(
                    "Create an Aliquot of the biospecimen selected."),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                showOn=True,
                render_own_label=True,
                base_query={
                    'cancellation_state': 'active',
                    'review_state': 'sample_received'
                },
                colModel=[{
                    'columnName': 'UID',
                    'hidden': True
                }, {
                    'columnName': 'Title',
                    'width': '50',
                    'label': _('Title')
                }, {
                    "columnName": "LocationTitle",
                    "align": "left",
                    "label": "Location",
                    "width": "50"
                }],
            ),
        ),
        ExtDateTimeField(
            'DateCreated',
            mode="rw",
            read_permission=permissions.View,
            write_permission=permissions.ModifyPortalContent,
            widget=DateTimeWidget(
                label=_("Date Created"),
                description=_("Define when the sample has been created."),
                show_time=True,
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'invisible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            ),
        ),
        ExtComputedField(
            'LocationTitle',
            searchable=True,
            expression=
            "here.getStorageLocation() and here.getStorageLocation().Title() or ''",
            widget=ComputedWidget(visible=False, ),
        ),
        ExtStringField(
            'AnatomicalSiteTerm',
            searchable=True,
            widget=StringWidget(
                label=_("Anatomical site term"),
                description=_(
                    'The ICD-O-3 topography code for describing the anatomical source of '
                    'the sampled material'),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
        ExtStringField(
            'AnatomicalSiteDescription',
            widget=TextAreaWidget(
                label=_("Anatomical site description"),
                description=
                _('The anatomical position of the body where the solid sample was taken from'
                  ),
                visible={
                    'edit': 'visible',
                    'view': 'visible',
                    'header_table': 'visible',
                    'sample_registered': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sample_due': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'sampled': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'sample_received': {
                        'view': 'visible',
                        'edit': 'visible'
                    },
                    'expired': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                    'disposed': {
                        'view': 'visible',
                        'edit': 'invisible'
                    },
                },
                render_own_label=True,
            )),
    ]

    def __init__(self, context):
        self.context = context

    def getOrder(self, schematas):
        sch = schematas['default']
        sch.remove('Project')
        sch.remove('Kit')
        sch.insert(sch.index('SampleType'), 'Project')
        sch.insert(sch.index('SampleType'), 'Kit')
        return schematas

    def getFields(self):
        return self.fields
Esempio n. 27
0
    'ResultDM'
)

# If the analysis has previously been retracted, this flag is set True
# to indicate that this is a re-test.
Retested = BooleanField(
    'Retested',
    default=False
)

# When the AR is published, the date of publication is recorded here.
# It's used to populate catalog values.
DateAnalysisPublished = DateTimeField(
    'DateAnalysisPublished',
    widget=DateTimeWidget(
        label=_("Date Published")
    )
)

# If the result is outside of the detection limits of the method or instrument,
# the operand (< or >) is stored here.  For routine analyses this is taken
# from the Result, if the result entered explicitly startswith "<" or ">"
DetectionLimitOperand = StringField(
    'DetectionLimitOperand'
)

# The ID of the logged in user who submitted the result for this Analysis.
Analyst = StringField(
    'Analyst'
)
Esempio n. 28
0
                "align": "left",
                "label": "Free",
                "width": "10"
            },
        ],
    ))

DateCreation = DateTimeField(
    'DateCreated',
    mode="rw",
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    widget=DateTimeWidget(
        label=_("Date Created"),
        description=_("Define when the sample has been created."),
        show_time=True,
        visible={
            'edit': 'visible',
            'view': 'visible'
        }))

schema = BikaSchema.copy() + Schema(
    (BatchId, Project, ParentBiospecimen, NumberBiospecimens, Location,
     DateCreation))

schema['title'].widget.visible = {'edit': 'visible', 'view': 'visible'}
schema['description'].widget.visible = {'edit': 'visible', 'view': 'visible'}
schema['description'].schemata = 'default'


class SampleBatch(BaseContent):
    implements(IBatch)
Esempio n. 29
0
from Products.Archetypes.atapi import StringWidget
from Products.Archetypes.atapi import TextAreaWidget
from bika.lims.browser.widgets import DateTimeWidget
from bika.lims.browser.widgets import ReferenceWidget

from bika.lims.config import PROJECTNAME
from bika.lims import bikaMessageFactory as _
from bika.lims.interfaces import IInstrumentValidation

schema = BikaSchema.copy() + Schema((
    DateTimeField(
        'DateIssued',
        with_time=1,
        with_date=1,
        widget=DateTimeWidget(
            label=_("Report Date"),
            description=_("Validation report date"),
        ),
    ),
    DateTimeField(
        'DownFrom',
        with_time=1,
        with_date=1,
        widget=DateTimeWidget(
            label=_("From"),
            description=_(
                "Date from which the instrument is under validation"),
        ),
    ),
    DateTimeField(
        'DownTo',
        with_time=1,
Esempio n. 30
0
                "align": "left",
                "label": "Free",
                "width": "10"
            },
        ],
    ))

DateCreated = DateTimeField(
    'DateCreated',
    mode="rw",
    read_permission=permissions.View,
    write_permission=permissions.ModifyPortalContent,
    widget=DateTimeWidget(
        show_time=True,
        label=_("Date Created"),
        visible={
            'edit': 'visible',
            'view': 'visible'
        },
    ),
)

LabContact = ReferenceField(
    'LabContact',
    required=1,
    allowed_types=('LabContact', ),
    referenceClass=HoldingReference,
    relationship='BoxMovementLabContact',
    mode="rw",
    read_permission=permissions.View,
    widget=BikaReferenceWidget(
        label=_("Lab Contact"),