Project: Turn Booking Notes Into Records

Over this course, you built every piece of the clinic’s intake one at a time: a prompt template, a Zod schema, the clinic’s own checks, one retry, and the front desk’s list. Each piece ran inside read-notes.js, a script that printed what happened to each note and then forgot it.

In this project, you’ll put those pieces into an intake the clinic could run every morning. You’ll split it into functions that tests can check one by one, save the results to a file the front desk can open, and find out what a real morning’s run costs. Start with what the clinic needs from it.

Read the Clinic’s Brief

Every morning, someone at the front desk opens the notes that came in overnight through the booking form. They want the intake to do the first reading for them and hand over two lists:

  • The bookings: A record for each note that passed the intake’s checks, with the note’s id. Someone still compares each record with its note, checking the urgency first, and confirms the day and time with the owner when they book the appointment, because the checks don’t cover everything.
  • The front desk’s list: Every other note, with the note’s id, the reason a person should read it, and the intake’s last result for it: the record, or the failure with any text and validation issues it kept. It’s only the final attempt, but that’s enough to start from without running the script again.

The clinic also wants to know what each run costs. A few cents a morning is fine, but the total should be printed every time, so a jump in the bill shows up the day it happens.

The brief also says what must never happen. These rules are the reason the course added each piece, and the tests for the project check every one:

  • A record goes into the bookings only after it has passed Zod validation and the clinic’s checks.
  • No note is lost. Every note ends up in exactly one of the two lists.
  • An answer gets one retry at most, and only when it’s "invalid" or "not JSON". This rule is about the answer. model/ still retries after a rate limit or a server error on its own, and it ends a call after MODEL_TIMEOUT_SECONDS. A call that still fails or times out is a failed request.
  • One note’s failed request never stops the run. That note goes to the front desk, and the run moves on to the next note.
  • The model is never trusted to know today’s date or the clinic’s facts. Your code puts them in the prompt.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.