Introduction to Mobile Chatbot Development

Penny Li
4 min readJan 13, 2024

Another post in the automation series written last September was on running audit tests on a restaurant transaction dataset shown below.

The setup was through tick boxes users could select for the kinds of tests they would like to run. When converting this functionality to a mobile format, I had changed the tick boxes to a chat functionality and added the ability to direct the user to focus on specific kinds of individuals to investigate. Below is an example for identifying duplicate transactions.

YouTube Tutorial

The video that goes through the below content in streaming format is as follows:

Below is the file structure for this app with the file relationships on the right.

MainActivity.kt

  • Central activity that hosts the functionality to support the app’s swiping pages
  • Uses SectionsPagerAdapter to manage the components displayed on the app’s pages
  • Interacts with SharedViewModel for shared data across components

activity_main.xml

  • Layout for MainActivity.kt, including ViewPager2 for the app’s swiping pages and the top tabs

FileImport.kt — import component

  • Uses SharedViewModel to share data identified by a Uniform Resource Identifier
  • Interacts with MainActivity when a file is selected

file_input.xml

  • Layout for FileImport.kt fragment

FilePreview.kt — preview component

  • Observes ‘SharedViewModel’ for changes in the selected file Uniform Resource Identifier
  • Display file contents

file_preview.xml

  • Layout for FilePreview.kt

excel_row_item.xml

  • layout for rows for Excel data in FilePreview.kt

excel_header_item.xml

  • Layout for header row in Excel data in FilePreview.kt

ChatPragment.kt — chat component

  • Uses SharedViewModel to send and receive chat messages

fragment_chat.xml

  • Layout for ChatFragment.kt

chat_item.xml

  • Layout for chat messages in ChatFragment.kt

SectionsPagerAdapter.kt

  • Adapter for swiping page function in MainActivity
  • Manage FileImport.kt, FilePreview.kt, and ChatFragment.kt, the three pages in the app

SharedViewModel.kt

  • The view model that’s shared across FileImport, FilePreview, and ChatFragment
  • Manage and share data such as file Uniform Resource Identifier, chat messages, and Excel data

Below is the apk file for this app for anyone interested in giving it a try. Please note at this point, the app is still limited to answering questions related to duplicates, low and large tips, after hour and unusual day/time transactions, suspicious and missing notes, as well as outliers. Further improvements will be made to add more functionalities.

More Numbers Everyday

Sometimes numbers are correct, but they are misinterpreted so that conclusions and decisions based on them are crazy. This could be because you see the patterns and connections you want to see or because you genuinely misinterpret the numbers and the reasons for them. The combination of the two traps can be powerful.

WRITER at MLearning.ai / Hallucinations in AI / 20K+ Art Prompts

--

--