2025.03.16 aka Dollars to Robots
Another day, another step toward making Bmore Today more reliable and accurate. Today’s focus? Setting up a real-time alert system and continuing work on price standardization to make event details clearer.
Missing Events
I noticed something weird yesterday. Only two events from Baltimore Beat were showing up, even though there should have been nine. Looking at the error logs, I saw that seven events failed to add due to invalid time formatting. I caught it by chance, but it made me realize something: I had a false positive issue (or at least a partial one).
When no events are present, I usually check against Baltimore Beat to confirm that's accurate. But in this case, because two events made it through, I might have assumed everything was fine—without realizing seven were missing. And even though this started as a personal project, I do want to share it as a "gift" to the community (specifically r/baltimore). So, it's important to me that it's accurate.
The Fix: A Telegram Bot
This morning I decided I was going to set up an alert system. My initial thought was Twilio, but there's a cap on their free tier. Eventually, I decided on Telegram which has no cap, but I also use daily anyway to talk with friends (pre RCS days were rough). It was overall a painless experience: registering a new bot, updating the .env, a few lines for the function and boom, error alert bot. Initially, I had it in the catch block in the main event script, but the errors were too general, so I hooked it into each event source script so that I could also pass event details. And it works just how I need it to:
(Don't worry, I peeped that Bear
should be Beat
.)
Once the bot flagged the errors, the issue became clear: I was preconverting the DateTime object to a string, but SQL expected a TIME type element.
The fix? Swap .toFormat(...)
for .toSQLTime()
, and now everything inserts correctly.
The Best Things in Life Are Free
The rest of the session focused on price standardization.
Standardizing Enoch Pratt Event Prices
I got confirmation from Enoch Pratt’s social account that all events are free (which explains why none of the Localist API events had a price property).
Implementing this was easy—when inserting events into the database, if the source is Enoch Pratt, I simply set both minPrice
and maxPrice
to 0
.
Handling Different Price Formats
With minPrice
and maxPrice
now stored in the database, I needed to update how event prices were displayed.
Instead of relying on a single string, I wrote a function to dynamically generate the price based on the available data. If an event has a min and max price, it shows a range ($10 to $20
). If only one value exists, it displays that ($15
). If neither is available, it falls back to priceDescription
. And if that's not available, it uses the price
property. Eventually, the last part won't be needed, but since I'm updating price source by source, I wanted to make sure the old price
would be defaulted to if there wasn't minPrice
and maxPrice
values
Final Thoughts
With the Telegram bot in place and Pratt’s prices standardized, Bmore Today is becoming more reliable and user-friendly. Next up: Handling more complex price formats (like $15 in advance, $20 at the door
) and making sure everything stays clean and readable. Once that’s done, prices will be fully standardized, and I'll be one step closer to integrating more sources.