Code Monkey home page Code Monkey logo

airquality-mx's Introduction

AirQualityMX project: air quality notifications for Mexico

What is this? Why?

This can be called a 'personal' project by @jorge_vgut with the original intentions of learning C# Programming language, and at the same time, do something that could be shared and used to share knowledge on programming and software design. If you'd like to learn about how this project is design, please check our high level design document first.

Project status

This project is in DEVELOPMENT currently undergoing tests.** If you would like to learn more about this, please head to our Wiki on Github.

Coding guidelines

Intention is to follow Microsoft's dotnet best practices. Visit their dotnet/runtime project on Github. https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/coding-style.md

Use CodeFormatter: https://github.com/dotnet/codeformatter as a tool to format code.

Note: code formatting and perfect style is out of scope for the moment

Instructions

Deploy cloud infrastructure on AWS

Go to cloud-infra/AirQualityCDK/ which is an AWS CDK project, here you will need the following requirements.

  • Need an Aws account with permissions to deploy all services, for details see the CDK Stack implementation in this project.
  • Have aws cli installed and configuration already set locally for cdk deploy to pick it up.
  • Set the following environment variables set
    # may put this values on env-setup.sh for easing the process
    TOKEN -> Waqi API token
    TWITTER_APIK=Twitter API KEY;
    TWITTER_APIS=Twitter API Secret;
    TWITTER_ACCESS_TOKEN=Twitter access token (for development purposes);
    TWITTER_SECRET_TOKEN=Twitter secret token (for development purposes);
    
  • Will need S3 bucket to hold package lambdas. Refer to script in src/Aws/package-and-upload-lambdas.sh
  • project is a dotnetcore v3 app, make sure to have dotnet cli installed to build the project.

Sample setup:

#from /project-root
# make sure all projects build and are tested(test is very limited), this is done automatically as all are added as part of solution in project root.
dotnet build
dotnet test

# from src/Aws
# this packages and upload lambda zip files into s3 buckets, this will be picked up by CDK stack
./package-and-upload-lambdas.sh

# from cloud-infra/AirQualityCDK
# setup required environment variables so CDK provisions resources with these as environment variables
./env-setup.sh
# provision everython on Aws as a Stack
cdk deploy

Contributions

Should you like to provide any feedback, please open up an Issue, I appreciate feedback and comments, although please keep in mind the project is incomplete, and I'm doing my best to keep it up to date.

Currently the project is NOT ACCEPTING CODE CONTRIBUTIONS (pull requests, or else) However as this is in its early stages, you are welcome to leave feedback on its current design.

airquality-mx's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

airquality-mx's Issues

Apuntes sobre el diseño inicial

1- Diseño de notificaciones por email estando out-of-scope
Si el envío de emails está out-of-scope debería eliminarse todo lo relacionado con esto del diagrama de arquitectura general. Podría considerarse que está dentro del componente Other - not implemented.

De igual modo considero que analizar escenarios posibles durante el trabajo con emails es un desgaste innecesario por el mismo hecho de que no es un caso de uso soportado. Este tipo de análisis puede llevar no solo a perder tiempo haciéndolo sino también a una sobre ingeniería en el diseño inicial del sistema. Si el único tipo de notificación a implementar es vía Twitter todo el diseño debe estar enfocado en esto. Este es un principio de diseño que siempre tengo muy presente: KISS (Keep It Simple, Stupid!).

Nota: Cuando hablo de sobre ingeniería no me refiero al análisis de otros aspectos como el manejo de errores o la escalabilidad de la solución, teniendo en cuenta que es cloud-native, los que si deben tenerse en cuenta.

2- Evitar el envío de notificaciones irrelevantes
Nota: Creo que este tema lo trataron de algún modo en el video de Youtube

Sería necesario evitar llenar el buzón de notificaciones de los usuarios cuando ya se le haya notificado de un aumento del valor de la calidad del aire (> 51). Con esto me refiero a que si la situación no ha cambiado significativamente desde la última notificación no debería volver a notificarse de este hecho cada 5 minutos.

Para lograr esto es necesario mantener los datos referentes a la última notificación enviada para poder comparar con los nuevos datos. Los términos del API indican que no se pueden redistribuir los datos ni en forma de caché ni en forma de datos archivados pero almacenar solo aquellos referentes a un instante de tiempo puntual (los de la última notificación enviada) únicamente con el fin de poder compararlos con la nueva situación considero que no contraviene los términos de uso de los datos.

El punto importante sería definir que entendemos en el sistema como un cambio significativo por lo que te dejo los criterios que yo consideraría, respecto al valor del índice de calidad del aire.

  • Pasó a ser > 51
  • Aumentó más de 5 puntos habiendo tenido anteriormente un valor > 51
  • Cambio de nivel según el Air Pollution Level aunque la variación del valor sea menor a 5 puntos
  • Pasó a ser < 51

3- Pérdida de notificaciones
Pienso que el modo en que esto debe manejarse no es el almacenar todas las notificaciones no enviadas y enviarlas en el momento que ya no exista el problema que impidió su envío, porque por ejemplo si Twitter se cae por 5 horas y suponiendo que en esas 5 horas se generaron 20 nuevas notificaciones (teniendo en cuenta siempre el punto anterior) al momento de restablecerse el servicio le llegarán de golpe 20 notificaciones que quizás ya perdieron su importancia puesto que la situación ya se ha normalizado.

No obstante se sería importante saber si la última notificación generada no pudo enviarse para reenviarla en el momento que se pueda (se restableció el servicio de Twitter), aunque las validaciones definidas en el punto anterior indiquen lo contrario.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.