XHominid Web App
A Flask website and Backend server for an Android nutrition coaching and meal planning app.
check out XHominid on google play:
Also check out the android app github repo
XHomind is a platform that helps people looking for nutrition coaching and meal planning get connected with a qualified professional nutritionist. The platform enables professional nutritionists to conduct nutrition assessment interviews through XHomind video call feature. After this assessment the user then gets access to weekly meal plans prepared by the nutritionist, they are then able to directly message the nutritionist for further questions via XHominid messaging feature. In order to maintain continuous progress the users are able to book weekly one to one coaching sessions with their nutritionist via the video call booking feature. The user is able to view meal information, recipes and cooking instructions as well as mark meals eaten throughout the day. The daily nutritional intake logs are uploaded instantly and made accessible to the user nutritionist so that the can advice and guide them when needed and make improvements to the upcoming weeks' plan.
Webhook module
- Handles user onboarding, collects the necessary data required to design a diet plan and calculates the daily micro-nutrients intake required for the user to achieve their desired nutritional goal.
- Retrieves macro-nutrients data about a specific food item from Edamam nutrition database Api and returns the result to client App.
- Updates user cuurent weight or target weight and produces the appropriate progress feedback that gets diplayed by client App.
- Checks user dietary intake and verifies whether a specific food item can be had without exceeding the daily micro-nutrients intake limit.
- Logs micro-nutrients of food items consumed by the user and calculates the remaining permissible micro-nutrients amount for the rest of the day.
User module
- Logs the website administrator and nutritionists in and out.
- Displays the administrator dash board after authentication, which enables the admin to view/downlaod email sign-ups from the landing page.
- Displays the nutritionists' dashboard after authentication, which enables them to conduct counseling sessions through video calls.
Twilio module
- Retrieves Twilio chat access token from twilio backend server.
- Retrieves Twilio video access token from twilio backend server.
Main module
- Displays the index, promotion and privacy policy pages.
- Collects user emails from the index page and promotion sign up forms and saves it to the database.
- Collects and sends analytics data to Mixpanel.
Billing module
- Verifies and valiadte purchase tokens received from client.
- Updates purchases and subscriptions record on the database.
- Updates user susbscription status and expiry date.
API module
- Exposes an Api endpoint for email signups that collects signee email and saves it to the database.
- HTML, CSS, JavaScript
- Flask/Python
- JavaScript
- Twilio Video
- Twilio Chat
- MongoDB stitch
- MongoDB Atlas
- Firebase Cloud Storage
- Firebase Cloud Messaging
- Google cloud - App engine
- MongoDB Atlas
- Google cloud - Cloud Sql: PostgreSQL
In developing this project I used and modified a boilerplate open source flask App: Flask-Landing by Michael Herman
Check out my medium blog post From zero to published about my experience building this project and the challenges that came along with it.
- Clone this repo
- Create and activate a virtual environment
- Install the dependencies using requirements.txt
Go to config.py:
- Specifiy a secret key that will be used to encrypt your cookies.
- specifiy your database URI to configure flask to work with your SQL database.
During the local development process you can use the default configuration:
$ set APP_SETTINGS=app.config.DevelopmentConfig
When ready to deploy and after modifiting the production configurations in config.py you can use this variable:
$ set APP_SETTINGS=app.config.ProductionConfig
If you're using google's cloud SQL set this env. variable to the path of your json credential file to give flask access to you database:
$ set GOOGLE_APPLICATION_CREDENTIALS=silent-base-230717-54ef7bc5ff66.json
$ python manage.py create_db
$ python manage.py db init
Initiate models/tables.
$ python manage.py db migrate
Create default admin credentials and data values. Found here.
$ python manage.py create_admin
$ python manage.py create_data
Update DB with new models as found in app/models.py.
$ python manage.py db migrate
$ python manage.py db upgrade
$ python manage.py runserver
Without coverage:
$ python manage.py test
Without coverage and limited to a module inside "tests" directory
$ python manage.py test --test_name=test_endpoints
With coverage:
$ python manage.py cov