mileswwatkins / mouse Goto Github PK
View Code? Open in Web Editor NEWA chatbot to provide information to backcountry hikers via satellite SMS
A chatbot to provide information to backcountry hikers via satellite SMS
Using Husky or similar
https://appalachiantrail.org/trail-updates/
Upside: doesn't appear to be anti-bot technology on the website
Downside: no easy way to get count by state, and even for a single state sometimes there're enough that pagination of the list on their website is required
Right now, the invocations look like:
handleWeatherInvocation(inReachSlug, days, callback)
handleClosuresInvocation(invocation, callback)
handleWikipediaInvocation(invocation, callback)
As more invocations are added, having some consistency in the function signature would be valuable. Maybe something like handleFoobar(invocation, options, callback)
?
Eg, these invocations should resolve the same:
closures pct norcal
and closures pct Northern California
closures pct washington
and closures pct wa
Because that name isn't inclusive of all the information (updates, warnings, etc).
Maybe with "update" or "notifications" (although the latter is sorta overloaded in UX meaning).
There are plenty of error messages returned due to improper user input; we should confirm that those trigger when we anticipate.
Eg:
Error: You must include your InReach location link in your text message
Error: You must provide a trail name in your text message, eg mileage pct
If the README is going to be a product demo, then it needs to read more like user-facing documentation than a REST API spec. Maybe switch from text to screenshots?
Related and part of this task, maybe the dev docs should be moved to a separate document!
Low priority since this is something most hikers will discern via FarOut instead but could be a good convenience tool, and the infrastructure (of determining mileage) could be hooked into other functionality, such as push notifications when closures or notices are nearby the hiker.
Twilio doesn't allow a blocklist or whitelist for SMS/MMS functionality, so the best we can do is not reply to any phone numbers that aren't on a pre-approved list. This list, for privacy's sake, could be stored on a password-protected AWS S3 bucket, or even just an S3 file that's public but has an unguessable path/URI. Either way, the credentials for acting this list would need to be stored on Twilio Functions as environment variable secrets.
This feels like a big quality-of-life feature for users. But it's also a big domain. Probably worth focusing on whichever professional sports have the bulk of their season during North American backpacking months, or perhaps whichever sports have their playoffs during that time.
Also unclear what the cost to serve up this data will be, which is worth investigating on whichever API we use.
Also also, will these scores be live, or just after-the-fact? Will it just be a box score, or will there be any prose attached to it?
Some progress and inline documentation already exists in https://github.com/mileswwatkins/Mouse/blob/main/functions/utils.private.js
If a message is longer than the length of an SMS, modern smartphones just handle it like a single MMS. But Garmin InReach will break it up on its servers and send the message as multiple SMSs. Unfortunately, Garmin will break these up at the character level, and they may not be received in the correct order, eg:
oshi Tajiri in 1996, and is centered on fictional creatures called "Pokémon". In Pokémon, humans, known as Pokémon Trainers, catch and train Pokémon to battle o
ther Pokémon for sport. All media works within the franchise are set in the Pokémon universe. The English slogan for the franchise is "Gotta Catch ‘Em All!". Th
Pokémon is a Japanese media franchise managed by The Pokémon Company, a company founded by Nintendo, Game Freak, and Creatures. The franchise was created by Sat
ere are currently 901 Pokémon species.
So, paginating the message (at the word-break level) into several separate SMSs and labeling their order before sending to Garmin is highly desirable, so that even if they're received out of order they are still legible; something like:
(2) Satoshi Tajiri in 1996, and is centered on fictional creatures called "Pokémon". In Pokémon, humans, known as Pokémon Trainers, catch and train Pokémon to
(3) battle other Pokémon for sport. All media works within the franchise are set in the Pokémon universe. The English slogan for the franchise is "Gotta Catch
(1) Pokémon is a Japanese media franchise managed by The Pokémon Company, a company founded by Nintendo, Game Freak, and Creatures. The franchise was created by
(4) ‘Em All!". There are currently 901 Pokémon species.
And run e2e tests whenever pushing to main
locally (via Husky) and whenever creating a PR against main
(via CI system).
Words with internal capitalization (eg, Robert MacNamara
) will fail in the Wikipedia search most of the time. It doesn't appear that the Wikipedia/Wikimedia REST API offers a search functionality, but maybe the other Wikipedia/Wikimedia XML/JSON APIs do, in which case we could fall back to that one.
See further explanation for how our current search functionality works inline at https://github.com/mileswwatkins/Mouse/blob/main/functions/wikipedia.private.js#L7-L17
It appears that the PCTA website, the only source for closure and hazard notices (not apparently republished on Twitter, etc), now has Cloudflare/hCAPTCHA anti-bot code.
I'm communicating with the PCTA tech lead to see if there's a better/another way to access this data, but for now I'm scraping the Google cache (usually ~24–48 hours old) for this information. A longer term solution could be a daily/hourly AWS Lambda using Puppeteer headless Chrome to try avoiding Cloudflare bot detection, or a paid service to get past the hCAPTCHA. Neither are particularly desirable paths; let's hope that the PCTA has an official solution.
There's some DRYing to do, since all three invocation handlers access the same webpage and list items. Not imminently easy, but with some focus there's certainly a good way to simplify this module.
High-priority closures could be transmitted to all hikers on a trail, all hikers in a specific state (or who've recently messaged from a neighboring state), or all hikers who are going in that direction (would need to maintain a user database indicating NOBO or SOBO and their most recent check-in)
Main blocker is that it's unclear which of the many air quality models are most accurate in the mountains. I tried reaching out to the team leads by phone and email but no luck there.
The New York Times uses HRRR ("Rapid Refresh") in their wildfire/smoke map, but it's unclear whether this is the most accurate model for non-urban areas.
After that, it'll be some work to determine how to get a specific point's air quality value from their KMZ downloads (where each layer is a forecast at a point in time). And this'll probably be too big of a download and too computationally expensive to run every single time it's requested; we'll probably need an AWS Lambda that performs the work once every day (once the model has published) and pre-processes the results for various points along the trail, storing it in a JSON for the Twilio Function to fetch.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.