Thursday, 30 August 2018

Sample Immunization Records Blockchain using Hyperledger Composer

This is basic and sample Blockchain implementation of Immunization Records using Hyperledger Composer. 


To start interactive demo with Composer follow these steps:
  • Open https://composer-playground.mybluemix.net/login in web browser
  • Click on "Deploy a new business network" button
  • Under section "2. MODEL NETWORK STARTER TEMPLATE" select option "Drop here to upload or browse"
  • Upload "immunization-network.bna" file from git repository mentioned above.
  • Click on "Test" tab on right panel and start your interactive demo.
  • Follow "readme" page on github or this article for detailed instructions to use demo.


This business network defines:
Participants: Doctor Patient
Assets: Vaccination VaccinationRecord
Transactions: AdministerVaccination RefuseVaccination
The administerVaccination function is called when an AdministerVaccination transaction is submitted. The logic simply checks for required fields and creates new immunization record in VaccinationRecord asset registry with 'COMPLETED' status.
The refuseVaccination function is called when an RefuseVaccination transaction is submitted. The logic simply checks for required fields and creates new immunization record in VaccinationRecord asset registry with 'REFUSED' status.
To test this Business Network Definition in the Test tab:
In the Doctor participant registry, create a new participant.
{
  "$class": "com.j4jayant.immunization.Doctor",
  "degree": "MD",
  "specialty": "pediatric",
  "id": "10001",
  "firstName": "John",
  "lastName": "Smith"
}
In the Patient participant registry, create a new participants.
{
  "$class": "com.j4jayant.immunization.Patient",
  "dateOfBirth": "2010-08-20",
  "sex": "Male",
  "id": "200001",
  "firstName": "Dave",
  "lastName": "Brown"
}
In the Vaccination asset registry, create a new assets for sample vaccinations.

{
  "$class": "com.j4jayant.immunization.Vaccination",
  "id": "CVS_140",
  "name": "Influenza",
  "substanceExpirationDate": "2018-12-31",
  "substanceManufacturer": "CSL Behring"
}
{
  "$class": "com.j4jayant.immunization.Vaccination",
  "id": "CVS_03",
  "name": "MMR",
  "substanceExpirationDate": "2018-12-31",
  "substanceManufacturer": ""
}

{
  "$class": "com.j4jayant.immunization.Vaccination",
  "id": "CVX_10",
  "name": "IPV",
  "substanceExpirationDate": "2018-12-31",
  "substanceManufacturer": ""
}
As soon as a required assets and participants are created, participants can submit AdministerVaccination transactions to create new immunization records with 'COMPLETED' status.
Submit an AdministerVaccination transaction, by submitting a transaction and selecting AdministerVaccination from the dropdown.
{
  {
  "$class": "com.j4jayant.immunization.AdministerVaccination",
  "administrationDate": "2018-08-30",
  "administeredAmount": "0.5",
  "administeredUnit": "mL",
  "administrationRoute": "Intramuscular",
  "administrationSite": "Left Arm",
  "administrationNotes": "New Immunization Record",
  "vaccination": "resource:com.j4jayant.immunization.Vaccination#CVS_140",
  "doctor": "resource:com.j4jayant.immunization.Doctor#100001",
  "patient": "resource:com.j4jayant.immunization.Patient#200001"
}
}
To create a refusal record submit a RefuseVaccination transaction.
{
  "$class": "com.j4jayant.immunization.RefuseVaccination",
  "refusalReason": "Parental Refusal",
  "vaccination": "resource:com.j4jayant.immunization.Vaccination#CVX_10",
  "doctor": "resource:com.j4jayant.immunization.Doctor#100001",
  "patient": "resource:com.j4jayant.immunization.Patient#200001"
}
Congratulations, you just created a sample Immunization Records Blockchain!

Sample Immunization Records Blockchain using Hyperledger Composer

This is basic and sample Blockchain implementation of Immunization Records using Hyperledger Composer.  Source Code available at:  https...