Skip to content
spark-c edited this page May 7, 2021 · 2 revisions

Overview

This is a Python Flask app used for parsing contact information into spreadsheets. Here is the app's flow:

On page load

  1. The app checks whether the user has a unique ID in their session.
  2. If recognized, the app queries its Postgresql db (hosted via Heroku) and returns all of the company information associated with that user's session. If not, the user is assigned a new unique ID.
  3. The page uses JavaScript to fetch any data returned to the app from the db, and builds table rows accordingly.

Compiling submitted information

  1. The user adds blocks of contact information to the page's textbox, formatted according to the page's instructions which can also be found in this repo's README.md.
  2. At any point, the user may click the "COMPILE" button, and the textbox contents will be sent to the server for processing.
  3. Using my kidslinkedConverter library, the data is regex'd, parsed, and made into Company/Detail objects.
  4. The server adds these objects to the appropriate database tables, and returns the information to the front-end as JSON.
  5. The data is built into table rows and appended to the page.

Generating spreadsheets

  1. At any point, the user may click "GENERATE" to send a request to the server for a spreadsheet.
  2. Upon receiving this request, the server queries the database for all information belonging to the user and converts it into Company objects.
  3. The aforementioned kidslinkedConverter library uses openpyxl to create a spreadsheet containing the information from the created objects.
  4. The sheet is saved to the server's /output directory and served to the user. (The new file overwrites any existing file in that dir).

Deleting information

  1. When new rows are appended to the webpage, they are automatically marked as selected.
  2. The "Delete Selected" button can be used to remove any selected row from the table. (The "Delete All" button works very similarly).
  3. The front-end sends a request to the server and provides the email addresses associated with the selected rows.
  4. These emails (and the user's ID) are used as keys to query the database and delete matching entries.
  5. The server returns an updated set of information to the front-end.
Clone this wiki locally