code: # Filename: analyst.py
  """Analyst is a tool to look up (and export selected) data and insights
  from exported data from chats and channels in Telegram
  using Python and PyQt5."""
  
  import sys
  
  import pandas as pd
  from pathlib import Path
  
  from PyQt5 import QtWidgets, QtCore
  from PyQt5 import uic
  
  from backend import (
      converter,
      handler,
  )
  
  __version__ = '0.1'
  __author__ = 'Artyom Filippenko'
  
  df = pd.DataFrame({'a': ['Mary', 'Jim', 'John'],
                     'b': [100, 200, 300],
                     'c': ['a', 'b', 'c']})
  
  
  # VARS SECTION
  # IMPORT LOCALE
  IMPORT_WINDOW_TITLE = 'TelegramData Analyst - Import'
  IMPORT_WINDOW_MSG = 'This software is designed for analysis of Telegram channels and chats.'
  IMPORT_BROWSE_MSG = 'Open file'
  IMPORT_PATHLINE_MSG = 'Please, add path to JSON file, exported from Telegram Application...'
  IMPORT_BROWSE_BTN_NAME = 'Browse'
  IMPORT_ANALYSE_BTN_NAME = 'Analyze'
  IMPORT_PATH_MSG = 'File'
  
  # ANALYST LOCALE
  ANALYST_WINDOW_TITLE = 'TelegramData Analyst - Explorer'
  ANALYST_STATUSBAR_PREFIX_MSG = 'Exploring data from json-file:'
  ANALYST_WINDOW_MSG = 'Analyzing file'
  ANALYST_RETURN_BTN_NAME = 'Return to import...'
  ANALYST_EXPORT_BTN_NAME = 'Export results...'
  
  # ANALYST LOCALE
  #ALERT_WINDOW_TITLE = 'Alert!'
  
  # UI path
  IMPORT_UI_PATH = './frontend/import_data.ui'
  MAIN_UI_PATH = './frontend/workspace.ui'
  #ALERT_UI_PATH = './frontend/alert.ui'
  
  class ImportWindow(QtWidgets.QDialog):
      def __init__(self, parent=None):
          super().__init__(parent)
          self._build()
          self.ui.show()
  
      def _build(self):
          self.ui = uic.loadUi(IMPORT_UI_PATH)
  
          # Locale
          self.ui.setWindowTitle(IMPORT_WINDOW_TITLE)
          self.ui.import_description_message.setText(IMPORT_WINDOW_MSG)
          self.ui.browse_files_btn.setText(IMPORT_BROWSE_BTN_NAME)
          self.ui.analyse_file_btn.setText(IMPORT_ANALYSE_BTN_NAME)
          self.ui.import_file_pathline.setText(IMPORT_PATHLINE_MSG)
  
          # Loading UI logic
          self.ui.browse_files_btn.clicked.connect(self._browse_files)
          self.ui.analyse_file_btn.clicked.connect(self._open_analyst)
  
      def _browse_files(self):
          import_file = QtWidgets.QFileDialog.getOpenFileName(self, IMPORT_BROWSE_MSG,
                                                              './', "Json file (*.json)")
          self.ui.import_file_pathline.setText(import_file[0])
  
      def _open_analyst(self):
          if self.ui.import_file_pathline.text() == IMPORT_PATHLINE_MSG:
              json_file_path = ''
  
          else:
              json_file_path = Path(self.ui.import_file_pathline.text())
          self.analyst = AnalysisWindow(self)
          self.analyst.import_json_file(json_file_path)
          self.analyst.update_table_view
          self.analyst.ui.statusbar.showMessage(ANALYST_STATUSBAR_PREFIX_MSG + ' ' + \
                                                str(json_file_path))
          self.ui.hide()
  
  
  class AnalysisWindow(QtWidgets.QMainWindow):
      def __init__(self, parent=None):
          super().__init__(parent, QtCore.Qt.Window)
          self._build()
          self.ui.show()
          #self.import_json_file()
          #self.update_table_view()
  
      def _build(self):
          self.ui = uic.loadUi(MAIN_UI_PATH)
          # Locale
          self.ui.setWindowTitle(ANALYST_WINDOW_TITLE)
          self.ui.return_btn.setText(ANALYST_RETURN_BTN_NAME)
          self.ui.export_btn.setText(ANALYST_EXPORT_BTN_NAME)
          # Loading UI logic
          self.ui.return_btn.clicked.connect(self._return_to_import)
  
      def _return_to_import(self):
          self.ui.close()
          self.parent().ui.show()
  
      def import_json_file(self, json_file_path):
          self._data = converter.convert_tg_json(json_file_path)
  
      def update_table_view(self):
          self.ui.test_msg.setText(str(df.columns))
          self.model = handler.pandasModel(self._data)
          self.ui.table_view.setModel(self.model)
          self.ui.table_view.show()
  
  
  def main():
      app = QtWidgets.QApplication(sys.argv)
      window = ImportWindow()
      #window.show()
      sys.exit(app.exec_())
  
  if __name__ == '__main__':
      main()
  
apis: pandas.DataFrame