id
int64 0
1.41k
| query
stringlengths 5.75k
5.86k
| answer
stringlengths 65
557
|
---|---|---|
0 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 24517?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 24517 |
1 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: tell me the sex of patient 26549.
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 26549 |
2 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: what are patient 59916's genders?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 59916 |
3 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: does patient 5905 have a male or female gender?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 5905 |
4 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 1862?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 1862 |
5 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 53176?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 53176 |
6 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: what are patient 12775's genders?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 12775 |
7 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: what are patient 655's genders?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 655 |
8 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 43779?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 43779 |
9 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: does patient 45612 have a male or female gender?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 45612 |
10 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: tell me the sex of patient 55027.
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 55027 |
11 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 14749?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 14749 |
12 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: tell me the sex of patient 3712.
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 3712 |
13 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: tell me the sex of patient 43052.
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 43052 |
14 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: does patient 23930 have a male or female gender?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 23930 |
15 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: does patient 87733 have a male or female gender?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 87733 |
16 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: tell me the sex of patient 57899.
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 57899 |
17 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: what are patient 61751's genders?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 61751 |
18 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: does patient 23475 have a male or female gender?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 23475 |
19 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: what are patient 25869's genders?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 25869 |
20 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 15760?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 15760 |
21 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 22315?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 22315 |
22 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: tell me the sex of patient 5310.
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 5310 |
23 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 97734?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 97734 |
24 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 68641?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 68641 |
25 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: tell me the sex of patient 14467.
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 14467 |
26 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: whats the sex of patient 25869?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 25869 |
27 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: does patient 15760 have a male or female gender?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 15760 |
28 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: does patient 12917 have a male or female gender?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 12917 |
29 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: what are patient 26793's genders?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 26793 |
30 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: what are patient 70709's genders?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 70709 |
31 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: tell me the sex of patient 49140.
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 49140 |
32 | Given an input question, first create a syntactically correct sqlite query that directly answers the question, ensuring any necessary calculations are included in the SQL syntax. If the question is about whether a patient has ever done something (e.g., "Has the patient ever…"), use SELECT COUNT(*) > 0 to return a Boolean-like result. Then review the query output to determine the answer. Order the results by a relevant column if it helps provide the most informative data.
Instructions:
1. Time-Related Calculations: For questions that require time-based calculations, perform these directly within the SQL query. Please focus on day instead of hours.
2. Boolean Check for Existence: For questions asking if a patient has ever done or had something, use SELECT COUNT()>0 to determine existence as a Boolean outcome.
3. Schema Adherence: Use only the column names visible in the provided schema, qualifying columns with their table name if needed to avoid ambiguity.
4. Use start time instead of end time to sort time if the question is related to first or last time.
5. If the question is about one admission, please make sure the results is related is related to an actual admission id that is not null.
6. Please distinguish admission location and admission type and choose the correct columns based on the content and question.
7. Only output the sql query, remove other words.
8. Please carefully review the detail of each table and give the correct SQL that answers the questions.
# For the current question, only use tables listed below.
# {
'PATIENTS': ['ROW_ID', 'SUBJECT_ID', 'GENDER', 'DOB', 'DOD', 'DOD_HOSP', 'DOD_SSN',
'EXPIRE_FLAG'],
'ADMISSIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ADMITTIME', 'DISCHTIME',
'DEATHTIME', 'ADMISSION_TYPE', 'ADMISSION_LOCATION',
'DISCHARGE_LOCATION', 'INSURANCE', 'LANGUAGE', 'RELIGION',
'MARITAL_STATUS', 'ETHNICITY', 'EDREGTIME', 'EDOUTTIME', 'DIAGNOSIS',
'HOSPITAL_EXPIRE_FLAG', 'HAS_CHARTEVENTS_DATA'],
'ICUSTAYS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'FIRST_CAREUNIT', 'LAST_CAREUNIT', 'FIRST_WARDID', 'LAST_WARDID',
'INTIME', 'OUTTIME', 'LOS'],
'CHARTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUENUM', 'VALUEUOM', 'WARNING',
'ERROR', 'RESULTSTATUS', 'STOPPED'],
'LABEVENTS':['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ITEMID', 'CHARTTIME', 'VALUE',
'VALUENUM', 'VALUEUOM', 'FLAG'],
'PRESCRIPTIONS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTDATE', 'ENDDATE',
'DRUG_TYPE', 'DRUG', 'DRUG_NAME_POE', 'DRUG_NAME_GENERIC',
'FORMULARY_DRUG_CD', 'GSN', 'NDC', 'PROD_STRENGTH', 'DOSE_VAL_RX',
'DOSE_UNIT_RX', 'FORM_VAL_DISP', 'FORM_UNIT_DISP', 'ROUTE'],
'CALLOUT': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SUBMIT_WARDID', 'SUBMIT_CAREUNIT',
'CURR_WARDID', 'CURR_CAREUNIT', 'CALLOUT_WARDID', 'CALLOUT_SERVICE',
'REQUEST_TELE', 'REQUEST_RESP', 'REQUEST_CDIFF', 'REQUEST_MRSA',
'REQUEST_VRE', 'CALLOUT_STATUS', 'CALLOUT_OUTCOME', 'DISCHARGE_WARDID',
'ACKNOWLEDGE_STATUS', 'CREATETIME', 'UPDATETIME', 'ACKNOWLEDGETIME',
'OUTCOMETIME', 'FIRSTRESERVATIONTIME', 'CURRENTRESERVATIONTIME'],
'CAREGIVER': ['ROW_ID', 'CGID', 'LABEL', 'DESCRIPTION'],
'D_CPT': ['ROW_ID', 'CATEGORY', 'SECTIONRANGE', 'SECTIONHEADER',
'SUBSECTIONRANGE', 'SUBSECTIONHEADER', 'CODESUFFIX',
'MINCODEINSUBSECTION', 'MAXCODEINSUBSECTION'],
'D_ITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'ABBREVIATION', 'DBSOURCE', 'LINKSTO',
'CATEGORY', 'UNITNAME', 'PARAM_TYPE', 'CONCEPTID'],
'D_LABITEMS': ['ROW_ID', 'ITEMID', 'LABEL', 'FLUID', 'CATEGORY', 'LOINC_CODE'],
'DATETIMEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'ITEMID', 'CHARTTIME',
'STORETIME', 'CGID', 'VALUE', 'VALUEUOM', 'WARNING', 'ERROR',
'RESULTSTATUS', 'STOPPED'],
'DRGCODES': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'DRG_TYPE', 'DRG_CODE',
'DESCRIPTION', 'DRG_SEVERITY', 'DRG_MORTALITY'],
'MICROBIOLOGYEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'SPEC_ITEMID', 'SPEC_TYPE_DESC', 'ORG_ITEMID', 'ORG_NAME',
'ISOLATE_NUM', 'AB_ITEMID', 'AB_NAME', 'DILUTION_TEXT',
'DILUTION_COMPARISON', 'DILUTION_VALUE', 'INTERPRETATION'],
'NOTEEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'CHARTDATE', 'CHARTTIME',
'STORETIME', 'CATEGORY', 'DESCRIPTION', 'CGID', 'ISERROR', 'TEXT'],
'OUTPUTEVENTS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'CHARTTIME', 'ITEMID',
'VALUE', 'VALUEUOM', 'STORETIME', 'CGID', 'STOPPED', 'NEWBOTTLE',
'ISERROR'],
'PROCEDUREEVENTS_MV': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'STARTTIME', 'ENDTIME',
'ITEMID', 'VALUE', 'VALUEUOM', 'LOCATION', 'LOCATIONCATEGORY',
'STORETIME', 'CGID', 'ORDERID', 'LINKORDERID', 'ORDERCATEGORYNAME',
'SECONDARYORDERCATEGORYNAME', 'ORDERCATEGORYDESCRIPTION', 'ISOPENBAG',
'CONTINUEINNEXTDEPT', 'CANCELREASON', 'STATUSDESCRIPTION',
'COMMENTS_EDITEDBY', 'COMMENTS_CANCELEDBY', 'COMMENTS_DATE'],
'TRANSFERS': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'ICUSTAY_ID', 'DBSOURCE',
'EVENTTYPE', 'PREV_CAREUNIT', 'CURR_CAREUNIT', 'PREV_WARDID',
'CURR_WARDID', 'INTIME', 'OUTTIME', 'LOS'],
'PROCEDURES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_PROCEDURES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
'DIAGNOSES_ICD': ['ROW_ID', 'SUBJECT_ID', 'HADM_ID', 'SEQ_NUM', 'ICD9_CODE'],
'D_ICD_DIAGNOSES': ['ROW_ID', 'ICD9_CODE', 'SHORT_TITLE', 'LONG_TITLE'],
}
# Question: does patient 61749 have a male or female gender?
# SQLQuery:
| select patients.gender from patients where patients.subject_id = 61749 |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
Contribute a Dataset Card- Downloads last month
- 8