Giter VIP home page Giter VIP logo

eth-prescriptions's Introduction

Note: This project is a fork that fixes bugs in the outdated "eth-prescriptions" and enables it to work with latest MetaMask and Solidity versions. Truffle was added for simplified contract development and the contract is covered with JavaScript tests. Further enhancements to the original project's functionality are planned.

eth-prescriptions - Decentralized medical prescriptions on Ethereum

eth-prescriptions is a decentralized identity management and pharmaceutical ERP system built atop a permissioned Ethereum consortium network. This project implements a non-fungible token standard to completely eliminate the risk and implicit costs associated with pharmaceutical script fraud. g By creating a decentralized smart-contract standard that defines the method for ownership and transferability of a pharmaceutical script we:

  1. Remove the possibility of counterfeit/forged prescriptions is eliminated
  2. Enable regulatory insight into the quantity, concentration, movement, etc. of drugs
  3. Create an immutable record of the movement, quantity, and RX type of pharmacy scripts

eth-prescriptions accomplishes this goal through the tokenization of pharmaceutical prescriptions into an ERC-721 solidity contract standard. This non-fungible token carries metadata describing the doctor ID, the patient's public key, the drug RX Id, and the unit quantity to be dispensed.

Users, Roles, and Actions

The defined roles for this project scenario are as follows:

  1. Doctor - Prescribes medication by executing a smart contract which tokenizes a valid prescription, based on metadata such as Doctor ID, Patient Name, Quantity, Dosage, and Expiry Date.
  2. Patient - Receives a token representing a valid prescription issued by a Doctor. Fills a prescription at an authorized Pharmacy by sending token to the Pharmacy's public wallet.
  3. Pharmacy - Disburses medication after receiving token from a Patient, and is payment-agnostic as to receiving token or fiat currency as payment for prescription. Verifies a valid prescription by checking the permission blockchain for a signature between the Patient and Doctor.

Flow

Regulatory bodies with read-only access to the ledger may be considerded to be a "fourth role". To ensure this, these agents would not host mining nodes or contract-addresses.

Blockchain Network Architecture

eth-prescriptions is hosted on an Ethereum Consortium Network and is permissioned by a custom JSON genesis file. The network id for peering is 347329323. For this implementation, we configured five consortium members hosting nodes, with one hosted mining node per member. We prefunded the addresses with ether to remove the bottleneck associated with gas scarcity (i.e. DDoS is not a risk in a trusted consortium).

In full production, the nodes would be maintained by entities pre-authorized by an accredited regulatory body - ie.e public hospitals, government agencies, etc. The physical location of these nodes would be irrelevant (i.e. they could be hosted in a cloud environment or on-premise)

Consortium Rationale

The rationale for choosing a Consortium Network architecture over the Public Mainnet are as follows:

  1. Cost - network actors are able to decouple from the price of ether and avoid the gas fees associated with mainnet transactions
  2. Permissioned Privacy - Only approved entities are able host a node and gain access the state history of the blockchain. This provides a choke-point layer of protection which guards the integrity of participant data from the public, while still allowing regulatory insight, auditability, etc.
  3. Transaction Throughput - a consortium architectural approach allows us to scale independently of mainnet, and avoid the associated TPS bottlenecks, etc. exampleflow

Problems associated with the script fulfillment process

To better understand the current prescription paradigm, we consulted with an actual Pharmacist (name withheld) to learn more about security holes, pain-points, and inefficiencies associated with the current system.

What we learned:

  1. There is no authoritative source of truth when it comes to the data layer for pharma prescriptions. The differences in databases amongst public/private entities creates a systemic risk as it offloads the implicit cost associated with risk to other actors (i.e. the patient and/or doctor).

  2. There exists a quantifiable, implicit cost associated with asymmetric moral hazard - because the legal risk of forgery is offloaded to the patient and/or doctor. This truth is embodied through an anecdote told by 'the Pharmacist',

"Based on how I am personally feeling, my relationship with the doctor, and how truthful I believe the patient is being, I may decide to call the prescribing doctor and verify the prescription."

This illustrates the deficiency in trust, verifiability, and finality associated with the current system.

  1. Script verification is a process that can take upwards of 30 minutes to complete. Verifying the authenticity of the script is a manual process which the pharmacist has to do themselves. For example, the pharmacist must pass the log into a database, run an inventory update, wait for manager confirmation, and then fill the prescription.

How we created a better system:

  1. Our solution creates a decentralized, append-only data log where no single keyholder has root-access to the database. This means that no individual entity has the ability to alter the state history. We have solved the data-layer synchronization problem by creating a triple-entry accounting system where the system's integrity is grounded in both computational infeasibility and consortium-level access-control permissions.

  2. By leveraging the innate properties of the blockchain, we are able to create an auditable system of script ownership with verifiable ledger history. This allows for increased regulatory insight while also eliminating the base need for trust between doctors, patients, and pharmacists

  3. On the blockchain, transaction verification is instant. In addition, pharmacists receive the assurance of cryptographic transaction finality reached in under 4 blocks (or ~8 minutes)

Quantifying the Value of Our Solution

In June 2015 Medicare Strike Force led charges against 243 doctors, nurses, licensed medical professionals, health care company owners and others for allegedly submitting a total of $712 million in fraudulent billings, which was the result of a nationwide sweep โ€” the largest health care fraud takedown in history. More than 40 of the defendants were charged with fraud related to the prescription drug benefit program Medicare Part D. This a classic example of asymmetric risk resulting from moral hazard.

In economics, moral hazard occurs when one person takes more risks because someone else bears the cost of those risks.

By eliminating moral hazard, or the risk that a party has not entered into the contract in good faith our smart-contract has the potential to eliminate the aforementioned costs associated with fraudulent billing, as well as eliminate explicit costs associated with legal proceedings, supply loss, etc.

PrescriptionNFT.sol - Under the Hood

The PrescriptionNFT.sol file is a solidity smart-contract which formalizes the tokenization of the pharmaceutical script. The token takes an input from a doctor, which gets formalized as metadata. These inputs are:

  1. Doctor - ETH address of a doctor
  2. Patient Public Key - of the Patient which acts as a verifying mechanism for the pharmacist to prevent dishonest transfer
  3. Medication Name - the name of the pharmaceutical
  4. Brand Name - the specific brand of the pharmaceutical
  5. Dosage - a number representing the pill payload to be dispensed by the pharmacist
  6. Dosage Unit - this will be the formalized measurement unit (i.e mililiters)
  7. Date Filled - the date in which the order was filled by the pharmacist
  8. Total Amount - the total amount of pills to be dispensed by the pharmacist to the patient
  9. Expiration Date - the date in which the prescription expires. We check against the expiration date when the patient tries to fill the prescription

The code for the non-fungible ERC-721 token, PrescriptionNFT.sol is hosted here link.

Development

It is recommended to use Truffle and Ganache for simplified development.

Metamask is required as a Web3 provider when trying out the user interfaces.

eth-prescriptions's People

Contributors

keleffew avatar tylerdiaz avatar uziminhas avatar mdunsmore avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.