Interview At Health On Demand :
After Puzzle and Face to Face round I got an assignment to build in Python-Flask in a week. I Haven't touched flask in 4 yrs and that is why it was quite challenging but I did it.
Flask usually doesn't have any project structure like Django or Pyramid.
Flask usually doesn't have any project structure like Django or Pyramid.
I got selected and this task helped me a lot to convert HODs Monolith code base into micro-services.
Problem Statement :
A fictitious health-care startup that does health checks for multiple connected instruments. The instruments currently save results via mobile client when all check-ups are done, it does the bulk upload reports.
The organization is having trouble with querying it's a single source of truth database ( PostgreSQL) and need to transforming and migrating user reports data to separate database ( NoSQL ) on a periodic basis to store and serve user report data via the mobile client.
The project contains two services along with documentation,
MyHealthApp: to collect reports from doctors and machine
ReportsApp: for clients to browse the reports.
Additional Task
- Write Test Case
- REST-API testing with Postman
- API Documentation
Details and Code can be found at Github https://github.com/codetarsier/MyHealthApp/
Solution Goes Here
Reading Material
ClassBasedViews: http://flask.pocoo.org/docs/0.12/views/#method-views-for-apis
Flask Blueprint: https://exploreflask.com/en/latest/blueprints.html
ClassBasedViews: http://flask.pocoo.org/docs/0.12/views/#method-views-for-apis
Flask Blueprint: https://exploreflask.com/en/latest/blueprints.html
System Workflow
- User comes for a health checkup
- With HealthCheckup Machine doctor does the health checkup and machine stores all these reports in its local memory.
- MyHealthCheckupApp mobile/tab application pulls those reports from HC-Machine.
- MyHealthCheckupApp sends all the reports to MyHealthApp-API backend server.
- TaskRunner runs a background task and keeps checking for the new record on some interval ( Interval Time can be set in the settings file ). TaskRunner fetches the record and stores last checkup-reportID and when next time it runs, it fetches the incremental reports from previously-stored checkup-reportID.
- TaskRunner converts these reports into JSON then it sends them to ReportsApp-Server using ReportsAPI.
- Client/Customer login into ReportsApp mobile application and browse those reports from ReportsApp-API backend server.
- When the client provides username/password it gets authenticated from MyHealthApp-API.
- After authentication users can browse Reports.
Project Structure of 1. My Health App
Project Structure of 2. Reports App
Thanks.
├── LICENSE
├── README.md
├── docs
│ ├── postman-api-collections
│ └── postman-api-docs
├── myhealthapp
│ ├── applications
│ │ ├── __init__.py
│ │ ├── checkups
│ │ │ ├── __init__.py
│ │ │ ├── models.py
│ │ │ └── views.py
│ │ ├── common
│ │ │ ├── __init__.py
│ │ │ └── models.py
│ │ ├── machines
│ │ │ ├── __init__.py
│ │ │ ├── models.py
│ │ │ └── views.py
│ │ └── profiles
│ │ ├── __init__.py
│ │ ├── models.py
│ │ └── views.py
│ ├── config
│ │ ├── __init__.py
│ │ ├── development_sqlite.db
│ │ ├── secrets.json
│ │ └── settings.py
│ ├── manage.py
│ ├── migrations
│ │ ├── README
│ │ ├── alembic.ini
│ │ ├── env.py
│ │ ├── script.py.mako
│ │ └── versions
│ │ ├── 4cecc0d2ed8a_.py
│ │ └── cc805ab1bc28_.py
│ └── tests
│ ├── __init__.py
│ └── test_flaskr.py
└── requirements.txt
Project Structure of 2. Reports App
├── README.md
├── config
│ ├── __init__.py
│ ├── __pycache__
│ ├── secrets.json
│ └── settings.py
├── docs
│ └── ReportsAPIs.postman_collection.json
├── manage.py
├── reports
│ ├── __pycache__
│ ├── managers.py
│ ├── models.py
│ └── views.py
├── requirements.txt
├── tests
│ ├── __init__.py
│ ├── __pycache__
│ ├── conftest.py
│ ├── flask_test.cfg
│ └── test_user_reports.py
└── utils
├── __pycache__
├── random_hex.py
├── response_handler.py
└── rest_auth.py
Thanks.
0 Comments:
Post a Comment