text: import json
  from datetime import datetime
  import platform
  
  
  class JSON:
  
      def generate(self, update):
          sd = {}
  
          sd['brk_quantity'] = update[0]
          sd['lun_quantity'] = update[1]
          sd['din_quantity'] = update[2]
          sd['entry_slots'] = update[3]
          sd['sections'] = update[4]
          sd['servsect'] = update[5]
          sd['dest_email'] = update[6]
          sd['togo_entry_slots'] = update[7]
          sd['sectdict'] = update[8]
  
          self.write(sd)
  
      def write(self, dicti):
          with open('./data/config.json', 'w+') as conf:
              json.dump(dicti, conf, indent=4)
  
      def read(self):
          try:
              with open('./data/config.json', 'r') as conf:
                  jfile = json.load(conf)
                  return jfile
          except FileNotFoundError:
              with open('./data/config-backup.json', 'r') as conf:
                  return json.load(conf)
  
  
  with open('./data/aptnum.json', 'r') as f:
      jfile = json.load(f)
      APT_QUANTITY = len(jfile)
      APT_NUMBERS = jfile
  
  with open('./data/aptdata.json', 'r') as f:
      RESIDENT_QUANTITY = len(json.load(f))
  
  # SETTINGS FOR EMAIL #
  
  ALIAS = 'Contact Tracing'
  EMAIL = 'contacttracinguhs@gmail.com'
  DEST_EMAIL = JSON().read()['dest_email']
  PORT = 587
  SMTP = "smtp.gmail.com"  # DO NOT CHANGE
  if platform.system() == 'Linux':
      ATTACHMENT = str('/storage/emulated/0/ContactTrace/spreadsheets/' + str(
          datetime.now().date()) + '-contacttrace.xlsx')  # DO NOT CHANGE
  else:
      ATTACHMENT = str('./spreadsheets/' + str(datetime.now().date()) + '-contacttrace.xlsx')  # DO NOT CHANGE
  SUBJECT = 'Data for ' + str(datetime.now().month) + '/' + str(datetime.now().day)
  CONTENT = 'See attached spreadsheet. Sent: %s' % datetime.now().time()
  
  # CONNECTION TEST #
  
  HOST = 'http://google.com'
  
  # XLSX FILE #
  
  if platform.system() == 'Linux':
      LOCATION = '/storage/emulated/0/ContactTrace/spreadsheets/'  # DO NOT CHANGE
  else:
      LOCATION = './spreadsheets/'  # DO NOT CHANGE
  FILENAME = str(datetime.now().date()) + '-contacttrace.xlsx'  # DO NOT CHANGE
  
  COLUMN_LIST = ['h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
                 'z', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai', 'aj', 'ak']  # DO NOT CHANGE
  
  # TXT FILE #
  
  TXT_FILENAME = str(datetime.now().date()) + '-signoff_records.txt'  # DO NOT CHANGE
  if platform.system() == 'Linux':
      TXT_LOCATION = '/storage/emulated/0/ContactTrace/signoffrecords/'  # DO NOT CHANGE
  else:
      TXT_LOCATION = './signoffrecords/'  # DO NOT CHANGE
  
  # JSON FILE #
  
  JSON_FILENAME = str(datetime.now().date())  # DO NOT CHANGE
  if datetime.now().day <= 22:
      CHARGES_FILE = str(datetime.now().month - 1) + '-' + str(datetime.now().month)
  elif datetime.now().day >= 23:
      CHARGES_FILE = str(datetime.now().month) + '-' + str(datetime.now().month + 1)
  
  if platform.system() == 'Linux':
      JSON_LOCATION = '/storage/emulated/0/ContactTrace/billing/'  # DO NOT CHANGE
      ARCHIVE_LOCATION = '/storage/emulated/0/ContactTrace/billingarchive/'  # DO NOT CHANGE
      CHARGES_LOCATION = '/storage/emulated/0/ContactTrace/mealcount/'  # DO NOT CHANGE
      DF_LOCATION = '/storage/emulated/0/ContactTrace/dataframes/'
  else:
      JSON_LOCATION = './billing/'  # DO NOT CHANGE
      ARCHIVE_LOCATION = './billingarchive/'  # DO NOT CHANGE
      CHARGES_LOCATION = './mealcount/'  # DO NOT CHANGE
      DF_LOCATION = './dataframes/'  # DO NOT CHANGE
  
  APTDATA_LOCATION = './data/'  # DO NOT CHANGE
  APTCONF_LOCATION = './data/'  # DO NOT CHANGE
  
  # GRAPHICAL INTERFACE #
  
  BACKGROUND_COLOR = (1, 1, 1, 1)  # (.855, .875, .882, 1)
  BUTTON_COLOR = (.70, .75, 1, .4)
  CRITICAL_BUTTON_COLOR = (1, .3, .5, .4)
  TABLE_COLOR = (.65, .70, 1, .3)
  TEXT_COLOR = (0, 0, 0, 1)
  
  VAR_TABLE_COLOR = {
      1: (1, .3, 0, .3),
      2: (0, .2, 1, .25),
      3: (.4, 1, 0, .3),
      4: (1, .2, .1, .2),
      5: (1, 0, 1, .3),
      6: (0, .70, 0, .1),
      7: (.85, 1, 1, .9)
  }
  
  # SERVICE DATA #
  
  BRK_TABLE_QUANTITY = JSON().read()['brk_quantity']
  LUN_TABLE_QUANTITY = JSON().read()['lun_quantity']
  DIN_TABLE_QUANTITY = JSON().read()['din_quantity']
  
  TABLE_ENTRY_SLOTS = JSON().read()['entry_slots']
  SECTIONS = JSON().read()['sections']
  SERVING_SECTIONS = JSON().read()['servsect']
  TOGO_ENTRY_SLOTS = JSON().read()['togo_entry_slots']
  
  # DICTIONARIES #
  
  '''VARDICT AND TEXTDICT DICTIONARIES MUST BE EQUAL IN SIZE'''
  VARDICT = {
      '1': 'tertiary',
      '2': 'secondary',
      '3': 'primary',
      '4': 'load',
      '5': 'sections',
      '6': 'credit',
      '7': 'aptconf'
  }
  TEXTDICT = {
      '1': 'Breakfast',
      '2': 'Lunch',
      '3': 'Dinner',
      '4': 'Load Autosave',
      '5': 'Sections',
      '6': 'Check Count',
      '7': 'Apartment Conf'
  }
  
  # SECTION DATA #
  
  SECTDICT = JSON().read()['sectdict']
  SERVQUAN = 7
  
  # POPUP MESSAGES #
  
  RESET_TEXT = 'Are you sure you would like to reset? WARNING: This will delete ALL associated save data.'
  EMAIL_SUCCESS = 'Email sent successfully.'
  EMAIL_FAILURE = 'Unable to send email. Make sure you have entered the correct password and have an internet connection.'
  INVALID_SYNTAX = 'Please verify inputted values, one or more entries were flagged as invalid.'
  
  # SETTINGS MENU #
  
  SETTINGS_LABEL = [
      'Breakfast Table Count',
      'Lunch Table Count',
      'Dinner Table Count',
      'Seats per Table',
      '# of Sections',
      '# of Serving Sections',
      'Destination Email',
      'To Go Slots'
  ]
  
  for i in range(SERVING_SECTIONS):
      if i == 4:
          SETTINGS_LABEL.append(f"Section 5/6")
      elif i == 5:
          pass
      else:
          SETTINGS_LABEL.append(f"Section {i + 1}")
  
  SETTINGS_MAP = [
      'brk_quantity',
      'lun_quantity',
      'din_quantity',
      'entry_slots',
      'sections',
      'servsect',
      'dest_email',
      'togo_entry_slots',
      'sectdict'
  ]
  
  SETTINGS_TEXT = '''Guidelines for settings entry are as follows: Table Counts, Seats/Table, Section Values and TOGO \
  slots must be whole integer values. Destination Email must be a valid email. Tables per section must be comma separated \
  whole integers representing table numbers. No table number should be listed that is greater than the total number of \
  tables.'''
  
  # DATAFRAMES #
  
  SEA_COLUMNS = [
      'table',
      'position',
      'time',
      'bv'
  ]
  
  SEC_COLUMNS = [
      'server',
      'sobool',
      'sotime'
  ]
  
  TG_COLUMNS = [
      'brk',
      'lun',
      'din',
      'bv'
  ]
  
  APT_COLUMNS = [
      'occup',
      'albool'
  ]
  
  BIL_COLUMNS = [
      'room',
      'bv'
  ]
  
  EXL_COLUMNS = [
      'server',
      'shift',
      'in-out',
      'table',
      'room',
      'time'
  ]
  
  # AUTOSAVE #
  
  INTERVAL = float(120)  # IN SECONDS
  AUTOSAVE_STORE = 31  # IN DAYS
  ACCESSIBLE_BACKLOG = 6  # IN DAYS
  