Cutting through the smog: making an air quality bot with Haskell
engineering.linecorp.com
engineering.linecorp.com
Then, people started to requesting new features and I had ideas for new features and it was no longer a single-page project.
Then, people started to reporting issues with their PHP hosting accounts, so I was spending time debugging problems in their deployments.
Then, I thought it may be easier to introduce multi-tenancy so I can just support a single environment, the one that I own. So I added registration, dashboard, maps, Let's Encrypt, etc.
This way I ended up owning a small, open-source SaaS written in PHP7 and MySQL [4]. If I knew how my single-page app will grow, I'd choose something more suitable, like Rails or Dropwizard. On the other hand, it works, is usable and maintainable, so maybe it's fine the way it is.
[1] https://smolna.aqi.eco/ [2] https://luftdaten.info/ [3] https://github.com/trekawek/air-quality-info/ [4] https://aqi.eco/
edit: Looks like esphome with the following low-cost sensors is the way to go: * MH-Z19 for co2 (or CCS811 CO_2 for VOCs as well) * SDS011 for particle counts
This sensor also looks good: https://shop.pimoroni.com/products/adafruit-sgp30-air-qualit...
The smaller parts with the types and small implementations should be at the top and only at the end all is easily combined.
And I highly doubt that the author went about writing the chatbot by writing out all the language extensions and imports first (which makes the coding-along line at the and a bit cynical).
Edit: This sounds so negative. I think the article is good and shows how the small pieces work together but I think the order is all wrong.
I will think about rearranging the code blocks or add more explanations to make it all fit more naturally. Thanks for your feedback!
I think there are quite a few parts in there that one can easily "try out on their own".
I liked the comment at the end:
>> It’s the same bot as we have detailed in the tutorial with the exception that it uses PostGIS instead of a transactional variable to store users.
I am not a Haskell expert (I use Haskell a lot but I consider myself a student) so this is probably horrible advice, but recently I have started using embedded SQLite for transactional data instead of TVars. In some sense it is the same thing since the Simple SQLite wraps the SQLite code in an IO. I always try to minimize impure code. I write as much pure code as I can in a REPL and then study/research how to handle the impure parts.