#NEWLINE# def config( settings ) : #NEWLINE# #INDENT# "\n        Template settings for an Incident Response System\n\n        Initially targeting Sierra Leone's Ebola Response\n    " #NEWLINE# T = current . T #NEWLINE# settings . base . system_name = T ( 'Sierra Leone Incident Response System' ) #NEWLINE# settings . base . system_name_short = T ( 'SL IRS' ) #NEWLINE# settings . base . prepopulate += ( 'IRS' , 'default/users' ) #NEWLINE# settings . base . theme = 'IRS' #NEWLINE# settings . auth . registration_requires_verification = True #NEWLINE# settings . mail . approver = 'ADMIN' #NEWLINE# settings . gis . countries = ( 'SL' , ) #NEWLINE# settings . gis . legend = 'float' #NEWLINE# settings . gis . postcode_selector = False #NEWLINE# settings . L10n . languages = OrderedDict ( [ ( 'en_gb' , 'English' ) ] ) #NEWLINE# settings . L10n . default_language = 'en_gb' #NEWLINE# settings . L10n . display_toolbar = False #NEWLINE# settings . L10n . decimal_separator = '.' #NEWLINE# settings . L10n . thousands_separator = ',' #NEWLINE# settings . security . policy = 7 #NEWLINE# settings . project . mode_3w = True #NEWLINE# settings . project . codes = True #NEWLINE# settings . project . multiple_organisations = True #NEWLINE# settings . req . req_type = [ 'Stock' ] #NEWLINE# def customise_hms_hospital_resource( r , tablename ) : #NEWLINE# #INDENT# if ( r . representation == 'geojson' ) : #NEWLINE# #INDENT# current . s3db . hms_status . facility_status . represent = None #NEWLINE# return #NEWLINE# #UNINDENT# hms_facility_type_opts = { #NEWLINE# #INDENT# 1 : T ( 'Hospital' ) , #NEWLINE# 41 : T ( 'ETC' ) , #NEWLINE# 42 : T ( 'Triage' ) , #NEWLINE# 43 : T ( 'Holding Center' ) , #NEWLINE# 44 : T ( 'Transit Center' ) , #NEWLINE# #UNINDENT# } #NEWLINE# hms_facility_status_opts = { #NEWLINE# #INDENT# 1 : T ( 'Functioning' ) , #NEWLINE# 4 : T ( 'Closed' ) , #NEWLINE# 5 : T ( 'Pending' ) , #NEWLINE# #UNINDENT# } #NEWLINE# from gluon import IS_EMPTY_OR , IS_IN_SET #NEWLINE# s3db = current . s3db #NEWLINE# NONE = current . messages [ 'NONE' ] #NEWLINE# field = s3db . hms_hospital . facility_type #NEWLINE# field . represent = ( lambda opt : hms_facility_type_opts . get ( opt , NONE ) ) #NEWLINE# field . requires = IS_EMPTY_OR ( IS_IN_SET ( hms_facility_type_opts ) ) #NEWLINE# field = s3db . hms_status . facility_status #NEWLINE# field . represent = ( lambda opt : hms_facility_status_opts . get ( opt , NONE ) ) #NEWLINE# field . requires = IS_EMPTY_OR ( IS_IN_SET ( hms_facility_status_opts ) ) #NEWLINE# #UNINDENT# settings . customise_hms_hospital_resource = customise_stats_demographic_data_resource #NEWLINE# def customise_disease_stats_data_resource( r , tablename ) : #NEWLINE# #INDENT# s3db = current . s3db #NEWLINE# table = s3db . disease_stats_data #NEWLINE# summary = settings . get_ui_summary ( ) #NEWLINE# settings . ui . summary = ( list ( summary ) + [ { #NEWLINE# #INDENT# 'name' : 'timeplot' , #NEWLINE# 'label' : 'Progression' , #NEWLINE# 'widgets' : [ { #NEWLINE# #INDENT# 'method' : 'timeplot' , #NEWLINE# 'ajax_init' : True , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# def default_parameter_filter( selector , tablename = None ) : #NEWLINE# #INDENT# ptable = s3db . stats_parameter #NEWLINE# query = ( ( ptable . deleted == False ) & ( ptable . name == 'Cases' ) ) #NEWLINE# row = current . db ( query ) . select ( ptable . parameter_id , limitby = ( 0 , 1 ) ) . first ( ) #NEWLINE# if row : #NEWLINE# #INDENT# return row . parameter_id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# resource = r . resource #NEWLINE# filter_widgets = resource . get_config ( 'filter_widgets' , [ ] ) #NEWLINE# for filter_widget in filter_widgets : #NEWLINE# #INDENT# if ( filter_widget . field == 'parameter_id' ) : #NEWLINE# #INDENT# filter_widget . opts . default = default_parameter_filter #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( filter_widget . field == 'location_id$level' ) : #NEWLINE# #INDENT# filter_widget . opts . default = 'L2' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# settings . customise_disease_stats_data_resource = customise_disease_stats_data_resource #NEWLINE# def customise_stats_demographic_data_resource( r , tablename ) : #NEWLINE# #INDENT# s3db = current . s3db #NEWLINE# table = s3db . stats_demographic_data #NEWLINE# def default_parameter_filter( selector , tablename = None ) : #NEWLINE# #INDENT# ptable = s3db . stats_parameter #NEWLINE# query = ( ( ptable . deleted == False ) & ( ptable . name == 'Population Total' ) ) #NEWLINE# row = current . db ( query ) . select ( ptable . parameter_id , limitby = ( 0 , 1 ) ) . first ( ) #NEWLINE# if row : #NEWLINE# #INDENT# return row . parameter_id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# resource = r . resource #NEWLINE# filter_widgets = resource . get_config ( 'filter_widgets' , [ ] ) #NEWLINE# for filter_widget in filter_widgets : #NEWLINE# #INDENT# if ( filter_widget . field == 'parameter_id' ) : #NEWLINE# #INDENT# filter_widget . opts . default = default_parameter_filter #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( filter_widget . field == 'location_id$level' ) : #NEWLINE# #INDENT# filter_widget . opts . default = 'L1' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( filter_widget . field == 'year' ) : #NEWLINE# #INDENT# filter_widget . opts . default = 2004 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# settings . customise_stats_demographic_data_resource = customise_stats_demographic_data_resource #NEWLINE# settings . modules = OrderedDict ( [ ( 'default' , Storage ( name_nice = T ( 'Home' ) , restricted = False , access = None , module_type = None ) ) , ( 'admin' , Storage ( name_nice = T ( 'Administration' ) , restricted = True , access = '|1|' , module_type = None ) ) , ( 'appadmin' , Storage ( name_nice = T ( 'Administration' ) , restricted = True , module_type = None ) ) , ( 'errors' , Storage ( name_nice = T ( 'Ticket Viewer' ) , restricted = False , module_type = None ) ) , ( 'gis' , Storage ( name_nice = T ( 'Map' ) , restricted = True , module_type = 1 ) ) , ( 'pr' , Storage ( name_nice = T ( 'Person Registry' ) , restricted = True , access = '|1|' , module_type = 10 ) ) , ( 'org' , Storage ( name_nice = T ( 'Organizations' ) , restricted = True , module_type = 10 ) ) , ( 'hrm' , Storage ( name_nice = T ( 'Staff' ) , restricted = True , module_type = 3 ) ) , ( 'cms' , Storage ( name_nice = T ( 'Content Management' ) , restricted = True , module_type = 10 ) ) , ( 'doc' , Storage ( name_nice = T ( 'Documents' ) , restricted = True , module_type = 10 ) ) , ( 'msg' , Storage ( name_nice = T ( 'Messaging' ) , restricted = True , module_type = None ) ) , ( 'event' , Storage ( name_nice = T ( 'Events' ) , restricted = True , module_type = 2 ) ) , ( 'disease' , Storage ( name_nice = T ( 'Disease' ) , restricted = True , module_type = 10 ) ) , ( 'hms' , Storage ( name_nice = T ( 'Hospitals' ) , restricted = True , module_type = 10 ) ) , ( 'dvi' , Storage ( name_nice = T ( 'Burials' ) , restricted = True , module_type = 10 ) ) , ( 'supply' , Storage ( name_nice = T ( 'Supply Chain Management' ) , restricted = True , module_type = None ) ) , ( 'asset' , Storage ( name_nice = T ( 'Assets' ) , restricted = True , module_type = None ) ) , ( 'vehicle' , Storage ( name_nice = T ( 'Vehicles' ) , restricted = True , module_type = 4 ) ) , ( 'stats' , Storage ( name_nice = T ( 'Statistics' ) , restricted = True , module_type = 10 ) ) , ( 'transport' , Storage ( name_nice = T ( 'Transport' ) , restricted = True , module_type = 10 ) ) , ( 'inv' , Storage ( name_nice = T ( 'Warehouses' ) , restricted = True , module_type = 4 ) ) , ( 'req' , Storage ( name_nice = T ( 'Requests' ) , restricted = True , module_type = 10 ) ) , ( 'project' , Storage ( name_nice = T ( 'Projects' ) , restricted = True , module_type = 2 ) ) ] )