Algorithm for receiving letters of recommendation

You will find the algorithm that I would like you to follow if I am writing a letter of recommendation for you below.
Input: (from you, the student, to be received by me greater than or equal to three weeks before the application deadline)
My output: Once I receive the information above, I will write a letter. I will send you an email when the letter gets sent.
Error check: If you do not hear from me by one week before the deadline, then you should send me a reminder email like the one below:

Hi,

You asked me to remind you about the letter that you are writing for my application to NAME OF YOUR PROGRAM if I hadn't heard from you a week before the application is due. The deadline is APPLICATION DEADLINE.

Thanks, YOUR NAME