Data model of the app
In this article I’m going to explain the data model of my app named “Hisab-Kitab” which I’m building under my internship with Hasura.
Before we jump into the data model, you might like to see the idea of my app and the prototype of my app for better understanding.
For modelling the data I’ve used an incredibly efficient and easy to use tool which is Pony ORM’s Entity-Relationship Diagram Editor.
Pony is an advanced object-relational mapper.
An ORM allows developers to work with the content of a database in the form of objects. A relational database contains rows that are stored in tables. However, when writing a program in a high level object-oriented language, it is much more convenient when the data retrieved from the database can be accessed in the form of objects. Pony ORM is a library for Python language that allows you to conveniently work with objects that are stored as rows in a relational database.
Pony ORM’s Entity-Relationship Diagram Editor is a great tool for prototyping.
You can create your database diagram online at https://editor.ponyorm.com, generate the database schema based on the diagram and start working with the database using declarative queries in seconds.
Before actually drawing the prototype I scribbled a bit on the paper. This shows the model too which is actually not stored anywhere and is used to computational purpose upon request. A database view is a searchable object in a database that is defined by a query. Though a view doesn’t store data, some refer to a views as “virtual tables,” you can query a view like you can a table. A view can combine data from two or more table, using joins, and also just contain a subset of information.

Although while developing the app I’ve found out that I can make the data schema more efficient by making some changes. So the updated prototype of the data schema is:-

Let me now discuss how all the relevant data can be captured by this data model.
In the Auth_table all the required information of the user is captured. In the expenditure table all the information of the expense i.e What was the expense, amount spent and the date of expenditure , is captured along with a related id. At last, whenever we try to draw insights we can easily create a view table from these tables and show the required output.
Here ‘insight’ is the view table which draws various information from the ‘expenditure’ table and stores in it.
So this was the data schema of my app called “Hisab-Kitab” capturing all the relevant data efficiently. Thanks!
Index of contents in this web-app development series
- Idea of the app — Hisab-Kitab: Save to Earn
- Prototype of the app
- Setting up the development environment
- Learning Git
- Setting up local development setup
- Data model of the app
- Hasura Data API + Postman collection
- Hasura Auth API + Postman collection
- App Screen 1 (UI + Backend integration)
- Updates
- App Screen 2 (UI + Backend integration)
- App Screen 3 (UI + Backend integration)
- User feedback and Testing
- Final app link