• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

medical records on the blockchain https://medrec.media.mit.edu/

MedRec

Patient controlled medical records

THIS PROJECT IS CURRENTLY NOT MAINTAINED


https://medrec.media.mit.edu

Components

  • Database Manager - API written in GoLang that provides access to an underlying database. R/W access is governed by permissions stored on the blockchain.
  • Ethereum Client - A pointer to the go-ethereum codebase
  • SmartContracts - The Solidity contracts and their tests that are used by other MedRec components
  • UserClient - A front-facing node app that can be used by any party to interact with the MedRec system.

This project is being developed under the GPLv2 LICENSE.

For production

1. Install golang and build

Install golang from the repositories for your operating system (apt, yum, homebrew, etc.) or from the golang website. https://golang.org/dl/

Then build the go components of medred

$ go build

2. Install NPM

Install NPM: https://nodejs.org/en/

3. Install npm packages

Setup the UserClient

$ cd UserClient
$ npm install
$ npm run build
$ cd ..

To resolve an annoying won't fix bug in the bitcoin-mnemonic library you also need to run the following in the UserClient directory.

$ rm -r node_modules/bitcore-mnemonic/node_modules/bitcore-lib

Setup the Javascript helper files

$ cd GolangJSHelpers
$ npm install
$ cd ..

4. Setup your MySQL Database

You need to be running a mysql database instance locally with username:password root:medrecpassword:

  • run query /scripts/medrec-v1.sql. It will create a schema called medrec-v1 for you to store/retrieve information from. It is representing the "remote" DB.
  • run query /scripts/medrecWebApp.sql for the "local" DB.

If you do not want to be able to look at the example patient records you can skip this section.

5. Start all of MedRec's components

$ ./medrec EthereumClient
$ ./medrec DatabaseManager
$ ./medrec UserClient

For Development

1. Setup a PoA blockchain

Refer to this guide to setup a proof of authority blockchain with go-ethereum as its backend. Change the RPC port in the above tutorial to 8545 while starting geth.

2. Connect to the blockchain

MedRec has to be modified to connect to the provider nodes of this blockchain. Edit medrec-genesis.json and startGeth.js in GolangJSHelpers/ to match with your genesis and chain parameters of your PoA blockchain.

3. Install Go and golang libraries

Install Go: https://github.com/golang/go or brew install go if you're on macOS

cd into your GOPATH and run

$ go get -v ./...

4. Install NPM

Install NPM: https://nodejs.org/en/

5. Install npm packages

$ cd UserClient
$ npm install
$ npm run build

To resolve an annoying won't fix bug in the bitcoin-mnemonic library you also need to run the following in the UserClient directory.

$ rm node_modules/bitcore-mnemonic/node_modules/bitcore-lib

6. Run the Database manager

You need to be running a mysql database instance locally with username:password root:medrecpassword:

create user 'password'@'localhost' identified by 'medrecpassword';
  • run query /scripts/medrec-v1.sql:
mysql -u password -p < medrec-v1.sql

It will create a schema called medrec-v1 for you to store/retrieve information from. It is representing the "remote" DB.

  • run query /scripts/medrecWebApp.sql for the "local" DB:
mysql -u password -p < medrecWebApp.sql

$ go run main.go DatabaseManager

It should start the DatabaseManager running on localhost:6337

7. Deploy the contracts

You will need to install the program truffle using npm to deploy contracts:

npm install truffle -g

Make sure that the parameters in SmartContracts/truffle.js match your PoA chain.

Then deploy the contract using truffle deploy. The ganache-cli should respond to this command showing that the contracts have been deployed.

8. Start the UserClient

$ cd UserClient
$ npm start

if it throws an error with web3-requestManager, do npm install [email protected].

9. Building a new production version

$ go build
$ cd UserClient
$ npm run build

Getting Started With the MedRec Codebase

1. Link MedRec to an existing database

In order to use MedRec as a medical records provider, MedRec's Database Manager needs to be linked to the provider's database. This does not require a change in the database itself, but does involve changing MedRec to fit the form of database used. This might involve more or less work (from changing a few table names, up to completely rewriting queries) depending on the form and structure of database used. In order to link MedRec to your database, the data will need to be directly queryable by an external piece of software -- e.g., using SQL or other style queries.

SQL-type databases

MedRec uses the Golang mysql driver (github.com/go-sql-driver/mysql) to interface with its test database. There is support for a wide range of common hospital database types, including

Non-SQL-type databases

There's a pretty exhaustive list of Golang drivers for different forms of database. Depending on the database

Setup Guide

All the files that need to be changed are located in the DatabaseManager/remoteRPC directory. This manages remote access to your database by people granted access to view a particular record.

  1. Instantiate the database: In databse.go,
  • SQL (but not MySQL): replace the database driver for mysql (import "github.com/go-sql-driver/mysql") with the driver for your database format
  • NOSQL (/other) -- also get rid of import "database/sql"

Once the driver and database type has been set, replace the contents of instantiateDatabase() with your own server.

func instantiateDatabase() *sql.DB {

  db, err := sql.Open("mysql",
    "<user>:<password>@tcp(127.0.0.1:<port>)/<schema>")
  if err != nil {
    log.Fatal(err)
  }

  return db
}

  1. Setting up the eth key-value store The Database Manager uses a LevelDB key-value store to link the unique patient identifier used by MedRec (the patient's ethereum address) to some unique identifier in the record provider's database. This is managed in lookup.go.

A unique ID from the database needs to be sent to the prospective patient, so that they can enter it, along with the creation of an ethereum address, when they create an account. This then creates an entry in the LevelDB (Lookup Table) that maps the patient's AgentID (some unique patient ID) to their eth address. Depending on the type of UID that is used to identify the patient, you might want to change the type of args.AgentID to match that of the stored value.

type AccountArgs struct {
    Account string
    AgentID string
}

...

  err := tab.Put([]byte(args.Account), []byte(args.AgentID), nil)
  if err != nil {
    log.Println(err)
  }

NB -- you don't need to add the eth address of the agent -- that gets added automatically when an account is made. To test the functionality of this, navigate to the frontend and create a new patient account, with some UID stored in your database. The records returned for that patient should match those associated with that UID.

  1. Requesting Documents The management of this part of MedRec will vary with the kind of information the record provider should make available to each patient. The generic function PatientDocuments in documentRequest.go provides an outline for receiving a call from a patient's account, checking that their eth address is listed in the key-value store, and replying with the contents of that request (reply.Documents).

In order to adapt this to specific instances, the names of specific tables must be changed to align the provider database with the records requested. In PatientDocuments these are specified as:

  var (
    PatientID   string
    DocumentID int
    DocDateTime string
    PracticeID string
    RecvdDateTime string
  )

The names of the result (params.Document, defined in params.go) remain the same -- the entries in the provider database that correspond to them should be changed to match.

  1. The rest of the Database Manager (overview) Instructions 1, 2, and 3 unpack the 'provider-facing' layers of the Database Manager, which interact directly with the provider database. The rest of this repo (DatabaseManager/RemoteRPC) deals with the blockchain interface.

In particular ethereum.go handles authentication and connection to the ethereum client.

  • Authentication: Recover(r *http.Request, args *RecoverArgs, reply *RecoverReply) recovers

2. Joining the blockchain as a provider

3. Write a custom contract

More Repositories

1

AI-generated-characters

AI-generated-character
Jupyter Notebook
455
star
2

Junkyard-Jumbotron

The Junkyard Jumbotron is a web tool that makes it really easy to combine a bunch of random displays into a single, large virtual display. It works with laptops, tablets, smartphones -- anything that can run a web browser. And the magic is that all you need to do to configure one is take a photograph of all the screens.
C++
199
star
3

unhangout-old

RETIRED
JavaScript
155
star
4

sherlock-project

This repository provides data and scripts to use Sherlock, a DL-based model for semantic data type detection: https://sherlock.media.mit.edu.
Jupyter Notebook
143
star
5

PersonalizedMultitaskLearning

Code for performing 3 multitask machine learning methods: deep neural networks, Multitask Multi-kernel Learning (MTMKL), and a hierarchical Bayesian model (HBLR).
Python
124
star
6

gobo

💭 Gobo: Your social media. Your rules.
JavaScript
108
star
7

vizml

Plotly dataset-visualization pairs, feature extraction scripts, and model training code for VizML (CHI 2019)
Python
100
star
8

para

JavaScript
100
star
9

django-channels-presence

"Rooms" and "Presence" for django-channels
Python
78
star
10

viznet

VizNet is a repository providing real-world datasets that enable, among other things, (re)running empirical studies with higher ecological validity
Jupyter Notebook
74
star
11

MDAgents

Python
27
star
12

Health-LLM

Python
22
star
13

prg-raise-playground

Boilerplate for playing with and deploying Scratch 3.0 modifications!
JavaScript
19
star
14

MediaCloud-Dashboard

Front-end for the MediaCloud database
JavaScript
16
star
15

storybook-photoshop-jsx

JavaScript
16
star
16

ajl.ai

A web application for crowdsourcing image annotations.
JavaScript
16
star
17

ml-certs

Media Lab Digital Certificates
HTML
15
star
18

MITLegalForum

Transforming Law and Legal Processes for the Digital Age
15
star
19

AffectiveComputingQuantifyMeAndroid

The QuantifyMe platform helps researchers conduct single-case experiments in an automated and scientific manner.
Java
15
star
20

ai-generated-media

Jupyter Notebook
14
star
21

unhangout

Python
14
star
22

2019-MIT-Computational-Law-Course

MIT IAP 2019 Computational Law Course
Go
14
star
23

HERMITS_UIST20

Python
13
star
24

nmi-ai-2023

A repository for the paper "Beliefs about AI influence human-AI interaction and can be manipulated to increase perceived trustworthiness, empathy, and effectiveness" Nature Machine Intelligence 2023.
Jupyter Notebook
13
star
25

empathic-stories

HTML
11
star
26

Evolutron

A mini-framework to build and train neural networks for molecular biology.
Jupyter Notebook
11
star
27

eegreconstruction

Jupyter Notebook
10
star
28

OpenCyberDance

Open source Cybernetic Dance System
TypeScript
10
star
29

kukaslxctrl

A small library intended for controlling KUKA robots using KRC4 over KUKA RSI (Robot Sensor Interface) from Simulink.
C
10
star
30

word-tree

A Unity app designed to help children learn English letter-sound correspondence, sound blending, and sight word recognition.
C#
9
star
31

Terra-Incognita

Your personal media geography. Catherine's thesis project.
JavaScript
9
star
32

CityMatrixAI

CityMatrix is an urban decision support system augmented with artificial intelligence. This repo is the UI for the AI assistant of the project.
C#
9
star
33

2018-MIT-IAP-ComputationalLaw

MIT IAP Computational Law Course
8
star
34

bert-slu

Python
8
star
35

ai-false-memories

repository for the paper "AI-Induced False Memories in Simulated Witness Interviews with Large Language Model"
Jupyter Notebook
8
star
36

DeepABM-Pandemic

Python
7
star
37

Wearable-Sanitizer

Wearable Sanitizer
C++
7
star
38

promise-tracker-builder

Web app for developing and tracking civic monitoring campaigns
JavaScript
7
star
39

MAS.S60.Fall2020

Experiments in Deepfakes : Creativity, Computation, and Criticism
Jupyter Notebook
7
star
40

Generative-Autonomous-Legal-Entities

GALE - Exploring the Potential and the Perils of Autonomous Legal Entities Powered by Generative AI
7
star
41

FutureLaw

Future Law at the MIT Media Lab
6
star
42

Vida_Modeling

User Interface and Simulation Platform for a System Dynamics Model
Python
6
star
43

Realtime-Community-Sign

Software to run LED signs to show community information like bus arrival times and event calendars
Python
6
star
44

TI_EVM_logger

Sensor data log (+stream to websocket) for evaluation modules by Texas Instrument (tested with FDC2214 and LDC1614)
Python
6
star
45

NewsPix

NewsPix is a suite of apps by Matt Carroll, Catherine D'Ignazio and Jay Vachon that drive engagement in local news through pictures and visualizations. Our first app is a browser extension for Chrome and Firefox that delivers breaking news to the new tab window of a desktop user's browser.
CSS
6
star
46

MappingPoliceViolence-Scaper

Scripts that pull together data for our investigation into police violence against un-armed people of color in the US.
HTML
6
star
47

2021-MIT-IAP-Computational-Law-Course

5
star
48

livingmemory

JavaScript
5
star
49

TrustCoreID

For Human Dynamics open collaboration on CoreID project
JavaScript
5
star
50

ml-certs-website-archive

[ARCHIVE] Webpage for the Digital Certificates Project
HTML
5
star
51

Project-Captivate

Glasses project for crowds
C
5
star
52

tidstream

Tools for generating and manipulating live Vorbis and Opus streams
C
5
star
53

thefestival.media.mit.edu

Official website for the Festival of Learning at the MIT Media Lab
HTML
4
star
54

tidzam

Python
4
star
55

doodlebot

DoodleBot guide and resources
OpenSCAD
4
star
56

MIT-CLR

Public Facing GitHub Repo of MIT Computational Law Report
4
star
57

SAR-opal-base

A generalized Unity game builder designed for use in child-robot interactions.
C#
4
star
58

omniFORM

C++
4
star
59

storyspace

A simple storytelling game built in Unity3D / Mono, designed for use with a storytelling robot.
C#
4
star
60

Society-of-Neurons

Jupyter Notebook
4
star
61

SLIC

Sovereign Legal Identity Challenge
4
star
62

OpenMediaLegalHack

#hack4music at MIT Media Lab
4
star
63

MediaCloud-Tag-Explorer

Website you can use to explore MediaCloud tag sets
Python
4
star
64

spiral

Archimedean spiral generator for embroidered speaker coils
Python
4
star
65

AffectiveComputingQuantifyMeDjango

The QuantifyMe platform helps researchers conduct single-case experiments in an automated and scientific manner.
Python
4
star
66

Nightlights-Mobility

A project seeking to link remote observation nightlights data with telecoms-based mobility data
Python
4
star
67

Community-Sign-Server

Server software to manage a network of LED signs showing community information like bus arrival times and event calendars
PHP
3
star
68

tega_teleop

A python rosnode for teleoperating the Tega robot
Python
3
star
69

GDPR-Hack-Day

GDPR Sunrise Eve Hack Day
3
star
70

Computational-Law-IAP-Workshop-2020

3
star
71

jitsi-meet-server

Experimental Vagrant/Salt configuration for automatically deploying a Jitsi Meet video server
Shell
3
star
72

prg-s02-system-setup

Python
3
star
73

pugg

A demon of the second kind, designed to overthrow Pugg, the information pirate
Python
3
star
74

asr_google_cloud

subscribes to microphone feed and publishes ASR result over ROS
Python
3
star
75

DistributedIdentity

Collaborative Project of Sarah Schwettmann and Dazza Greenwood
3
star
76

rr_tools

Tools for analysis and processing for the relational robot project.
Python
3
star
77

MediaMeter-Coder

Code to compare historical coverage of US and World issues in US newspapers.
Ruby
3
star
78

Hack4Climate

Hack4Climate at the MIT Media Lab
3
star
79

LegalHackers

LegalHackers.org related research and development activities at law.MIT.edu, the Media Lab and MIT
3
star
80

unhangout-video-server

RETIRED
SaltStack
3
star
81

dcpctrl_v1

Code developed 2015-2016 to control the second iteration of the Digital Construction Platform.
MATLAB
3
star
82

promise-tracker-mobile

Mobile data collection client for civic monitoring campaigns
JavaScript
3
star
83

nytcorpus-ruby

A ruby parser for the New York Times Corpus
Ruby
3
star
84

opera-timeline

Interactive Timeline of Projects by the Opera of the Future
JavaScript
3
star
85

fbserver

FB Server
Ruby
3
star
86

physioHMD

The PhysioHMD platform introduces a software and hardware modular interface built for collecting affect and physiological data from users wearing a head-mounted display. The platform enables researchers and developers to aggregate and interpret signals in real-time and use them to develop novel, personalized interactions, as well as evaluate virtual experiences. Our design offers seamless integration with standard HMDs, requiring minimal setup effort for developers and those with less experience using game engines. The PhysioHMD platform is a flexible architecture that offers an interface that is not only easy to extend but also complemented by a suite of tools for testing and analysis. We hope that PhysioHMD can become a universal, publicly available testbed for VR and AR researchers.
Python
3
star
87

gee_custom_utilities

A collection of python utility functions for working with Google Earth Engine
Python
2
star
88

AttentionMapDemo

A geographical heatmap of media attention across the globe, from a variety of sources
JavaScript
2
star
89

dhm

Digital Humanitarian Marketplace
PHP
2
star
90

yourAd

ad design and replacement tool to reclaim your browser ads
JavaScript
2
star
91

speech-tapgame-aamas18

This repository contains the source code and associated executables for running the tap game described in "A Social Robot System for Modeling Children's Pronunciation"
Python
2
star
92

Global-Coverage-Study

A small study designed to compare geographic coverage between various types of online news sources
HTML
2
star
93

PopBlocks

JavaScript
2
star
94

subreddit-scripts

A repository for commonly used reddit scripts
Python
2
star
95

DigitalIdentitySessions

July 24 2017 at the MIT Media Lb
HTML
2
star
96

genderinmemoriam

Gender in Memoriam
JavaScript
2
star
97

fluid_statistics

Python Statistics Pipeline
Jupyter Notebook
2
star
98

text_analyses_tools

Matching phrases between source and query text files
Python
2
star
99

HCU400

An Annotated Dataset for Exploring Aural Phenomenology through Causal Uncertainty
2
star
100

omniFORM_2021

C++
2
star