MobiCare healthcare system uses smart contracts to handle procedure records and stores medical records in BlockChain.
MobiCare is a mobile application, It facilitates the methods of consultation and follow-up between doctors and their patients. It includes all required data about the patient including prescriptions, medical reports, radiology images, diagnoses, treatment plans, allergies, laboratory results, etc…, the patient is allowed to check them whenever he wants and also he can give access to his doctor to get and upload his medical records. The system also provides the patient with an alarm for medication appointments, where he is reminded of the date of each medication that he has entered. The application also allows doctors to upload videos that help spread awareness for users throughout the application and also allows the patient to like and write comments on these videos.
As we see, MobiCare has many components and uses many technologies to store its data. So, we can explain MobiCare architecture in four main components/technologies:
- Mobile Application.
- Relational Database.
- Document Data Store.
- BlockChain.
MVVM (Model-View-ViewModel) MVVM is useful to move business logic from view to ViewModel and Model. ViewModel is the mediator between View and Model which carry all user events and return back the result. The key benefits of using MVVM are Business logic is separate from UI. The view is independent from the ViewModel class and only reads the state from ViewModel Code will be easy to maintain and update in terms of logic & UI Easy to Write the test cases for the project
We worked with MVC architecture (Model, View, and Controller) by replacing the view part with REST APIs. Also, the server-side provides us with an authentication system that verifies the permission of each role (patient, doctor, and admin).
- Model is the data part.
- View is the REST APIs part.
- Controller is the request-response handler.
We used the Firestore feature in the Firebase - which is (BaaS) - as a document data store and authentication system. Firebase Firestore provides many features:
- application layers
- unidirectional data flow
- mutable and immutable state
- stream-based architecture
It facilitates dealing with data in several ways: Adding new features becomes easier because you can build upon the foundation that you already have. The codebase becomes easier to understand, and you're likely to spot some recurring patterns and conventions as you read the code. Components have clear responsibilities and don't do too many things. This happens by design if your architecture is highly composable. Entire classes of problems go away (more on this later). You can have different kinds of components, by defining separate application layers for different areas of concern (UI, logic, services)
To connect to the blockchain network we used:
- Truffle: Building the smart contracts. compile and deploy our smart contracts. Dealing with our smart contracts.
- Ganache: Local blockchain network. Deploying our smart contract. Providing test accounts.
- Infura: Providing test Ethereum to deal with the blockchain network. Providing rpcURL and wsURL to our blockchain project.
- MetaMask: Private Wallet to deal with blockchain activities. Connected to Flutter to deal with the blockchain network.
- Sepolia Test Network: Deployed our smart contract on. Our blockchain network deals with our smart contract.
- Ethereum: The main network and the main cryptocurrency which our smart contract deals with. Any transaction created in the Sepolia test network must pay gas fees with Ethereum cryptocurrency.
- IPFS (Interplanetary File System): which we use to store our sensitive data - medical records - and respond with cid (content identifier), and then we store this cid in the blockchain network with the patient’s wallet address to access it when he wants.
- Web3.Storage: like Infura, it helps us to deal with IPFS to store and access our files in the IPFS Distributed network. It's a bridge between us and IPFS.