-
Notifications
You must be signed in to change notification settings - Fork 0
Home
spark-c edited this page May 7, 2021
·
2 revisions
This is a Python Flask app used for parsing contact information into spreadsheets. Here is the app's flow:
- The app checks whether the user has a unique ID in their session.
- 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.
- The page uses JavaScript to fetch any data returned to the app from the db, and builds table rows accordingly.
- 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.
- At any point, the user may click the "COMPILE" button, and the textbox contents will be sent to the server for processing.
- Using my kidslinkedConverter library, the data is regex'd, parsed, and made into Company/Detail objects.
- The server adds these objects to the appropriate database tables, and returns the information to the front-end as JSON.
- The data is built into table rows and appended to the page.
- At any point, the user may click "GENERATE" to send a request to the server for a spreadsheet.
- Upon receiving this request, the server queries the database for all information belonging to the user and converts it into Company objects.
- The aforementioned kidslinkedConverter library uses openpyxl to create a spreadsheet containing the information from the created objects.
- 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).
- When new rows are appended to the webpage, they are automatically marked as selected.
- The "Delete Selected" button can be used to remove any selected row from the table. (The "Delete All" button works very similarly).
- The front-end sends a request to the server and provides the email addresses associated with the selected rows.
- These emails (and the user's ID) are used as keys to query the database and delete matching entries.
- The server returns an updated set of information to the front-end.