Skip to content

Fabric is a blockchain project in Incubation proposed to the community and documented at https://goo.gl/RYQZ5N. Information on what Incubation entails can be found in the Hyperledger Project Lifecycle document (https://goo.gl/4edNRc)

Notifications You must be signed in to change notification settings

shgandhi/fabric

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trial Chain

Introduction

This project is a proof-of-concept electronic health record management system.

Getting Started

Gateway

The gateway application is built using clojure and clojurescript with the following libraries, plugins and helpful tools:

leiningenBuild + run managment, package manager, etc.
RingHTTP server
CompojureLighweight routing / app framework on Ring
ReagentClient framework based on React.js
HiccupHtml templating / generation library
SecretaryClient side routing
AccountantConvert links to secretary route invocations
Figwheellive js reloading
specljTDD library for clj and cljs
devcardsInteractive demo and testing tool for cljs
ciderClojure Interactive Development Environment that Rocks for Emacs

Tools

The repository includes a Makefile with the following targets:

chaincode

Builds the chaincode in registry/

client

Builds the cljs client in registry/client, and copies the necessary .proto files from the chaincode

interface

Builds the java interface files used by the gateway

Additionally, there are several helper targets that make it easier to run the chaincode during development:

dev

Start a peer in dev-mode, without security

run

Launch the chaincode binary connected to the local dev peer. The default chaincode name is “registry”

deploy

Deploys the chaincode and returns to the shell

API

Registry Chaincode

message Item {
         string data = 1;
}

message List {
        repeated Item items = 1;
}

message Record {
         string hash = 1;
         string patient = 2;
         List messages = 3;
         List trials = 4;
}

message Pair {
         string key = 1;
         string value = 2;
}

message EmptyParams {
}

Available RPC functions exported by this interface

void AddTrial(Item) -> registry/txn/1 
void RemoveTrial(Item) -> registry/txn/2 

void AddRecord(Record) -> registry/txn/3 

void AuthorizeTrial(Pair) -> registry/txn/4 
void RevokeAuthorization(Pair) -> registry/txn/5 

void SendMessage(Pair) -> registry/txn/6 
void DeleteMessage(Pair) -> registry/txn/7 

List GetTrialList(EmptyParams) -> registry/query/2 

Item GetPatientKey(Item) -> registry/query/1 
List GetMessages(Item) -> registry/query/3 
List GetAuthorizedTrials(Item) -> registry/query/4 

cljs Registry client

There is an example REST client implemented in cljs included in the registry/client directory.

Invoke from registry/client with: $ nodejs out/registry.js -n registry -c <command> -a <args>

Examples:

Add a trial

nodejs out/registry.js -n registry -c add-trial -a '{"data": "TrialHash"}'

Remove a trial

nodejs out/registry.js -n registry -c remove-trial -a '{"data": "TrialHash"}'

Add a record

nodejs out/registry.js -n registry -c add-record -a '{"patient": "Pat", "hash": "RecordHash"}'

Authorize a trial

nodejs out/registry.js -n registry -c authorize-trial -a '{"key": "RecordHash", "value": "TrialHash"}'

Revoke authorization

nodejs out/registry.js -n registry -c revoke-authorization -a '{"key": "RecordHash", "value": "TrialHash"}'

Send message

nodejs out/registry.js -n registry -c send-message -a '{"key": "RecordHash", "value": "Hello!"}'

Delete message

nodejs out/registry.js -n registry -c delete-message -a '{"key": "RecordHash", "value": "Hello!"}'

Get list of trials

nodejs out/registry.js -n registry -c get-trial-list

Get patient key

nodejs out/registry.js -n registry -c get-patient-key -a '{"data": "RecordHash"}'

Get messages

nodejs out/registry.js -n registry -c get-messages -a '{"data": "RecordHash"}'

Get authorized trials

nodejs out/registry.js -n registry -c get-authorized-trials -a '{"data": "RecordHash"}'

Todo

Gateway

General

  • [ ] Make devcards for components
  • [ ] Split common elements into shared
  • [ ] Reduce components to contain minimal markup

Clinic

  • [ ] Integrate registry
  • [ ] IPFS
    • [ ] UI for IPFS add

Patient

  • [ ] Switch from modal view to sidebar
  • [ ] Integrate registry

About

Fabric is a blockchain project in Incubation proposed to the community and documented at https://goo.gl/RYQZ5N. Information on what Incubation entails can be found in the Hyperledger Project Lifecycle document (https://goo.gl/4edNRc)

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 83.4%
  • Go 9.3%
  • CSS 3.9%
  • Makefile 1.9%
  • HTML 1.4%
  • Shell 0.1%