1sf/bird-sql-train-with-schema huggingface dataset:
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: How long did Isadora Moen's allergy last? Tell me what kind of allergy she has.
Evidence: how long the allergies last = SUBTRACT(allergies.STOP, allergies.START); kind of allergy refers to allergies.DESCRIPTION;
SQL: SELECT CASE WHEN SUBSTR(T1.STOP, -2, 1) != '9' THEN SUBSTR(T1.STOP, LENGTH(T1.STOP) - 1) + 2000 END - CASE WHEN SUBSTR(T1.START, -2, 1) = '9' THEN SUBSTR(T1.START, LENGTH(T1.START) - 1) + 1900 ELSE SUBSTR(T1.START, LENGTH(T1.START) - 1) + 2000 END AS years , T1.DESCRIPTION FROM allergies AS T1 INNER JOIN patients AS T2 ON T2.patient = T1.PATIENT WHERE T1.STOP IS NOT NULL AND T1.START IS NOT NULL AND T2.first = 'Isadora' AND T2.last = 'Moen'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: How many times was Elly Koss given a care plan between 1/11/2009 and 10/23/2010?
Evidence: between 1/11/2009 and 10/23/2010 refers to careplans.START between '2009-11-1' and '2010-10-23';
SQL: SELECT COUNT(T2.PATIENT) FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Elly' AND T1.last = 'Koss' AND T2.START BETWEEN '2009-01-11' AND '2010-10-23'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: In 2009, who among the married patients had undergone a care plan for more than 60 days?
Evidence: in 2009 refers to year(careplans.START) = 2009; married patients refers to marital = 'M'; undergone a care plan for more than 60 days refers to SUBTRACT(careplans.STOP, careplans.START) > 60;
SQL: SELECT DISTINCT T1.first, T1.last FROM patients AS T1 INNER JOIN careplans AS T2 ON T1.patient = T2.PATIENT WHERE T1.marital = 'M' AND strftime('%J', T2.STOP) - strftime('%J', T2.START) > 60
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: Please provide the dates on which Elly Koss was immunized with the influenza seasonal injectable preservative-free vaccine.
Evidence: date of immunization refers to immunizations.DATE; immunized with the influenza seasonal injectable preservative-free vaccine refers to immunizations.DESCRIPTION = 'Influenza seasonal injectable preservative free';
SQL: SELECT T2.DATE FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'Influenza  seasonal  injectable  preservative free' AND T1.first = 'Elly' AND T1.last = 'Koss'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: From 7/9/2010 to 10/29/2013, how many black patients were immunized with the meningococcal MCV4P vaccine?
Evidence: From 7/9/2010 to 10/29/2013 refers to DATE between '2010-07-09' and '2013-10-29'; black patients refers to race = 'black'; immunized with the meningococcal MCV4P vaccine refers to immunizations.DESCRIPTION = 'meningococcal MCV4P';
SQL: SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T2.DESCRIPTION = 'meningococcal MCV4P' AND T2.DATE BETWEEN '2010-07-09' AND '2013-10-29' AND T1.race = 'black'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: Give me the immunization codes and dates on which Ms. Jacquelyn Shanahan was immunized with influenza seasonal injectable preservative-free vaccine.
Evidence: immunization codes refers to immunizations.CODE; immunization dates refers to immunizations.DATE; immunized with influenza seasonal injectable preservative-free vaccine refers to immunizations.DESCRIPTION = 'Influenza seasonal injectable preservative free'; 4 consecutive years refers to 4 succeeding years;
SQL: SELECT DISTINCT T2.CODE, T2.DATE FROM patients AS T1 INNER JOIN immunizations AS T2 ON T1.patient = T2.PATIENT WHERE T1.prefix = 'Ms.' AND T1.first = 'Jacquelyn' AND T1.last = 'Shanahan' AND T2.DESCRIPTION = 'Influenza  seasonal  injectable  preservative free'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: How long did Berry Keebler take the Acetaminophen 160 MG when he was admitted due to acute bronchitis?
Evidence: how long = SUBTRACT(medications.STOP, medications.START); Acetaminophen 160 MG refers to medications.DESCRIPTION = 'Acetaminophen 160 MG'; acute bronchitis refers to medications.REASONDESCRIPTION = 'Acute bronchitis (disorder)';
SQL: SELECT strftime('%J', T2.STOP) - strftime('%J', T2.START) AS takenDays FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.first = 'Berry' AND T1.last = 'Keebler' AND T2.REASONDESCRIPTION = 'Acute bronchitis (disorder)' AND T2.DESCRIPTION = 'Acetaminophen 160 MG'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: In 2010, how many single patients took Nitrofurantoin 5 mg/ML [Furadantin] to cure cystitis?
Evidence: in 2010 refers to substr(medications.START, 1, 4) = '2010' AND substr(medications.stop, 1, 4) = '2010'; Nitrofurantoin 5 mg/ML [Furadantin] refers to medications.DESCRIPTION = 'Nitrofurantoin 5 MG/ML [Furadantin]'; cystitis refers to medications.REASONDESCRIPTION = 'Cystitis';
SQL: SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T1.marital = 'S' AND T2.REASONDESCRIPTION = 'Cystitis' AND T2.DESCRIPTION = 'Nitrofurantoin 5 MG/ML [Furadantin]' AND strftime('%Y', T2.START) = '2010'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: Tell me the reason for Lavelle Vandervort's encounter on 11/20/2013?
Evidence: reason for encounter refers to encounters.REASONDESCRIPTION; on 11/20/2013 refers to encounters.DATE = '2013-11-20';
SQL: SELECT T2.REASONDESCRIPTION FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T2.DATE = '2013-11-20' AND T1.first = 'Lavelle' AND T1.last = 'Vandervort'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: From 1/9/2011 to 8/29/2012, how many German patients have their outpatient encounters?
Evidence: From 1/9/2011 to 8/29/2012 refers to encounters.DATE between '2011-09-01' and '2012-08-29'; German patients refers to ethnicity = 'german'; outpatient encounters refers to encounters.DESCRIPTION = 'Outpatient Encounter';
SQL: SELECT COUNT(DISTINCT T1.patient) FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T1.ethnicity = 'german' AND T2.DATE BETWEEN '2011-01-09' AND '2012-08-29' AND T2.DESCRIPTION = 'Outpatient Encounter'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: What is the social security number and address of the patient who encountered viral sinusitis symptoms on 6/13/2008?
Evidence: social security number refers to ssn; encountered viral sinusitis refers to encounters.REASONDESCRIPTION = 'Viral sinusitis (disorder)'; on 6/13/2008 refers to encounters.DATE = '2008-06-13';
SQL: SELECT T1.ssn, T1.address FROM patients AS T1 INNER JOIN encounters AS T2 ON T1.patient = T2.PATIENT WHERE T2.DATE = '2008-06-13' AND T2.REASONDESCRIPTION = 'Viral sinusitis (disorder)' AND T2.DESCRIPTION = 'Encounter for symptom'
Database: synthea
Tables: all_prevalences, patients, encounters, allergies, careplans, conditions, immunizations, medications, observations, procedures, claims
Columns (table index, column name): -1, *, 0, ITEM, 0, POPULATION TYPE, 0, OCCURRENCES, 0, POPULATION COUNT, 0, PREVALENCE RATE, 0, PREVALENCE PERCENTAGE, 1, patient, 1, birthdate, 1, deathdate, 1, ssn, 1, drivers, 1, passport, 1, prefix, 1, first, 1, last, 1, suffix, 1, maiden, 1, marital, 1, race, 1, ethnicity, 1, gender, 1, birthplace, 1, address, 2, ID, 2, DATE, 2, PATIENT, 2, CODE, 2, DESCRIPTION, 2, REASONCODE, 2, REASONDESCRIPTION, 3, START, 3, STOP, 3, PATIENT, 3, ENCOUNTER, 3, CODE, 3, DESCRIPTION, 4, ID, 4, START, 4, STOP, 4, PATIENT, 4, ENCOUNTER, 4, CODE, 4, DESCRIPTION, 4, REASONCODE, 4, REASONDESCRIPTION, 5, START, 5, STOP, 5, PATIENT, 5, ENCOUNTER, 5, CODE, 5, DESCRIPTION, 6, DATE, 6, PATIENT, 6, ENCOUNTER, 6, CODE, 6, DESCRIPTION, 7, START, 7, STOP, 7, PATIENT, 7, ENCOUNTER, 7, CODE, 7, DESCRIPTION, 7, REASONCODE, 7, REASONDESCRIPTION, 8, DATE, 8, PATIENT, 8, ENCOUNTER, 8, CODE, 8, DESCRIPTION, 8, VALUE, 8, UNITS, 9, DATE, 9, PATIENT, 9, ENCOUNTER, 9, CODE, 9, DESCRIPTION, 9, REASONCODE, 9, REASONDESCRIPTION, 10, ID, 10, PATIENT, 10, BILLABLEPERIOD, 10, ORGANIZATION, 10, ENCOUNTER, 10, DIAGNOSIS, 10, TOTAL
Question: Give me the reason, name of the drug, and duration of medication under encounter ID 23c293ec-dbae-4a22-896e-f12cf3c8bac3. Tell me if the patient is still alive.
Evidence: reason refers to medications.REASONDESCRIPTION; name of the drug refers to medications.DESCRIPTION; duration of medication = SUBTRACT(julianday(medications.STOP, julianday(medications.START))); ecounter ID refers to encounters.ID; encounters.ID = '23c293ec-dbae-4a22-896e-f12cf3c8bac3'; if patients.deathdate is null then the patient is alive; if patients.deathdate is not null then the patient is not alive;
SQL: SELECT T2.REASONDESCRIPTION, T2.DESCRIPTION , strftime('%J', T2.STOP) - strftime('%J', T2.START) AS days , CASE WHEN T1.deathdate IS NULL THEN 'alive' ELSE 'dead' END FROM patients AS T1 INNER JOIN medications AS T2 ON T1.patient = T2.PATIENT WHERE T2.ENCOUNTER = '23c293ec-dbae-4a22-896e-f12cf3c8bac3'