Implementation of Blockchain Based Electronic Health Record System Using Java Eclipse and MongoDB
Implementation of Blockchain Based Electronic Health Record System Using Java Eclipse and MongoDB
[email protected]; [email protected]
Orcid id: 0000-0001-9685-143X Orcid id: 20000-0001-8954-6648
*Corresponding author
Abstract— With the advancement in technologies, and validates each trade. It may be controlled independently,
Healthcare systems are facing different issues and challenges. without the need for a centralized authority. Because of these
Increase in population, increases the health issues. Large advancements, Blockchain has become the backbone of
amount of health data is being generated and to store these cryptocurrencies. Today, the design acts as the public record
data, centralized EHRs (Electronic Health Records) are used, for all bitcoin transactions. The file size of the records of all
due to which the problem of data security and privacy also transactions in the Bitcoin blockchain, has just increased
increases. To overcome this situation, a distributed-ledger from 20 GB to 100 GB [2].
technology (DLT), Blockchain is developed. Its far-reaching
potential has stretched its capabilities beyond the initial goal Blocks are the distributed nodes/miners provided with
and impacted a wide range of fields. Blockchain can innovate the databases, and it contains the information in digital form
community-based healthcare models. It stores the data in [3]. The genesis block is the first block of the Blockchain
distributed database and uses the concept of cryptography for with no preceding block. Blocks are linked together
security. This paper stores the EHRs in Blockchain and for its containing the previous block's hash value into the current
implementation, Java programming language is used. EHRs block. Each block contains the block header and list of
are accessed from MongoDB and stored in the Blockchain. transactions. Hash acts as the unique identifier of a block. It
Proof of Work (PoW) consensus mechanism is applied, to is generated by hashing the block header twice [4], and the
provide security to the health data.
cryptographic hash function adds security to the Blockchain.
Keywords— Blockchain; Electronic Health Records; Hash;
SHA-256 is used for that purpose.
Security; HIPAA; Data Preservation. Blockchain would provide healthcare with a safe and
secure mechanism for more efficient data sharing.
I. INTRODUCTION Blockchain is a comprehensive system for packaging data in
Every developed country spends large amount of their a form that can be trusted since specific users can only
GDP on Healthcare. Healthcare is the area where Blockchain update it. When data is generated, a block of information is
can be very applicable and useful. Data privacy and their formed. This information is broadcasted and validated on a
security is the main problem faced in centralized EHRs. peer-to-peer network. Those having the correct key, can
Patients need not to take their medical histories to the change and access these data. A new data block is validated
hospitals, as it can be achieved through the blockchain. and added to the chain when data is updated. If any
transaction or block in the blockchain is tampered with,
A blockchain is a decentralized and is used as public
permissioned members and validation tools collaborate to
ledger. It also records the transactions and track the assets.
authenticate or reject the new data. This method guarantees
Blockchain provides immutability of the records because of
that the Blockchain stays a secure, safe, and trustworthy
its decentralized features. This decentralized system uses the
source. The Blockchain can maximize actual data for
concept of cryptography for securing the system. It provides
healthcare by giving a new means of sharing, analyzing, and
better control of health records and patient care. It minimizes
validating information.
twice the number of medical practices by doctors and
monitoring the patient’s condition, saving both practitioners Blockchain enables to create the Electronic Health
and patients time and resources. Record (EHR) system for patients [5]. The Patient himself
gives the data authorization according to their needs, so that
The progress of Blockchain has been continuous and
it cannot be accessed through the unauthorized users and the
intriguing. Satoshi Nakamoto developed the notion of a
other parts of the data remains secure.
distributed blockchain in 2008 [1]. His original article used
the phrases "block" and "chain" individually but became Blockchain technology provides an unchangeable and
publicized as a single word, Blockchain, from 2016. He reliable ledger responsible for maintaining immutability and
enhances the architecture with a novel method of adding confidentiality in electronic health record systems. Sensitive
blocks to the chain without the need of trusted third parties. health records are guided through many regional and
The updated trees would have a secure history of data international regulations. The most important among these
transfers. It employs a peer-to-peer network to time stamp
2
Authorized licensed use limited to: Canterbury Christ Church University. Downloaded on January 01,2024 at 12:53:55 UTC from IEEE Xplore. Restrictions apply.
TABLE I. AN EXAMPLE OF EHRS
Admission_type_ Discharge_dispositi Diabetes
Unique_Id Full_Name Gender Age Time_in_Hospital Insulin Readmitted
Id on_id Med
1 ** ** ** ** ** ** ** ** **
2 ** ** ** ** ** ** ** ** **
.. ** ** ** ** ** ** ** ** **
storage[18]. They compared their proposed system with the from a database and stored in blocks and added to the
traditional storage systems. A framework for sharing the Blockchain.
medical records is also designed. Patients were given the
ownership of their data. In Blockchain technology, data are structured inside
blocks and each block stores the transactions records. In the
A secure EHR system is designed using blockchain proposed work, all the EHRs are stored in those blocks.
technology and cryptosystem based on attributes[19]. Whenever a new record is generated, it is stored in a new
Encryptions based on attribute and identity is used for block. That new block is then added with the previously
encrypting health data. Signatures based on identity is also created blocks in the blockchain. Each block contains the
used for implementing digital signatures. Blockchain hash value of previous block and they are connected together
technology is used for maintaining integrity and traceability in a cryptographic chain so that no one can tamper the data.
of patient’s records. MongoDB is a NoSQL database that contains the EHR and
through the use of Java Eclipse it is accessed from there and
III. DATA CONSTRUCTION stored in the blockchain. Each record is accessed one by one
All the electronic health records are stored in and stored in the blocks of distributed ledger technology,
NoSQL(Not only SQL) database, MongoDB, which blockchain as shown in Fig. 3.
considers each EHR as a document with a unique identifier.
The electronic health records (EHRs) used for the simulation
purpose of the developed program contain records of 1000
diabetic patients.
Each entry in the EHR contains the following fields as
shown in Table I.
Unique_Id: Unique Id assigned to each patient.
Full_Name: Patient’s full name.
Gender: Patient’s gender.
Age: Age of the patient.
Admission_type_Id: Patient admission status in hospital.
Discharge_disposition_id: Patient discharge status from
hospital.
Time_in_Hospital: Number of days of patient admitted in
hospital.
Insulin: Insulin level of patient.
DiabetesMed: Diabetes Medication status of patient.
Readmitted: Patient readmission status after discharge.
IV. THE PROPOSED WORK
This research focuses on storing EHRs using blockchain
technology and then enabling secure electronic record
storage of patient data, unlike traditional EHR systems.
EHRs main purpose is to convert Patient’s medical chart into
digital document. This gives the EHR system access to an
integrated blockchain-based solution that is scalable and
secure. Data encrypted using Blockchain cannot be changed
or deleted. This makes the Blockchain extremely effective in
securing the integrity and security of EHRs. Fig. 2. Flowchart of adding electronic health records to the Blockchain
A block is considered as primary component of
Blockchain. A single block can contain several transactions
and other valuable data. In fig. 2, the proposed work's
flowchart describes how the patient records are accessed
3
Authorized licensed use limited to: Canterbury Christ Church University. Downloaded on January 01,2024 at 12:53:55 UTC from IEEE Xplore. Restrictions apply.
Repeat nonce++;
Until !hash(nonce, difficulty) equals getDifficulty()
5. End
4
Authorized licensed use limited to: Canterbury Christ Church University. Downloaded on January 01,2024 at 12:53:55 UTC from IEEE Xplore. Restrictions apply.
accessed from MongoDB one by one and added to the blocks B. Experiment 2
of Blockchain. In this section, we have performed experiments to
݄݈݊݅ܽܿ݇ܿܤൌ ሺܮܦǡ ܲܥǡ ܵሻሺʹሻ measure the time required to store electronic health records
in the blockchain. In this experiment, we have measured the
Whereǡ ܮܦൌ ݎ݁݃݀݁ܮ݀݁ݐݑܾ݅ݎݐݏ݅ܦǡ ܲܥൌ ݏݑݏ݊݁ݏ݊ܥ time required to add five set of 200 records.
݈ܲܿݐݎǡ ܵ ൌ ܵ݁ܿݕݐ݅ݎݑ This experiment is conducted under different measures
Equation (2) shows the associated parameter for the and the time is calculated to add these records in the blocks
Blockchain creations. Algorithm 1-4, indicates the modules are divided into five rounds of records i.e., 0-200, 201-400,
used in the implementation of electronic health record based 401-600, 601-800 and 801-1000 as shown in Fig. 6.
Blockchain.
140
V. PERFORMANCE ANALYSIS 120
120 107 107 110
600 539
Execution Time (seconds)
500
428
400
321
300
227
Fig. 4. Record of a Patient in MongoDB 200
120
100
0
1-200 1-400 1-600 1-800 1-1000
Number of Patient Records
5
Authorized licensed use limited to: Canterbury Christ Church University. Downloaded on January 01,2024 at 12:53:55 UTC from IEEE Xplore. Restrictions apply.
VI. CONCLUSION [7] S. Tanwar, K. Parekh, and R. Evans, "Blockchain-based electronic
healthcare record system for healthcare 4.0 applications," Journal of
Blockchain technology has the ability to revolutionize Information Security and Applications, vol. 50, p. 102407, 2020.
industries. It has the capability of making current systems [8] L. Chen, W.-K. Lee, C.-C. Chang, K.-K. R. Choo, and N. Zhang,
impregnable and very secure. The healthcare industry is one "Blockchain based searchable encryption for electronic health record
of the areas where data is rapidly rising, necessitating the use sharing," Future generation computer systems, vol. 95, pp. 420-429,
2019.
of technologies like Blockchain to securely store information [9] H. Li, L. Zhu, M. Shen, F. Gao, X. Tao, and S. Liu, "Blockchain-
and allow for analysis and efficient monitoring of records in based data preservation system for medical data," Journal of medical
order to enhance healthcare data management. The systems, vol. 42, no. 8, pp. 1-13, 2018.
healthcare industry needs to prioritize blockchain technology [10] K. Fan, S. Wang, Y. Ren, H. Li, and Y. Yang, "Medblock: Efficient
in order to achieve significant technological advancements. and secure medical data sharing via blockchain," Journal of medical
systems, vol. 42, no. 8, pp. 1-11, 2018.
The proposed work is an implementation of Blockchain [11] S. Jiang, J. Cao, H. Wu, Y. Yang, M. Ma, and J. He, ‘‘BlocHIE: A
using Java, and EHRs from MongoDB are stored in blockchain-based platform for healthcare information exchange,’’ in
Blockchain. MongoDB environment provides server so that Proc. IEEE Int. Conf. Smart Comput. (SMARTCOMP), Taormina,
large number of databases can be created. In the proposed Italy, Jun. 2018, pp. 49–56.
work, EHR is stored in mongoDB and each record i.e., called [12] R. M. A. Latif, K. Hussain, N. Jhanjhi, A. Nayyar, and O. Rizwan, "A
remix IDE: smart contract-based framework for the healthcare sector
document is accessed from there. A connectivity is created by using Blockchain technology," Multimedia Tools and
between java eclipse and mongoDB to access the records of Applications, pp. 1-24, 2020.
diabetic patients from the database. Further those records are [13] M. U. CHELLADURAI, S. Pandian, and K. Ramasamy, "A
stored in the blockchain after creating the blocks. Proof of blockchain based patient centric electronic health record storage and
Work (PoW) consensus mechanism is used for the security integrity management for e-Health systems," Health Policy and
and integrity of patient records. The given experiments and Technology, vol. 10, no. 4, p. 100513, 2021.
[14] M. Chen et al., "Blockchain-Enabled healthcare system for detection
table help to determine that using java and mongoDB of diabetes," Journal of Information Security and Applications, vol.
enhances the performance, security and scalability of the 58, p. 102771, 2021.
blockchain network. [15] G. G. Dagher, J. Mohler, M. Milojkovic, and P. B. Marella, "Ancile:
Privacy-preserving framework for access control and interoperability
REFERENCES of electronic health records using blockchain technology," Sustainable
cities and society, vol. 39, pp. 283-297, 2018.
[1] S. Nakamoto, "Bitcoin: A peer-to-peer electronic cash system,"
[16] A. Islam and S. Y. Shin, "A blockchain-based secure healthcare
Decentralized Business Review, p. 21260, 2008.
scheme with the assistance of unmanned aerial vehicle in Internet of
[2] S. Namasudra, G. C. Deka, P. Johri, M. Hosseinpour, and A. H.
Things," Computers & Electrical Engineering, vol. 84, p. 106627,
Gandomi, "The revolution of blockchain: State-of-the-art and research
2020.
challenges," Archives of Computational Methods in Engineering, vol.
[17] T. Zhou, X. Li, and H. Zhao, "Med-PPPHIS: blockchain-based
28, no. 3, pp. 1497-1515, 2021.
personal healthcare information system for national physique
[3] S. K. Singh and S. Kumar, "Blockchain technology: introduction,
monitoring and scientific exercise guiding," Journal of medical
integration and security issues with IoT," arXiv preprint
systems, vol. 43, no. 9, pp. 1-23, 2019.
arXiv:2101.10921, 2021.
[18] Y. Chen, S. Ding, Z. Xu, H. Zheng, and S. Yang, "Blockchain-based
[4] L. Ismail, H. Materwala, and S. Zeadally, "Lightweight blockchain
medical records secure storage and medical service framework,"
for healthcare," IEEE Access, vol. 7, pp. 149935-149951, 2019.
Journal of medical systems, vol. 43, no. 1, p. 5, 2019.
[5] J. M. Roman-Belmonte, H. De la Corte-Rodriguez, and E. C.
[19] H. Wang and Y. Song, "Secure cloud-based EHR system using
Rodriguez-Merchan, "How blockchain technology can change
attribute-based cryptosystem and blockchain," Journal of medical
medicine," Postgraduate medicine, vol. 130, no. 4, pp. 420-427, 2018.
systems, vol. 42, no. 8, pp. 1-9, 2018.
[6] M. Shuaib, S. Alam, M. S. Alam, and M. S. Nasir, "Compliance with
[20] A. Shahnaz, U. Qamar, and A. Khalid, "Using blockchain for
HIPAA and GDPR in blockchain-based electronic health record,"
electronic health records," IEEE Access, vol. 7, pp. 147782-147795,
Materials Today: Proceedings, 2021.
2019.
6
Authorized licensed use limited to: Canterbury Christ Church University. Downloaded on January 01,2024 at 12:53:55 UTC from IEEE Xplore. Restrictions apply.