MedRec: Using Blockchain for Medical Data Access and Permission Management

Overview

MedRec

Medical records need innovation. Patients leave data scattered across various jurisdictions as life events take them away from one provider’s data to another. In doing so, they lose easy access to past data, as the provider, not the patient, generally retains primary stewardship. Patients thus interact with records in a broken manner that reflects the nature of how these records are managed. Patients with a huge medical history across many hospitals should not have to keep their history in the form of huge Patients and providers may face significant hurdles in initiating data retrieval and sharing due to economic incentives that encourage “health information blocking”. In the age of online banking and social media, patients are increasingly willing, able and desirous of managing their data on the web and on the go. This work explores a blockchain structure with its backend based on a Rinkeby Test network using Ethereum for its data storage and a smart contract for its data logic. Medical Records are data with sensitive information, and hence using DAPPS with smart contracts ensures safety features essential such as Zero Downtime (i.e. the data associated with a patient is always ready to be fetched and updated), Privacy (A Patient's data should be secured and of limited accessibility to only the people closely associated with the patient), Complete data integrity (The data must not be changed by someone in no authority to do so). This MedRec blockchain implementation seeks to solve this vast fragmentation of patient data by bringing it together and organizing it in the form of a ledger while providing it with the benefits provided by blockchain and DAPPs.

Hence, by implementing Medical records on the blockchain we achieve the following features which by other means could only be partially fulfilled or not fulfilled at all.

  1. Non-Repudiation of Medical Records, i.e. once the prescription is received by a patient from a doctor, the transaction is stored digitally on the blockchain signed by the private keys of both the patient and the doctor, hence if either party refuses to claim the ownership of the transaction, it can be easily detected using the public key of both.

  2. Only the authorized doctor can suggest a prescription that is to be added to the patient records.

  3. The integrity that the prescription once added cannot be modified by any of the parties involved, i.e. the doctor, the patient or an attacker trying to harass the patient.

  4. Automated transactions using smart contracts i.e. Once the patient authorizes a doctor to suggest a prescription, money is automatically transferred from the patient’s wallet to the patient contract and once the doctor sends a prescription, the money is transferred from the patient contract to the doctor’s wallet. The prescription to be sent is based on the mutual trust between the doctor and the patient and is not regulated by the application.

  5. The contracts were created with vulnerabilities like Re-entrancy, transaction ordering, value underflow-overflow etc. in mind hence the application is safe to use under such circumstances if they shall prevail.

Download APK

You can download the latest installable version of MedRec for Android from Releases or using this link: MedRec.apk

How to Use

Steps working for Android, IOS, MacOS, Windows, Linux and Web.

Step 1:

Download or clone this repo by using the link below:

https://github.com/Abhishekkr3003/MedRec.git

Step 2:

Go to project root and execute the following command in console to get the required dependencies (make sure you have flutter installed successfully):

flutter pub get 

Step 3:

Connect your device and run:

flutter run 

Screenshots on Android

Screenshots on Linux

Libraries & Tools Used

Folder Structure

Here is the core folder structure which flutter provides.

flutter-app/
|- android
|- assets
|- build
|- ios
|- lib
|- test
|- linux
|- macos
|- test
|- web
|- windows

Here is the folder structure we have been using in this project

assets/
|- contracts/
        |- doctor.json
        |- patient.json
|- Icons/
        |- 1024.png
|-images
        |-welcomeImage.png

lib/
|- Pages/
        |- doctor_home_page.dart
        |- login.dart
        |- patient_home_page.dart
        |- splash_screen.dart
        |- view_prescription.dart

|- Utils/
        |- routes.dart
        |- routes.dart

|- main.dart

Routes

This file contains all the routes for your application.

import 'package:flutter/material.dart';
import 'package:medrec/Pages/doctor_home_page.dart';
import 'package:medrec/Pages/login.dart';
import 'package:medrec/Pages/patient_home_page.dart';

class MyRoutes {
  static const String loginPage = "/loginPage";
  static const String doctorHomePage = "/doctorHome";
  static const String patientHomePage = "/patientHome";

  static final routes = <String, WidgetBuilder>{
    loginPage: (context) => const LoginPage(),
    doctorHomePage: (context) => const DoctorHomePage(),
    patientHomePage: (context) => const PatientHomePage(),
  };
}

Main

This is the starting point of the application. All the application level configurations are defined in this file i.e, theme, routes, title, orientation etc.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import 'Pages/splash_screen.dart';
import 'Utils/routes.dart';

void main() {
  SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
      statusBarColor: Colors.black, statusBarIconBrightness: Brightness.light));
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        textTheme: GoogleFonts.poppinsTextTheme(
          Theme.of(context).textTheme,
        ),
      ),
      home: const Splash2(),
      routes: MyRoutes.routes,
    );
  }
}

Solidity Contracts

Doctor

Patient

You might also like...

Naan is an easy to use and secure wallet for NFTs & DeFi on the Tezos blockchain.

Naan is an easy to use and secure wallet for NFTs & DeFi on the Tezos blockchain.

Naan - A Tasty Tezos Wallet Naan is a fun, simple, and secure way to create a Tezos wallet, collect NFTs, and explore the new world of Web3 on Tezos.

Aug 26, 2022

Basic todo mobile application built on top of the ETH blockchain with Flutter, Truffle and Ganache.

Basic todo mobile application built on top of the ETH blockchain with Flutter, Truffle and Ganache.

Todo-DAPP This project is a basic mobile Todo App build with Flutter. The backend consist in a Solidity contract running on the Ethereum Blockchain. C

Sep 28, 2022

constructing... Flutter, Ganache, Truffle, Remix, Getx Pattern, Infura, GetX, Blockchain

constructing... Flutter, Ganache, Truffle, Remix, Getx Pattern, Infura, GetX, Blockchain

Dec 20, 2022

Tezart helps to interact with ​Tezos blockchain.

Tezart What it is Tezart is a Dart library for building decentralized applications on Tezos blockchain. Tezart interacts with a Tezos node to send tra

Dec 14, 2022

A blockchain based voting application built as a project for KJSCE Hack 6.0

Secure Vote A decentralized and transparent Blockchain-based voting application, built with Flutter, a Solidity Smart contract, Firebase and Infura as

Nov 15, 2022

A mobile-responsive blockchain website built with flutter. NB: For educational purposes.

A mobile-responsive blockchain website built with flutter.      NB: For educational purposes.

Excursy A mobile-responsive blockchain website built with flutter. Build flutter build web --web-renderer html --release or flutter build web --web-re

Oct 25, 2022

Food Delivery on Blockchain

Food Delivery on Blockchain

Food Delivery on Blockchain This research is an application development to increase the reliability of food delivery businesses. By applying proven an

May 19, 2022

DeFi Scan - Mobile BlockChain Explorer app for cryptocurrency accounts.

DeFi Scan - Mobile BlockChain Explorer app for cryptocurrency accounts.

DeFi Scan This is the official repository for DeFi Scan - a mobile blockchain explorer built with Dart/Flutter for searching, curating and storing det

Dec 20, 2022

An Application built for students to access Notes , Question Papers , Syllabus and Resources for all Subjects of O.U (Osmania University) using Flutter 📘👨‍🎓

An Application built for students to access Notes , Question Papers , Syllabus and Resources for all Subjects of O.U (Osmania University) using Flutter  📘👨‍🎓

OU Notes [Osmania University (O.U)] . For the Students , By the Students. An Application for Osmania University students to access educational materia

Nov 20, 2022
Releases(v1.0.0)
  • v1.0.0(May 25, 2022)

    MedRec

    Medical records need innovation. Patients leave data scattered across various jurisdictions as life events take them away from one provider’s data to another. In doing so, they lose easy access to past data, as the provider, not the patient, generally retains primary stewardship. Patients thus interact with records in a broken manner that reflects the nature of how these records are managed. Patients with a huge medical history across many hospitals should not have to keep their history in the form of huge Patients and providers may face significant hurdles in initiating data retrieval and sharing due to economic incentives that encourage “health information blocking”. In the age of online banking and social media, patients are increasingly willing, able and desirous of managing their data on the web and on the go. This work explores a blockchain structure with its backend based on a Rinkeby Test network using Ethereum for its data storage and a smart contract for its data logic. Medical Records are data with sensitive information, and hence using DAPPS with smart contracts ensures safety features essential such as Zero Downtime (i.e. the data associated with a patient is always ready to be fetched and updated), Privacy (A Patient's data should be secured and of limited accessibility to only the people closely associated with the patient), Complete data integrity (The data must not be changed by someone in no authority to do so). This MedRec blockchain implementation seeks to solve this vast fragmentation of patient data by bringing it together and organizing it in the form of a ledger while providing it with the benefits provided by blockchain and DAPPs.

    Hence, by implementing Medical records on the blockchain we achieve the following features which by other means could only be partially fulfilled or not fulfilled at all.

    1. Non-Repudiation of Medical Records, i.e. once the prescription is received by a patient from a doctor, the transaction is stored digitally on the blockchain signed by the private keys of both the patient and the doctor, hence if either party refuses to claim the ownership of the transaction, it can be easily detected using the public key of both.

    2. Only the authorized doctor can suggest a prescription that is to be added to the patient records.

    3. The integrity that the prescription once added cannot be modified by any of the parties involved, i.e. the doctor, the patient or an attacker trying to harass the patient.

    4. Automated transactions using smart contracts i.e. Once the patient authorizes a doctor to suggest a prescription, money is automatically transferred from the patient’s wallet to the patient contract and once the doctor sends a prescription, the money is transferred from the patient contract to the doctor’s wallet. The prescription to be sent is based on the mutual trust between the doctor and the patient and is not regulated by the application.

    5. The contracts were created with vulnerabilities like Re-entrancy, transaction ordering, value underflow-overflow etc. in mind hence the application is safe to use under such circumstances if they shall prevail.

    How to Use

    Step 1:

    Download or clone this repo by using the link below:

    https://github.com/Abhishekkr3003/MedRec.git
    

    Step 2:

    Go to project root and execute the following command in console to get the required dependencies (make sure you have flutter installed successfully):

    flutter pub get 
    

    Step 3:

    Connect your device and run:

    flutter run 
    

    Screenshots

    Libraries & Tools Used

    Folder Structure

    Here is the core folder structure which flutter provides.

    flutter-app/
    |- android
    |- assets
    |- build
    |- ios
    |- lib
    |- test
    |- linux
    |- macos
    |- test
    |- web
    |- windows
    

    Here is the folder structure we have been using in this project

    assets/
    |- contracts/
            |- doctor.json
            |- patient.json
    |- Icons/
            |- 1024.png
    |-images
            |-welcomeImage.png
    
    lib/
    |- Pages/
            |- doctor_home_page.dart
            |- login.dart
            |- patient_home_page.dart
            |- splash_screen.dart
            |- view_prescription.dart
    
    |- Utils/
            |- routes.dart
            |- routes.dart
    
    |- main.dart
    

    Routes

    This file contains all the routes for your application.

    import 'package:flutter/material.dart';
    import 'package:medrec/Pages/doctor_home_page.dart';
    import 'package:medrec/Pages/login.dart';
    import 'package:medrec/Pages/patient_home_page.dart';
    
    class MyRoutes {
      static const String loginPage = "/loginPage";
      static const String doctorHomePage = "/doctorHome";
      static const String patientHomePage = "/patientHome";
    
      static final routes = <String, WidgetBuilder>{
        loginPage: (context) => const LoginPage(),
        doctorHomePage: (context) => const DoctorHomePage(),
        patientHomePage: (context) => const PatientHomePage(),
      };
    }
    
    

    Main

    This is the starting point of the application. All the application level configurations are defined in this file i.e, theme, routes, title, orientation etc.

    import 'package:flutter/material.dart';
    import 'package:flutter/services.dart';
    import 'package:google_fonts/google_fonts.dart';
    import 'Pages/splash_screen.dart';
    import 'Utils/routes.dart';
    
    void main() {
      SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
          statusBarColor: Colors.black, statusBarIconBrightness: Brightness.light));
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          debugShowCheckedModeBanner: false,
          theme: ThemeData(
            textTheme: GoogleFonts.poppinsTextTheme(
              Theme.of(context).textTheme,
            ),
          ),
          home: const Splash2(),
          routes: MyRoutes.routes,
        );
      }
    }
    
    

    Solidity Contracts

    Doctor

    Patient

    Source code(tar.gz)
    Source code(zip)
    MedRec.apk(19.66 MB)
Owner
Abhishek Kumar
LNMIIT' 23 | Winner in Idea Hackathon 2019 | Software Developer
Abhishek Kumar
Official Sonr Blockchain Node implementation with Frontend Clients to access Wallet.

Sonr Blockchain Sonr-Chain is a blockchain built using Cosmos SDK and Tendermint and created with Starport. Get started starport chain serve serve com

Sonr 625 Dec 29, 2022
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Vehement 8 Nov 26, 2022
A sample app of using the image_picker + path_provider and permission_handler package to request permission and store photos on mobile

image_picker_example A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you sta

iang12 4 Apr 19, 2022
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.

Flutter permission_handler plugin The Flutter permission_handler plugin is build following the federated plugin architecture. A detailed explanation o

Baseflow 1.7k Dec 31, 2022
Unloc customizations of the Permission plugin for Flutter. This plugin provides an API to request and check permissions.

Flutter Permission handler Plugin A permissions plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check perm

Unloc 1 Nov 26, 2020
A tool for digitizing medical history, prescriptions, and reports.

Shealth A tool for digitising medical history, prescriptions and report Landing page Login page Home page Registeration page Installation To render re

Servatom 15 Dec 26, 2022
eDoc mobile application is designed as an example of a medical application that allows doctors to manage appointments

eDoc Mobile App (Demo Version) ✨ About The eDoc mobile application is designed a

Dileepa Bandara 4 Nov 14, 2022
Data Migrator - provide a universal translator for data by being portable, diverse, and efficient in migrating and converting data across discrete schemas

Data Migrator - provide a universal translator for data by being portable, diverse, and efficient in migrating and converting data across discrete schemas

Tanner Meade 77 Jan 2, 2023
(Top 10 GDG Devfest 2021) Mobile Application to prove intellectual property rights using blockchain technology and NFT

brainshield A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

Nguyen Minh Dung 4 Jan 12, 2022
Dart web3 - A dart library that connects and interacts with the Ethereum blockchain

dart_web3 A dart library that connects and interact with the Ethereum blockchain

p2bh 9 Sep 13, 2022