Background Electronic medical records (EMRs) are usually stored in relational databases that require SQL queries to retrieve information of interest. Effectively completing such queries can be a challenging task for medical experts due to the barriers in expertise. Existing text-to-SQL generation studies have not been fully embraced in the medical domain. Objective The objective of this study was to propose a neural generation model that can jointly consider the characteristics of medical text and the SQL structure to automatically transform medical texts to SQL queries for EMRs. Methods We proposed a medical text–to-SQL model (MedTS), which employed a pretrained Bidirectional Encoder Representations From Transformers model as the encoder and leveraged a grammar-based long short-term memory network as the decoder to predict the intermediate representation that can easily be transformed into the final SQL query. We adopted the syntax tree as the intermediate representation rather than directly regarding the SQL query as an ordinary word sequence, which is more in line with the tree-structure nature of SQL and can also effectively reduce the search space during generation. Experiments were conducted on the MIMICSQL dataset, and 5 competitor methods were compared. Results Experimental results demonstrated that MedTS achieved the accuracy of 0.784 and 0.899 on the test set in terms of logic form and execution, respectively, which significantly outperformed the existing state-of-the-art methods. Further analyses proved that the performance on each component of the generated SQL was relatively balanced and offered substantial improvements. Conclusions The proposed MedTS was effective and robust for improving the performance of medical text–to-SQL generation, indicating strong potential to be applied in the real medical scenario.
BACKGROUND Electronic medical records (EMRs) are usually stored in relational databases that require structured query language (SQL) queries to retrieve information of interest. Effectively completing such queries is usually a challenging task for medical experts due to the barriers in expertise. However, existing text-to-SQL generation studies have not been fully embraced in the medical domain. OBJECTIVE The objective of this study was to propose a neural generation model, which can jointly consider the characteristics of medical text and the SQL structure, to automatically transform medical texts to SQL queries for EMRs. METHODS In contrast to regarding the SQL query as an ordinary word sequence, the syntax tree, introduced as an intermediate representation, is more in line with the tree-structure nature of SQL and also can effectively reduce the search space during generation. We proposed a medical text-to-SQL model (MedTS), which employed a pre-trained BERT as the encoder and leveraged a grammar-based LSTM as the decoder to predict the tree-structured intermediate representation that can be easily transformed to the final SQL query. Experiments are conducted on the MIMICSQL dataset and five competitor methods are compared. RESULTS Experimental results demonstrated that MedTS achieved the accuracy of 0.770 and 0.888 on the test set in terms of logic form and execution respectively, which significantly outperformed the existing state-of-the-art methods. Further analyses proved that the performance on each component of the generated SQL was relatively balanced and has substantial improvements. CONCLUSIONS The proposed MedTS was effective and robust for improving the performance of medical text-to-SQL generation, indicating strong potentials to be applied in the real medical scenario.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
hi@scite.ai
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.