required=1, validators=('isDateFormat', ), widget=DateTimeWidget_bl( label=_('Birth date'), datepicker_nofuture=1, ), ), BooleanField( 'BirthDateEstimated', default=False, widget=BooleanWidget(label=_('Birth date is estimated'), ), ), RecordsField( 'AgeSplitted', required=1, widget=SplittedDateWidget(label=_('Age'), ), ), ComputedField( 'AgeSplittedStr', expression="context.getAgeSplittedStr()", widget=ComputedWidget(visible=False), ), AddressField( 'CountryState', widget=AddressWidget( searchable=True, label=_("Country and state"), showLegend=True, showDistrict=True, showCopyFrom=False, showCity=False,
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