Skip to main content
QUICK REVIEW

[Paper Review] Text-to-SQL Generation for Question Answering on Electronic Medical Records

Ping Wang, Tian Shi|arXiv (Cornell University)|Jul 28, 2019
Topic ModelingComputer Science49 references8 citations
TL;DR

This paper proposes TREQS, a deep learning model for end-to-end question-to-SQL generation in electronic medical records (EMR), using a sequence-to-sequence framework enhanced with an attentive-copying mechanism and task-specific lookup tables to improve accuracy in handling medical abbreviations, typos, and complex conditions. The key contribution is the creation of MIMICSQL, a large-scale, publicly available Question-SQL dataset derived from the MIMIC-III database, which enables robust training and evaluation, resulting in state-of-the-art performance on condition value prediction and robustness to noisy input.

ABSTRACT

Electronic medical records (EMR) contain comprehensive patient information and are typically stored in a relational database with multiple tables. Effective and efficient patient information retrieval from EMR data is a challenging task for medical experts. Question-to-SQL generation methods tackle this problem by first predicting the SQL query for a given question about a database, and then, executing the query on the database. However, most of the existing approaches have not been adapted to the healthcare domain due to a lack of healthcare Question-to-SQL dataset for learning models specific to this domain. In addition, wide use of the abbreviation of terminologies and possible typos in questions introduce additional challenges for accurately generating the corresponding SQL queries. In this paper, we tackle these challenges by developing a deep learning based TRanslate-Edit Model for Question-to-SQL (TREQS) generation, which adapts the widely used sequence-to-sequence model to directly generate the SQL query for a given question, and further performs the required edits using an attentive-copying mechanism and task-specific look-up tables. Based on the widely used publicly available electronic medical database, we create a new large-scale Question-SQL pair dataset, named MIMICSQL, in order to perform the Question-to-SQL generation task in healthcare domain. An extensive set of experiments are conducted to evaluate the performance of our proposed model on MIMICSQL. Both quantitative and qualitative experimental results indicate the flexibility and efficiency of our proposed method in predicting condition values and its robustness to random questions with abbreviations and typos.

Motivation & Objective

  • To address the challenge of inefficient and inflexible clinical data retrieval in EMRs, which often requires expert knowledge and complex rule-based systems.
  • To overcome the lack of domain-specific datasets for training question-to-SQL models in healthcare, particularly for EMR data.
  • To improve the robustness of natural language to SQL generation in clinical settings, where questions often contain abbreviations, typos, or ambiguous terms.
  • To develop a model that directly generates executable SQL queries from natural language questions without relying on pre-defined templates or complex parsing pipelines.
  • To evaluate the model's performance on condition value prediction and generalization to out-of-vocabulary or noisy inputs in real-world clinical queries.

Proposed method

  • Propose TREQS, a sequence-to-sequence model with an encoder-decoder architecture fine-tuned for medical question-to-SQL generation.
  • Integrate an attentive-copying mechanism that allows the model to directly copy relevant keywords from the input question into the SQL query, improving accuracy for condition values.
  • Use task-specific lookup tables to store and retrieve common medical terms (e.g., disease names, lab values, procedure codes), reducing out-of-vocabulary issues.
  • Apply a recover technique post-generation to correct erroneous condition values by matching predicted values to known entries in the lookup table.
  • Train and evaluate the model on MIMICSQL, a newly constructed, large-scale dataset of human-annotated question-SQL pairs from the MIMIC-III EMR database.
  • Leverage attention visualization to interpret model behavior and validate that the model correctly aligns question keywords with corresponding SQL components.

Experimental results

Research questions

  • RQ1Can a sequence-to-sequence model with attentive copying and lookup tables outperform existing methods in generating accurate SQL queries for clinical questions?
  • RQ2How effective is the proposed TREQS model in handling real-world challenges such as medical abbreviations, typos, and ambiguous terminology in clinical questions?
  • RQ3To what extent does the MIMICSQL dataset improve the generalization and robustness of question-to-SQL models in the healthcare domain?
  • RQ4Does the integration of a recover technique significantly improve the accuracy of condition value prediction in generated SQL queries?
  • RQ5Can the model generate executable and semantically correct SQL queries even when the input question contains missing or incorrect keywords?

Key findings

  • TREQS achieves state-of-the-art performance on the MIMICSQL benchmark, outperforming existing models such as Seq2Seq, Ptr-Net, and Coarse-to-Fine in both exact and partial match metrics.
  • The model demonstrates strong robustness to noisy inputs, correctly generating SQL queries even when questions contain typos or abbreviations, thanks to the attentive-copying and lookup mechanisms.
  • Qualitative analysis shows that TREQS successfully identifies and copies key clinical terms (e.g., 'coronary artery disease', 'ferritin') from questions into the correct SQL conditions.
  • Attention visualization confirms that the model correctly aligns question keywords with corresponding database columns and condition values, enhancing interpretability.
  • The recover technique significantly improves condition value accuracy, especially for baseline models that fail to predict correct column names or values.
  • M-SQLNET and other baseline models often fail to generate correct condition columns, leading to non-executable queries, whereas TREQS generates fully executable and correct queries without relying on recovery in many cases.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.