Skip to main content

Al-Enhanced Privacy-Preserving EMR Search using Natural Language Query Translation and Intelligent R

Page 1


International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 02 | Feb 2026 www.irjet.net p-ISSN: 2395-0072

Al-Enhanced Privacy-Preserving EMR Search using Natural Language Query Translation and Intelligent Revocation

1234Department of Information Technology, TKR College of Engineering and Technology, Telangana, India

Abstract - Therapiddigitizationofhealthcare hasledtoa significant increase in Electronic Medical Records (EMRs), which contain highly sensitive patient information such as diagnoses, prescriptions, lab reports, and treatment history. While digital storage improves accessibility and clinical efficiency,itintroducesmajorprivacyandsecuritychallenges, especiallywhensearchingmedicalrecordsstoredinencrypted form. Traditional EMR systems either store records in plaintext or require full decryption during search, which increases the risk of data exposure. Moreover, conventional keyword-based retrieval lacks semantic understanding, resulting in low accuracy and poor relevance. ThispaperproposesanAI-enhancedprivacy-preservingEMR search system that enables secure and intelligent retrieval of encrypted medical data. The system integrates Fernet AES encryptionforEMRconfidentiality,SHA-256hashedkeyword indexing for secure keyword lookup, and Sentence Transformerembeddingsforsemanticsearch.Ahybridquery enginecombineshashedkeywordmatchingwithembeddingbased similarity ranking to improve retrieval accuracy. The framework also enforces strong security through Role-Based AccessControl(RBAC),patient-IDrestrictedaccess,OTP-based authentication, and dynamic access revocation through key invalidation. A Stream lit-based dashboard provides rolespecific interfaces for Admin, Doctor, Nurse, and Patient. Experimental results show that the proposed approach supports natural-language EMR search while preserving confidentiality,preventingunauthorizedaccess,andensuring clinically relevant results. The system demonstrates that secure searchable EMR platforms can achieve both high privacy and high usability for modern healthcare environments.

Key words : Electronic Medical Records, PrivacyPreserving Search, Searchable Encryption, Semantic Search, NLP, Sentence Transformers, RBAC, Fernet AES, SHA-256, Access Revocation.

1. INTRODUCTION

Therapidgrowthofdigitalhealthcarehassignificantly increased the adoption of Electronic Medical Records (EMRs) across hospitals, clinics, and diagnostic centres EMRscontainhighlysensitivepatientdatasuchasmedical history, diagnoses, prescriptions, laboratory reports, and treatment plans. While digitization improves clinical efficiency and accessibility, it also introduces major challengesrelatedtodataprivacy,security,andcontrolled

access. Healthcare data breaches have become a serious concern due to unauthorized access, insider misuse, and weak access revocation mechanisms in conventional EMR systems.

1.1 Need for Secure EMR Storage

Traditional EMR platforms often rely on centralized databasestoragewithbasicencryptionandauthentication. However,thesesystemsarevulnerablebecauseencrypted records are usually decrypted during retrieval and search operations, which increases exposure risks. Searchable encryptionhasbeen proposedasan effectiveapproachto allowretrievalwithoutrevealingplaintextmedicalcontent [1]. Therefore, strong cryptographic mechanisms are requiredtoensureconfidentialityandtamperresistance.

1.2 Challenges in Searching Encrypted Medical Records

Performing search operations over encrypted EMRs is technicallydifficultbecauseencryptionhidesthesemantic meaning and structure of the stored data. Most existing systems require decryption before performing keyword search, which defeats the purpose of encryption. Privacypreservingsearchtechniquesattempttosolvethisissueby allowing search functionality while maintaining confidentiality [1]. However, keyword-only search still produces low accuracy and high false positives in clinical settings.

1.3 Role of NLP and Semantic Search

Natural Language Processing (NLP) has become a powerful tool for enabling intelligent retrieval of medical documents.Semanticsearchtechniquesallowthesystemto understand query intent and retrieve clinically relevant recordsevenwhentheexactkeywordisnotpresent.Studies have shown that semantic retrieval using NLP-based embeddings significantly improves EMR search relevance [2]. Sentence Transformer models are widely used for generating semantic embeddings for text-based similarity matching[5].

1.4 Importance of Fine-Grained Access Control

In healthcare, not all users should access all records. Role-Based Access Control (RBAC) is a widely accepted

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 02 | Feb 2026 www.irjet.net p-ISSN: 2395-0072

modelforenforcingfine-grainedpermissionsbasedonuser rolessuchasdoctor,nurse,andpatient[3].However,many systems fail to implement effective revocation, meaning users may retain access even after their role changes. Dynamic revocation is essential to prevent unauthorized decryptionafterprivilegeremoval.

1.5 Motivation and Contribution of This Work

Toaddresstheselimitations,thisprojectproposesanAIEnhanced Privacy-Preserving EMR Search System that integratesencryption,privacy-preservingindexing,semantic retrieval,anddynamicaccesscontrol.Thekeycontributions oftheproposedsysteminclude:SecuringEMRsusingFernet AESencryption[4]Supportingprivacy-preservingkeyword searchthroughSHA-256hashedindexingEnablingsemantic EMRretrievalusingSentenceTransformerembeddings[5] Implementing hybrid query processing (keyword + semantic)forhigheraccuracyEnforcingRBAC-basedaccess control with dynamic revocation [3] Ensuring patient-ID restrictedrecordaccessandOTP-basedauthentication

2. PROPOSED SYSTEM

TheproposedsystemisasecureandintelligentElectronic Medical Records (EMR) search platform that enables privacy-preserving storage and retrieval of sensitive healthcare data. The system combines encryption, hashed keywordindexing,semanticsearch,hybridqueryprocessing, androle-basedaccesscontroltoensurethatEMRsremain confidential while still allowing efficient and meaningful search. The framework is designed to support natural languagequeriesandenforcestrict authorizationpolicies, makingitsuitableformodernhealthcareenvironments.

2.1 EMR Encryption and Secure Storage

AllEMRrecordsareencryptedbeforestorageusingFernet AESencryptiontoensureconfidentialityandintegrity.This preventsunauthorizedusersfromviewingplaintextmedical dataevenifthedatabaseiscompromised.EncryptedEMRs arestoredasciphertext,ensuringsecurelong-termstorage.

2.2 SHA-256 Hashed Keyword Indexing

To enable privacy-preserving keyword search, the system extracts important medical terms from each EMR and convertsthemintoSHA-256hashvalues.Thesehashesare storedinanindextable.Duringsearch,thequerykeywords are also hashed and matched against the stored hashes, allowingsecurekeywordlookupwithoutrevealingplaintext terms.

2.3 Semantic Search Using Sentence Transformer Embeddings

Toimprove retrieval accuracybeyond keyword matching, the system uses Sentence Transformer embeddings to represent EMRs and queries as semantic vectors. This enables context-aware search, allowing the system to retrieverelevantrecordsevenwhendifferenttermsareused (e.g.,“tension”matching“hypertension”).Semanticsimilarity scoringisusedtorankEMRsbasedonmeaning.

2.4 Hybrid Search and Dynamic Access Control

Thesystemusesahybridsearchmechanismthatcombines hashedkeywordmatchingandsemanticrankingtogenerate accurateandclinicallyrelevantresults.Role-BasedAccess Control(RBAC)ensuresthatuserscanonlyaccessrecords permitted by their role. Dynamic access revocation is implemented through key invalidation and permission updates,ensuringimmediateremovalofdecryptionaccess when roles change. Patient-ID restrictions and OTP-based authenticationfurtherstrengthensecurity.

3. IMPLEMENTATION DETAILS

Theproposedsystemisimplementedasamodularprivacypreserving EMR search platform that integrates cryptography, semantic NLP, hybrid retrieval, and secure access control. The implementation is designed to ensure that EMRs remain encrypted during storage and retrieval whilestillsupportingaccuratenaturallanguagesearch.The systemfollowsalayeredapproachconsistingofencryption, indexing, semantic embedding generation, hybrid search processing,androle-basedaccessenforcement

3.1 Data Encryption and Secure Storage Module

Inthismodule,everyEMRisencryptedbeforebeingstored in the database. Fernet AES encryption is used to provide bothconfidentialityandintegrity.AuniqueDataEncryption Key(DEK)isgeneratedforEMRencryption,ensuringthat records remain protected even if the storage server is compromised.TheencryptedEMRsarestoredinSQLiteas ciphertextblobs.Thismoduleguaranteesthatnoplaintext medicalinformationisstoreddirectlyinthedatabase.

3.2 Hashed Keyword Indexing Module

Tosupportprivacy-preservingkeywordsearch,thesystem extracts important keywords from each EMR (such as diseases,symptoms,medications,andlabtestnames).Each extractedkeywordisconvertedintoanirreversibleSHA-256 hash.Thesehashedvaluesarestoredinaseparatekeywordindex table linked to the EMR record ID. During search, query keywords are hashed using the same SHA-256 algorithm and compared with the stored hashes. This

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 02 | Feb 2026 www.irjet.net p-ISSN: 2395-0072

enables keyword-based retrieval without exposing any plaintextmedicalterms.

3.3 Semantic Embedding Generation Module

Toenablecontext-awaresearch,semanticembeddingsare generated for each EMR using a Sentence Transformer model.Theembeddingrepresentstheoverallmeaningofthe EMRcontentinanumericalvectorformat.Similarly,whena userentersanaturallanguagequery,thequeryisconverted intoanembeddingvector.Semanticsimilaritymeasuresare then used to identify EMRs that match the intent of the query,evenwhenexactkeywordsdonotmatch.Thismodule significantlyimprovesretrievalaccuracyforclinicalqueries.

3.4 Hybrid Search, RBAC, and Access Revocation Module

This module performs the main retrieval and security enforcementtasks.Thefinalresultsaremergedandranked to produce accurate and clinically relevant EMR retrieval. Role-Based Access Control (RBAC) is enforced to restrict EMR access based on user roles such as Admin, Doctor, Nurse,andPatient.Patient-IDrestrictedaccessensuresthat patientscan onlyviewtheir own records. Dynamic access revocationisimplementedbyinvalidatingencryptionkeys or removing wrapped DEKs when user permissions are revoked,ensuringimmediatelossofdecryptioncapability. OTP-based authentication strengthens login security, and audit logs store all search and access activities for accountability.

3.5 System Architecture

Fig. 1: Architecture of Encrypted EMR Storage and Hybrid Search Framework

Fig.1illustratestheoverallarchitectureoftheproposedAIenhanced privacy-preserving EMR search system. The architectureisdividedintothreemajorlayers:ClientLayer, Web Application Layer, and Backend Layer. The client

accesses the system through a secure HTTPS connection usingabrowser-basedStreamlitinterface. TheWebApplayercontainstheStream litUI,whereusers suchasAdmin,Doctor,Nurse,andPatientinteractwiththe system. User queries are submitted through the interface andforwardedtotheNLPQueryTranslator,whichconverts natural language queries into both keyword tokens and semantic representations. The WebApp also includes an AuthenticationandSessionManager,responsibleforsecure loginandsessionhandling.

The Backend layer performs all privacy-preserving operations. The Embedding Generator produces Sentence TransformerembeddingsforEMRsanduserqueries,which are stored and searched using a FAISS Vector Index. In parallel, the system maintains a Hashed Keyword Index usingSHA-256tosupportsecurekeywordlookupwithout revealingplaintextmedicalterms.TheHybridSearchEngine combinesresultsfrombothsemanticsimilaritysearchand hashed keyword matching to generate accurate ranked outputs.

For confidentiality, EMR records are encrypted using the FernetEncryptionService,andencryptedrecordsarestored inanSQLitedatabase.TheKeyManagerhandlesencryption key generation, storage, and key invalidation for dynamic accessrevocation.Accesspermissionsareenforcedbythe RBACManager,ensuringonlyauthorizeduserscandecrypt and view EMRs. Additionally, the OTP Service provides strongauthentication,andanAuditLoggerrecordsallsearch andaccessactivitiesforaccountabilityandcompliance.

4. RESULTS AND PERFORMANCE ANALYSIS

TheproposedAI-enhancedprivacy-preservingEMRsearch system was successfully implemented and evaluated to verifyitssecurity,usability,andretrievaleffectiveness.The evaluationfocusedonencryptedEMRstorage,hybridsearch accuracy, semantic relevance, and access control enforcement. The system was tested using sample EMR datasetscontainingpatienthistory,diagnoses,prescriptions, lab values, and clinical notes. The results confirm that the proposedsystemprovidesmeaningfulsearchperformance whileensuringstrictprivacypreservation.

4.1 Secure Storage and Encryption Validation

The first performance outcome verified that all EMRs are securely stored in encrypted form using Fernet AES encryption. No plaintext EMR content was stored in the SQLitedatabase.Evenwhendatabaseentrieswereinspected directly,onlyciphertextwasvisible.Thisconfirmsthatthe proposedsystemensuresconfidentialityatrestandprevents directexposureofsensitivemedicalinformation.

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 02 | Feb 2026 www.irjet.net p-ISSN: 2395-0072

4.2 Keyword Indexing and Privacy-Preserving Search Results

TheSHA-256hashedkeywordindexingmechanism successfully supported secure keyword search without storingplaintextmedicalterms.Whenuserssearchedusing medical keywords such as “diabetes,” “creatinine,” or “hypertension,” the system generated query hashes and matched them against stored hashed indexes. The results showedcorrectrecordretrievalwhilemaintainingprivacy. Since hashing is irreversible, the keyword index did not revealsensitivetermstounauthorizedobservers.

4.3 Semantic Search Accuracy and Query Understanding

The semantic retrieval module demonstrated strong performance in interpreting clinical queries. Sentence Transformer embeddings enabled the system to retrieve relevantEMRsevenwhenusersenteredindirectoralternate terms. For example, searching for “tension” successfully retrievedEMRscontaining“hypertension,”andsearchingfor “sugar”returneddiabetes-relatedrecords.Thisshowsthat semanticembeddingsimprovesearchrelevanceandreduce dependenceonexactkeywordmatching.

4.4 Hybrid Search Performance and Relevance Ranking

The hybrid search engine combined hashed keyword matchingandsemanticsimilarityscoringtogenerateranked results.Comparedtokeyword-onlysearch,hybridretrieval reducedfalsepositivesandimprovedclinicalrelevance.The systemreturnedaccurateresultsforcomplexqueriessuchas “patients with diabetes and abnormal creatinine,” by matching both structured medical terms and semantic meaning. The hybrid method produced more meaningful retrievaloutcomesthanusingeitherkeywordorsemantic searchalone.

4.5 Access Control Enforcement and Revocation Testing

Role-BasedAccessControl(RBAC)wastestedacrossAdmin, Doctor, Nurse, and Patient roles. Unauthorized access attempts were successfully blocked. Patient-ID restricted access ensured that patients could only view their own records. Dynamic access revocation was validated by removinguserprivilegesandinvalidatingkeys,afterwhich previouslyauthorizeduserscouldnolongerdecryptEMRs. Thisconfirmsthattheproposedsystemsupportsreal-time accessrevocationandpreventsprivilegemisuse.

4.6 System Usability and Interface Validation

TheStreamlitdashboardprovidedauser-friendlyinterface for all roles. Doctors were able to upload EMRs securely,

nursescouldupdatevitals,andpatientscouldviewonlytheir authorized records. OTP-based authentication improved loginsecurityandensuredstrongidentityverification.Audit logging successfully captured search and access events, supportingaccountabilityandcompliancerequirements.

5. CONCLUSION

ThisprojectsuccessfullypresentsanAI-enhancedprivacypreservingElectronicMedicalRecords(EMR)searchsystem thatensuressecurestorage,controlledaccess,andintelligent retrievalofsensitivehealthcaredata.UnliketraditionalEMR platforms,theproposedsystemenablesencryptedEMRsto be stored and searched without exposing plaintext informationduringindexingorretrieval.

The system integrates Fernet AES encryption for confidentiality, SHA-256 hashed keyword indexing for privacy-preserving keyword search, and Sentence Transformer embeddings for semantic understanding of natural language queries. A hybrid search mechanism combining keyword matching and semantic similarity ranking improves retrieval accuracy and reduces false positives, making the system suitable for clinical environments.

Inaddition,theimplementationofRole-BasedAccessControl (RBAC), patient-ID restricted access, OTP-based authentication,auditlogging,anddynamicaccessrevocation ensuresthatonlyauthorizeduserscandecryptandaccess medical records, even after role changes. Overall, the proposed framework demonstrates that strong privacy protection and meaningful EMR usability can be achieved simultaneously,offeringasecureandscalablefoundationfor modernhealthcaredatamanagementsystems.

6. FUTURE WORK

In future, the proposed system can be enhanced by integrating advanced clinical transformer models and domain-specificNLPtechniquestoimprovemedicalcontext understanding and reduce retrieval errors.Explainable AI (XAI)featurescanalsobeaddedtojustifywhyspecificEMRs are retrieved, improving transparency and trust for clinicians. Deploying the system on cloud infrastructure would improve scalability for large hospitals and highvolume datasets, while enabling multi-branch access with better performance. Additionally, stronger privacypreserving computation methods such as homomorphic encryption or secure multiparty computation can be exploredtofurtherprotectdataduringqueryprocessing.A userfeedbackmechanismcanbeintroducedtoallowdoctors andnursestorateresults,enablingcontinuousimprovement inretrievalaccuracy.Finally,voice-basedorchatbot-driven EMRsearchcanbeimplementedtosupportreal-timeclinical workflowsandincreasesystemusability.

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 02 | Feb 2026 www.irjet.net p-ISSN: 2395-0072

ACKNOWLEDGEMENT

There are many individuals who contributed directly or indirectlytothesuccessfulcompletionofthisproject,andwe takethisopportunitytoexpressoursinceregratitudetoall ofthem.

Weareextremelythankfulandindebtedtooursupervisor, Mrs. B. Rajani, Assistant Professor, Department of Information Technology, TKR College of Engineering and Technology,forherconstantguidance,encouragement,and moralsupportthroughouttheproject.

WealsoextendoursincerethankstoDr.N.Satyanarayana, Head of the Department (I/c), Department of Information Technology,TKRCollegeofEngineeringandTechnology,for his continuous encouragement and support during the courseofthiswork.

OurheartfeltgratitudeisextendedtoDr.D.V.RaviShankar, Principal,TKRCollegeofEngineeringandTechnology,forhis timely support and valuable suggestions throughout the projectperiod.

Finally,wewouldliketothankallthefacultyandstaffofthe Department of Information Technology, as well as our parentsandfriends,fortheircooperation,encouragement, andsupportinsuccessfullycompletingthisproject.

REFERENCES

[1]Y.Li,H.Zhu,andM.Yu,“Privacy-PreservingSearchable Encryption for Healthcare Data,” IEEE Transactions on InformationForensicsandSecurity,2020.

[2]R.JohnsonandA.Patel,“SemanticRetrievalofElectronic Health Records Using NLP Techniques,” Journal of BiomedicalInformatics,2021.

[3]R.SandhuandD.Ferraiolo,“Role-BasedAccessControl Models,”IEEEComputer,vol.33,no.2,pp.38–47,2000.

[4] Cryptography.io Team, “Cryptography Library Documentation(FernetAES),”2024.

[5]SentenceTransformersTeam,“SentenceTransformers Documentation,”2024.

Turn static files into dynamic content formats.

Create a flipbook
Al-Enhanced Privacy-Preserving EMR Search using Natural Language Query Translation and Intelligent R by IRJET Journal - Issuu