Repository: Rishabh42/HealthCare-Insurance-Ethereum
Branch: master
Commit: 88db3cef10fa
Files: 20
Total size: 27.3 KB
Directory structure:
gitextract_ks5s19nd/
├── .gitignore
├── LICENSE
├── README.md
├── Web-client/
│ ├── package.json
│ ├── public/
│ │ ├── index.html
│ │ └── manifest.json
│ └── src/
│ ├── HealthCare.js
│ ├── hadmin.js
│ ├── index.css
│ ├── index.js
│ ├── insurance.js
│ ├── ladmin.js
│ ├── patient.js
│ └── web3.js
├── contracts/
│ ├── HealthCare.sol
│ └── Migrations.sol
├── migrations/
│ ├── 1_initial_migration.js
│ └── 2_deploy_HealthCare.js
├── truffle-config.js
└── truffle.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Don't track content of these folders
node_modules/
build/
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2019 Rishabh Thaney
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Medical Insurance claiming DApp (for ConsenSys)
Problem statement:
1) Patient logs in, uploads medical/lab test bills and submits it for insurance. Notifications are sent to hospital and lab admin.
2) Hospital admin logs in, verifies and approves the bills. This approval is stored on the smart contract
3) Lab admin approves the lab test bills. This approval is also stored on the smart contract
4) Once both of them approve, notification are sent to insurance admin.
5) Insurance admin can check for approvals of hospital and lab after which he will calculate the claim amount and do the claim.
`HealthCare.sol` contract maintains the logic for this DApp.
The web pages found in the `Web-client` folder are used to communicate with the deployed smart contract and also allow logging in for each specific user
## Steps to deploy and interact with the contract:
1. Copy and paste the contract code on https://remix.ethereum.org/
2. Run an instance of ganache-cli on your local machine and connect your metamask wallet to it. Also, add the first 3 accounts from ganache to your metamask by importing their private keys and assign the following names to it:
account 1: Hospital admin
account 2: Lab admin
account 3: Patient
3. Pass the Lab Admin's address as an argument in the constructor while deploying the contract
4. Select `Injected Web3` in the `Environment` field and make sure your Metamask wallet is unlocked. This will connect Remix to the first account(Hospital admin) in your Metamask wallet.
5. Deploy the contract
6. Select Account 3(Patient) and created a new medical record by calling the `newRecord` function with the respective fields.
7. You can check if the record was created and it's details by calling the `_records` mapping with index 1.
8. To sign the record, switch back to account 1(Hospital admin) in Metamask, enter the record's `_ID` in the `signRecord` function and click on transact.
9. Repeat the same steps using account 2(Lab Admin) from metamask.
10. Now the record is approved and you can verify the same by calling the `_records` mapping again where you can see that the `signatureCount` has incremented.
Note that you can not sign the record using the patient's account from metamask and neither can the same account sign a record twice.
Update:
With Remix's new interface, you need to change the account address from the `ACCOUNT` drop down on the `Deploy and Run` tab (required in step 8):
<img width="369" alt="Screenshot 2021-05-02 at 2 10 52 PM" src="https://user-images.githubusercontent.com/20457952/117578650-f00c6480-b10c-11eb-906e-c5ff79252585.png">
## Known issues:
- The table on the React front end doesn't display the records created by the user (Issue #1).
The main focus of this project at the time of making was the smart contract logic, I just made the front end in a jiffy as I had some extra time left after implementing the contracts.
Contributions to fix the open issues are welcome, you'll receive some DOGE as well 😏
## Steps to contribute
1. Fork this repo.
2. Commit your changes.
3. Send a PR to this project's `master` branch and add me as a reviewer
================================================
FILE: Web-client/package.json
================================================
{
"name": "web",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.6.1",
"react-dom": "^16.6.1",
"react-router-dom": "^4.3.1",
"react-scripts": "5.0.1",
"web3": "^4.0.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
================================================
FILE: Web-client/public/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<title>React App</title>
</head>
<body>
<div id="boot"></div>
<div id="root"></div>
</body>
</html>
================================================
FILE: Web-client/public/manifest.json
================================================
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
================================================
FILE: Web-client/src/HealthCare.js
================================================
import web3 from './web3';
const address = "0x29044ca950147a55ad4e6c8868f650713f932dd6";
const abi = [
{
"constant": false,
"inputs": [
{
"internalType": "uint256",
"name": "_ID",
"type": "uint256"
},
{
"internalType": "string",
"name": "_tName",
"type": "string"
},
{
"internalType": "string",
"name": "_date",
"type": "string"
},
{
"internalType": "string",
"name": "hName",
"type": "string"
},
{
"internalType": "uint256",
"name": "price",
"type": "uint256"
}
],
"name": "newRecord",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "ID",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "testName",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "date",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "hospitalName",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "price",
"type": "uint256"
}
],
"name": "recordCreated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "ID",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "testName",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "date",
"type": "string"
},
{
"indexed": false,
"internalType": "string",
"name": "hospitalName",
"type": "string"
},
{
"indexed": false,
"internalType": "uint256",
"name": "price",
"type": "uint256"
}
],
"name": "recordSigned",
"type": "event"
},
{
"constant": false,
"inputs": [
{
"internalType": "uint256",
"name": "_ID",
"type": "uint256"
}
],
"name": "signRecord",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "_records",
"outputs": [
{
"internalType": "address",
"name": "pAddr",
"type": "address"
},
{
"internalType": "uint256",
"name": "ID",
"type": "uint256"
},
{
"internalType": "string",
"name": "testName",
"type": "string"
},
{
"internalType": "string",
"name": "date",
"type": "string"
},
{
"internalType": "string",
"name": "hospitalName",
"type": "string"
},
{
"internalType": "uint256",
"name": "price",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isValue",
"type": "bool"
},
{
"internalType": "uint256",
"name": "signatureCount",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "recordsArr",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]
export default new web3.eth.Contract(abi, address);
================================================
FILE: Web-client/src/hadmin.js
================================================
import React from "react";
import ReactDOM from "react-dom";
import HealthCare from "./HealthCare";
import web3 from "./web3";
export default class Hadmin extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
this.state = {
recID: "",
message: ""
};
}
async handleClick(event) {
event.preventDefault();
const accounts = await web3.eth.getAccounts();
await HealthCare.methods
.signRecord(this.state.recID)
.send({ from: accounts[0], gas: 2100000 });
this.setState({ message: "Record approved!" });
}
render() {
return (
<div className="container container-fluid login-conatiner">
<div className="col-md-4">
<h3 className="text-center">Hospital Admin</h3>
<div className="login-form">
<h4 className="text-center">Approve Medical Record</h4>
<div className="form-group">
<input
type="number"
value={this.state.recID}
onChange={event => this.setState({ recID: event.target.value })}
className="form-control"
placeholder="ID"
/>
<br />
</div>
<div className="form-group">
<button
className="btn btn-primary btn-block"
onClick={this.handleClick}
>
Approve
</button>
</div>
{this.state.message && (
<p className="alert alert-danger fade in">{this.state.message}</p>
)}
</div>
</div>
<div className="col-md-6 col-md-offset-2">
<div className="c-list">
<h2 className="text-center">Records</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Date</th>
<th>Hospital Name</th>
<th>Price</th>
<th>Sign Count</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
);
}
}
================================================
FILE: Web-client/src/index.css
================================================
/* h1{
color: white;
font-size: 40px;
text-align: center;
font-family: calibri;
text-shadow: 2px 2px black;
}
header{
background-color: #26474e;
padding: 2px;
color: white;
font-size: 40px;
margin-top: -8px;
width: 101%;
margin-left: -8px;
}
.login{
position:relative;
width: 30%;
top:15px;
padding: 30px;
height: 350px;
float: left;
box-sizing: border-box;
background-color: #fff;
box-shadow: -20px 0 15px rgba(0,0,0,0.2);
margin-left: 35%;
}
h2{
font-family: calibri;
margin-top: -10px;
text-align: center;
font-size: 40px;
}
#selection{
font-family: calibri;
cursor: pointer;
display: block;
border-radius: 25px;
margin-top: 20px;
padding: 5px;
width: 100%;
border: 2px solid grey;
margin-bottom: 30px;
}
input{
font-family: calibri;
display: block;
border-radius: 25px;
margin-top: 20px;
padding: 5px;
width: 100%;
border: 2px solid grey;
}
button{
font-family: calibri;
border-radius:32px;
margin-top: 10px;
font-size: 20px;
margin-top:15px;
width: 100%;
color: white;
background: #B71C1C;
border: 2px solid #B71C1C;
transition: 0.5s;
cursor: pointer;
}
*/
.App {
text-align: center;
/*background: rgba(204, 204, 204, 0.5);*/
}
.App-header {
background-color: #15324B;
padding: 2px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
color: white;
font-size: 20px;
margin: 0px;
}
.App-title {
font-size: 1.8em;
}
================================================
FILE: Web-client/src/index.js
================================================
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route, Link,Redirect } from "react-router-dom";
import Patient from './patient'
import Hadmin from './hadmin'
import Labadmin from './ladmin'
import Insurance from './insurance'
import './index.css'
//import HealthCare from './HealthCare'
const FullApp = () => (
<Router>
<div>
<header className="App-header">
<h1 className="App-title text-center">HealthCare Insurance</h1>
</header>
<Route exact path="/" component={App} />
<Route path="/patient" component={Patient} />
<Route path="/hadmin" component={Hadmin} />
<Route path="/labadmin" component={Labadmin} />
<Route path="/insurance" component={Insurance} />
</div>
</Router>
);
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
user:'',
password:'',
login:false
}
}
render() {
return (
<div className="container container-fluid login-conatiner">
{this.state.login ? this.state.user === "" ? this.state.password === "patient"? <Redirect to="/patient" /> :
this.state.password === "hadmin" ?<Redirect to="/hadmin" /> :
this.state.password === "labadmin"? <Redirect to="/labadmin" />:
this.state.password === "insurance"? <Redirect to="/insurance" />:null:null:null}
<div style={{
maxWidth: '300px',
margin: '0 auto' }}>
<div className="login-form">
<form method="post">
<h2 className="text-center">Log in</h2>
<div className="form-group">
<select id="selection" className="form-control">
<option selected>Select Mode..</option>
<option>Patient</option>
<option>Hospital Admin</option>
<option>Lab Admin</option>
<option>Insurance Company</option>
</select>
</div>
<div className="form-group">
<input type="password" className="form-control" placeholder="Password" onChange={e => this.setState({password:e.target.value})} ></input></div>
<div className="form-group">
<button className="btn btn-primary btn-block" onClick={()=> this.setState({login:true})} >Submit</button></div>
<div className="clearfix">
</div>
</form>
</div>
</div>
</div>
);
}
}
ReactDOM.render(<FullApp />, document.getElementById('root'));
================================================
FILE: Web-client/src/insurance.js
================================================
import React from 'react';
//import './insurance.css';
export default class Insurance extends React.Component{
render(){
return(
<div className="col-md-12">
<h3 className="text-center">Insurance Page</h3>
<div className="c-list">
<h2 className="text-center">Approved Records</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Date</th>
<th>Hospital Name</th>
<th>Price</th>
<th>Sign Count</th>
</tr>
</thead>
</table>
</div>
</div>
);
}
}
================================================
FILE: Web-client/src/ladmin.js
================================================
import React from "react";
import ReactDOM from "react-dom";
import HealthCare from "./HealthCare";
import web3 from "./web3";
export default class Labadmin extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
this.state = {
recID: "",
message: ""
};
}
async handleClick(event) {
event.preventDefault();
const accounts = await web3.eth.getAccounts();
await HealthCare.methods
.signRecord(this.state.recID)
.send({ from: accounts[0], gas: 2100000 });
this.setState({ message: "Record approved!" });
}
render() {
return (
<div className="container container-fluid login-conatiner">
<div className="col-md-4">
<h3 className="text-center">Lab Admin</h3>
<div className="login-form">
<h4>Approve Medical Record</h4>
<div className="form-group">
<input
type="Number"
value={this.state.recID}
onChange={event => this.setState({ recID: event.target.value })}
className="form-control"
placeholder="Input"
/>
</div>
<div className="form-group">
<button
className="btn btn-primary btn-block"
onClick={this.handleClick}
>
Approve
</button>
</div>
{this.state.message && (
<p className="alert alert-danger fade in">{this.state.message}</p>
)}
</div>
</div>
<div className="col-md-6 col-md-offset-2">
<div className="c-list">
<h2 className="text-center">Records</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Date</th>
<th>Hospital Name</th>
<th>Price</th>
<th>Sign Count</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
);
}
}
================================================
FILE: Web-client/src/patient.js
================================================
import React from "react";
import ReactDOM from "react-dom";
import HealthCare from "./HealthCare";
import web3 from "./web3";
export default class Patient extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
this.state = {
recID: "",
pname: "",
dDate: "",
hname: "",
price: "",
message: ""
};
}
async handleClick(event) {
event.preventDefault();
const accounts = await web3.eth.getAccounts();
await HealthCare.methods
.newRecord(
this.state.recID,
this.state.pname,
this.state.dDate,
this.state.hname,
this.state.price
)
.send({ from: accounts[0], gas: 2100000 });
this.setState({ message: "Record created" });
}
render() {
return (
<div className="container container-fluid login-conatiner">
<div className="col-md-4">
<div className="login-form">
<form method="post" autoComplete="off">
<h2 className="text-center">New Record</h2>
<div className="form-group">
<input
type="text"
value={this.state.recID}
onChange={event =>
this.setState({ recID: event.target.value })
}
className="form-control"
placeholder="ID"
/>
</div>
<div className="form-group">
<input
type="text"
value={this.state.pname}
onChange={event =>
this.setState({ pname: event.target.value })
}
className="form-control"
placeholder="Name"
/>
</div>
<div className="form-group">
<input
type="Date"
value={this.state.dDate}
onChange={event =>
this.setState({ dDate: event.target.value })
}
className="form-control"
placeholder="Date"
/>
</div>
<div className="form-group">
<input
type="text"
value={this.state.hname}
onChange={event =>
this.setState({ hname: event.target.value })
}
className="form-control"
placeholder="Hospital Name"
/>
</div>
<div className="form-group">
<input
type="text"
value={this.state.price}
onChange={event =>
this.setState({ price: event.target.value })
}
className="form-control"
placeholder="Price"
/>
</div>
<div className="form-group">
<button
className="btn btn-primary btn-block"
onClick={this.handleClick}
>
Submit
</button>
</div>
{this.state.message && (
<p className="alert alert-danger fade in">
{this.state.message}
</p>
)}
<div className="clearfix" />
</form>
</div>
</div>
<div className="col-md-6 col-md-offset-2">
<div className="c-list">
<h2 className="text-center">Records</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Date</th>
<th>Hospital Name</th>
<th>Price</th>
<th>Sign Count</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
);
}
}
================================================
FILE: Web-client/src/web3.js
================================================
import Web3 from 'web3';
const web3 = new Web3(window.web3.currentProvider);
export default web3;
================================================
FILE: contracts/HealthCare.sol
================================================
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HealthCare {
address public hospitalAdmin;
address public labAdmin;
struct Record {
uint256 ID;
uint256 price;
uint256 signatureCount;
string testName;
string date;
string hospitalName;
bool isValue;
address pAddr;
mapping (address => uint256) signatures;
}
constructor(address _labAdmin) {
hospitalAdmin = msg.sender;
labAdmin = _labAdmin;
}
// Mapping to store records
mapping (uint256=> Record) public _records;
uint256[] public recordsArr;
event recordCreated(uint256 ID, string testName, string date, string hospitalName, uint256 price);
event recordSigned(uint256 ID, string testName, string date, string hospitalName, uint256 price);
modifier signOnly {
require (msg.sender == hospitalAdmin || msg.sender == labAdmin, "You are not authorized to sign this.");
_;
}
modifier checkAuthBeforeSign(uint256 _ID) {
require(_records[_ID].isValue, "Recored does not exist");
require(address(0) != _records[_ID].pAddr, "Address is zero");
require(msg.sender != _records[_ID].pAddr, "You are not authorized to perform this action");
require(_records[_ID].signatures[msg.sender] != 1, "Same person cannot sign twice.");
_;
}
modifier validateRecord(uint256 _ID) {
// Only allows new records to be created
require(!_records[_ID].isValue, "Record with this ID already exists");
_;
}
// Create new record
function newRecord (
uint256 _ID,
uint256 price,
string memory _tName,
string memory _date,
string memory hName
)
validateRecord(_ID) public {
Record storage _newrecord = _records[_ID];
_newrecord.pAddr = msg.sender;
_newrecord.ID = _ID;
_newrecord.testName = _tName;
_newrecord.date = _date;
_newrecord.hospitalName = hName;
_newrecord.price = price;
_newrecord.isValue = true;
_newrecord.signatureCount = 0;
recordsArr.push(_ID);
emit recordCreated(_newrecord.ID, _tName, _date, hName, price);
}
// Function to sign a record
function signRecord(uint256 _ID) signOnly checkAuthBeforeSign(_ID) public {
Record storage records = _records[_ID];
records.signatures[msg.sender] = 1;
records.signatureCount++;
// Checks if the record has been signed by both the authorities to process insurance claim
if(records.signatureCount == 2)
emit recordSigned(records.ID, records.testName, records.date, records.hospitalName, records.price);
}
}
================================================
FILE: contracts/Migrations.sol
================================================
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Migrations {
address public owner;
uint public last_completed_migration;
constructor() {
owner = msg.sender;
}
modifier restricted() {
if (msg.sender == owner) _;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
================================================
FILE: migrations/1_initial_migration.js
================================================
var Migrations = artifacts.require("./Migrations.sol");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};
================================================
FILE: migrations/2_deploy_HealthCare.js
================================================
var HealthCare = artifacts.require("./HealthCare.sol");
const TO_LAB_ADMIN_ADDRESS = "0xF6F2F51c07e44efE7BC25E0EC6B332f39d930ac0"; // hard coded address from Ganache
module.exports = function(deployer) {
deployer.deploy(HealthCare, TO_LAB_ADMIN_ADDRESS);
};
================================================
FILE: truffle-config.js
================================================
/*
* NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a
* function when declaring them. Failure to do so will cause commands to hang. ex:
* ```
* mainnet: {
* provider: function() {
* return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/<infura-key>')
* },
* network_id: '1',
* gas: 4500000,
* gasPrice: 10000000000,
* },
*/
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
};
================================================
FILE: truffle.js
================================================
/*
* NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a
* function when declaring them. Failure to do so will cause commands to hang. ex:
* ```
* mainnet: {
* provider: function() {
* return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/<infura-key>')
* },
* network_id: '1',
* gas: 4500000,
* gasPrice: 10000000000,
* },
*/
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};
gitextract_ks5s19nd/ ├── .gitignore ├── LICENSE ├── README.md ├── Web-client/ │ ├── package.json │ ├── public/ │ │ ├── index.html │ │ └── manifest.json │ └── src/ │ ├── HealthCare.js │ ├── hadmin.js │ ├── index.css │ ├── index.js │ ├── insurance.js │ ├── ladmin.js │ ├── patient.js │ └── web3.js ├── contracts/ │ ├── HealthCare.sol │ └── Migrations.sol ├── migrations/ │ ├── 1_initial_migration.js │ └── 2_deploy_HealthCare.js ├── truffle-config.js └── truffle.js
SYMBOL INDEX (18 symbols across 6 files)
FILE: Web-client/src/hadmin.js
class Hadmin (line 6) | class Hadmin extends React.Component {
method constructor (line 7) | constructor(props) {
method handleClick (line 16) | async handleClick(event) {
method render (line 25) | render() {
FILE: Web-client/src/index.js
class App (line 25) | class App extends React.Component {
method constructor (line 26) | constructor(props) {
method render (line 34) | render() {
FILE: Web-client/src/insurance.js
class Insurance (line 4) | class Insurance extends React.Component{
method render (line 5) | render(){
FILE: Web-client/src/ladmin.js
class Labadmin (line 6) | class Labadmin extends React.Component {
method constructor (line 7) | constructor(props) {
method handleClick (line 15) | async handleClick(event) {
method render (line 24) | render() {
FILE: Web-client/src/patient.js
class Patient (line 6) | class Patient extends React.Component {
method constructor (line 7) | constructor(props) {
method handleClick (line 20) | async handleClick(event) {
method render (line 35) | render() {
FILE: migrations/2_deploy_HealthCare.js
constant TO_LAB_ADMIN_ADDRESS (line 2) | const TO_LAB_ADMIN_ADDRESS = "0xF6F2F51c07e44efE7BC25E0EC6B332f39d930ac0";
Condensed preview — 20 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (32K chars).
[
{
"path": ".gitignore",
"chars": 60,
"preview": "# Don't track content of these folders\nnode_modules/\nbuild/\n"
},
{
"path": "LICENSE",
"chars": 1071,
"preview": "MIT License\n\nCopyright (c) 2019 Rishabh Thaney\n\nPermission is hereby granted, free of charge, to any person obtaining a "
},
{
"path": "README.md",
"chars": 3168,
"preview": "# Medical Insurance claiming DApp (for ConsenSys)\nProblem statement:\n1) Patient logs in, uploads medical/lab test bills "
},
{
"path": "Web-client/package.json",
"chars": 532,
"preview": "{\n \"name\": \"web\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"dependencies\": {\n \"react\": \"^16.6.1\",\n \"react-dom\":"
},
{
"path": "Web-client/public/index.html",
"chars": 631,
"preview": "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n <head>\r\n <meta charset=\"utf-8\">\r\n <link rel=\"shortcut icon\" href=\"%PUBLIC_URL"
},
{
"path": "Web-client/public/manifest.json",
"chars": 306,
"preview": "{\n \"short_name\": \"React App\",\n \"name\": \"Create React App Sample\",\n \"icons\": [\n {\n \"src\": \"favicon.ico\",\n "
},
{
"path": "Web-client/src/HealthCare.js",
"chars": 3579,
"preview": "import web3 from './web3';\n\nconst address = \"0x29044ca950147a55ad4e6c8868f650713f932dd6\";\n\nconst abi = [\n\t{\n\t\t\"constant\""
},
{
"path": "Web-client/src/hadmin.js",
"chars": 2316,
"preview": "import React from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport HealthCare from \"./HealthCare\";\r\nimport web3 from "
},
{
"path": "Web-client/src/index.css",
"chars": 1615,
"preview": "/* h1{\r\n color: white;\r\n font-size: 40px;\r\n text-align: center;\r\n font-family: calibri;\r\n text-shadow: 2px 2px blac"
},
{
"path": "Web-client/src/index.js",
"chars": 2602,
"preview": "import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport { BrowserRouter as Router, Route, Link,Redirect } "
},
{
"path": "Web-client/src/insurance.js",
"chars": 741,
"preview": "import React from 'react';\r\n//import './insurance.css';\r\n\r\n export default class Insurance extends React.Component{\r\n "
},
{
"path": "Web-client/src/ladmin.js",
"chars": 2268,
"preview": "import React from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport HealthCare from \"./HealthCare\";\r\nimport web3 from "
},
{
"path": "Web-client/src/patient.js",
"chars": 4235,
"preview": "import React from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport HealthCare from \"./HealthCare\";\r\nimport web3 from "
},
{
"path": "Web-client/src/web3.js",
"chars": 101,
"preview": "\nimport Web3 from 'web3';\n\nconst web3 = new Web3(window.web3.currentProvider);\n\nexport default web3;\n"
},
{
"path": "contracts/HealthCare.sol",
"chars": 2758,
"preview": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract HealthCare {\n address public hospitalAdmin;\n add"
},
{
"path": "contracts/Migrations.sol",
"chars": 531,
"preview": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ncontract Migrations {\n address public owner;\n uint public las"
},
{
"path": "migrations/1_initial_migration.js",
"chars": 129,
"preview": "var Migrations = artifacts.require(\"./Migrations.sol\");\n\nmodule.exports = function(deployer) {\n deployer.deploy(Migrati"
},
{
"path": "migrations/2_deploy_HealthCare.js",
"chars": 261,
"preview": "var HealthCare = artifacts.require(\"./HealthCare.sol\");\nconst TO_LAB_ADMIN_ADDRESS = \"0xF6F2F51c07e44efE7BC25E0EC6B332f3"
},
{
"path": "truffle-config.js",
"chars": 545,
"preview": "/*\n * NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a \n * function when declaring them. "
},
{
"path": "truffle.js",
"chars": 552,
"preview": "/*\n * NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a \n * function when declaring them. "
}
]
About this extraction
This page contains the full source code of the Rishabh42/HealthCare-Insurance-Ethereum GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 20 files (27.3 KB), approximately 7.6k tokens, and a symbol index with 18 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.