wdreames / website

Source code for a website I developed
https://www.william-reames.com
1 stars 0 forks source link

Create a Python Script #12

Closed wdreames closed 1 year ago

wdreames commented 1 year ago

Since I have already completed most of this logic in a jupyter notebook already, it should be fairly simple to convert to a Python script that the webpage can access. This should include a command-line API with two functions:

  1. Outputting entries from a date a. Input: A date b. Output: All entries from that date. If the date does not exist, a message is returned stating that.
  2. Outputting a random journal entry a. Input: [keywords...] [start_date] [end_date] b. Output: A random entry that meets the input requirements. If no entries exist that meet the requirements, a message is returned stating that.

Additional Steps to Improve Performance:

wdreames commented 1 year ago

Files I will need to make:

Primary challenge: How can my program remember which entries it has randomly outputted recently? Possible solution:

wdreames commented 1 year ago

A possible way of doing this could be to store a timestamp to a text file when the random entry script ends. Then when the random entry script is run again, it checks the text file. If the difference is more than 30 minutes, it deletes new_journal_df.pkl, if it exists.

wdreames commented 1 year ago

I have completed the Python logic for both the randomized entry and specific date outputs. The only task left for this is to refresh the randomized output if it is not used for 30 minutes

wdreames commented 1 year ago

Successfully implemented a method of refreshing the randomized output. The Python script should be complete now!