class SampleTypeSchemaExtender(object): adapts(ISampleType) implements(IOrderableSchemaExtender) def __init__(self, context): self.context = context fields = [ ExtReferenceField( 'DefaultAnalysisSpecifications', required=0, allowed_types=('AnalysisSpec'), relationship='SampleTypeAnalysisSpec', referenceClass=HoldingReference, widget=ReferenceWidget( checkbox_bound = 0, label=_("Default Analysis Specification"), description=_("The Analysis Specification to set by default"), catalog_name='bika_setup_catalog', base_query={'review_state': 'active'}, showOn=True, ) ), ] def getOrder(self, schematas): return schematas def getFields(self): return self.fields
"river where it is sampled. Lab analyses are done in the " "laboratory"), )) # The category of the analysis service, used for filtering, collapsing and # reporting on analyses. Category = UIDReferenceField( 'Category', schemata="Description", required=1, allowed_types=('AnalysisCategory', ), vocabulary='getAnalysisCategories', widget=ReferenceWidget( checkbox_bound=0, label=_("Analysis Category"), description=_("The category the analysis service belongs to"), catalog_name='bika_setup_catalog', base_query={'is_active': True}, )) # The base price for this analysis Price = FixedPointField('Price', schemata="Description", default='0.00', widget=DecimalWidget( label=_("Price (excluding VAT)"), )) # Some clients qualify for bulk discounts. BulkPrice = FixedPointField( 'BulkPrice', schemata="Description",
"in the river where it is sampled. Lab analyses are done in " "the laboratory"), ), ), ReferenceField('Category', schemata="Description", required=1, vocabulary_display_path_bound=sys.maxint, allowed_types=('AnalysisCategory',), relationship='AnalysisServiceAnalysisCategory', referenceClass=HoldingReference, vocabulary='getAnalysisCategories', widget=ReferenceWidget( checkbox_bound=0, label=_("Analysis Category"), description=_( "The category the analysis service belongs to"), catalog_name='bika_setup_catalog', base_query={'inactive_state': 'active'}, ), ), FixedPointField('Price', schemata="Description", default='0.00', widget=DecimalWidget( label=_("Price (excluding VAT)"), ), ), # read access permission FixedPointField('BulkPrice', schemata="Description", default='0.00',
# The preservation for this service; If multiple services share the same # preservation, then it's possible that they can be performed on the same # sample partition. Preservation = UIDReferenceField( 'Preservation', schemata='Container and Preservation', allowed_types=('Preservation',), vocabulary='getPreservations', required=0, multiValued=0, widget=ReferenceWidget( checkbox_bound=0, label=_("Default Preservation"), description=_( "Select a default preservation for this analysis service. If the " "preservation depends on the sample type combination, specify a " "preservation per sample type in the table below"), catalog_name='bika_setup_catalog', base_query={'inactive_state': 'active'}, ) ) # The container or containertype for this service's analyses can be specified. # If multiple services share the same container or containertype, then it's # possible that their analyses can be performed on the same partitions Container = UIDReferenceField( 'Container', schemata='Container and Preservation', allowed_types=('Container', 'ContainerType'), vocabulary='getContainers', required=0,
"laboratory"), ) ) # The category of the analysis service, used for filtering, collapsing and # reporting on analyses. Category = UIDReferenceField( 'Category', schemata="Description", required=1, allowed_types=('AnalysisCategory',), vocabulary='getAnalysisCategories', widget=ReferenceWidget( checkbox_bound=0, label=_("Analysis Category"), description=_("The category the analysis service belongs to"), catalog_name='bika_setup_catalog', base_query={'is_active': True}, ) ) # The base price for this analysis Price = FixedPointField( 'Price', schemata="Description", default='0.00', widget=DecimalWidget( label=_("Price (excluding VAT)"), ) )
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
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, ),