'Unit',
    schemata="Description",
    widget=StringWidget(
        label=_("Unit"),
        description=_(
            "The measurement units for this analysis service' results, e.g. "
            "mg/l, ppm, dB, mV, etc."),
    ))

# Decimal precision for printing normal decimal results.
Precision = IntegerField(
    'Precision',
    schemata="Analysis",
    widget=IntegerWidget(
        label=_("Precision as number of decimals"),
        description=_(
            "Define the number of decimals to be used for this result."),
    ))

# If the precision of the results as entered is higher than this value,
# the results will be represented in scientific notation.
ExponentialFormatPrecision = IntegerField(
    'ExponentialFormatPrecision',
    schemata="Analysis",
    required=True,
    default=7,
    widget=IntegerWidget(
        label=_("Exponential format precision"),
        description=_(
            "Define the precision when converting values to exponent "
            "notation.  The default is 7."),
                default='BaseQuestionSelection',
                widget=StringWidget(
                    label='Title',
                    description='The main title of the object.',
                    i18n_domain='plone'),
               
         ),  
         FloatField("historical_selection_probability", 
                   
                   required=False,
                   default='1.0',
                   # 0.0 <= value < 1.000001 
                   validators = ('validRange',),
                   widget=IntegerWidget(description='Probability of selecting questions in a quiz from previous lectures. At the moment only using either 1.0 or 0.0.'
 '1.0: All questions from previous lectures are selected randomly as well as from the current lecture.'
 '0.0: Only select questions from the current lecture.',
                       

        ),
       ),   
                  
        ))
 
# class containing parameters related to how questions in a quiz are selected
 
class BaseQuestionSelectionParameters(ATCTContent, HistoryAwareMixin):
    """Container for question selection parameters."""

   
    schema = BaseQuestionSelectionParametersSchema
    _at_rename_after_creation = True
    security = ClassSecurityInfo()
示例#3
0
    ExpressionValidator
from bika.lims import api
from bika.lims import alphanumber
from bika.lims.content.bikaschema import BikaFolderSchema
from bika.lims.idserver import renameAfterCreation
from plone.app.folder.folder import ATFolder
from senaite.storage import logger
from senaite.storage import senaiteMessageFactory as _
from senaite.storage.interfaces import IStorageLayoutContainer, IStorageFacility
from zope.interface import implements

Rows = IntegerField(
    name="Rows",
    default=1,
    widget=IntegerWidget(
        label=_("Rows"),
        description=_("Alphabet letters will be used to represent a row "
                      "within the container")),
    validators=(ExpressionValidator('python: int(value) > 0'),
                ExpressionValidator(
                    'python: here.get_minimum_size()[0] <= int(value)')))

Columns = IntegerField(
    name="Columns",
    default=1,
    widget=IntegerWidget(
        label=_("Columns"),
        description=_("Number of positions per row. Numbers will be used to "
                      "represent a column within a row")),
    validators=(ExpressionValidator('python: int(value) > 0'),
                ExpressionValidator(
                    'python: here.get_minimum_size()[1] <= int(value)')))
示例#4
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