Skip to content

Instantly share code, notes, and snippets.

@mapsam
Last active September 18, 2015 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mapsam/5959213a72bdde9e352b to your computer and use it in GitHub Desktop.
Save mapsam/5959213a72bdde9e352b to your computer and use it in GitHub Desktop.
errrrrrrr rva-screening

ProgrammingError: (ProgrammingError) missing FROM-clause entry for table "patient_referral" LINE 6: ..._referral.status = 'COMPLETED') ORDER BY coalesce(patient_re... ^ 'SELECT count(*) AS count_1 \nFROM (SELECT patient.created AS patient_created, patient.last_modified AS patient_last_modified, patient.id AS patient_id, patient.full_name AS patient_full_name, patient.first_name AS patient_first_name, patient.middle_name AS patient_middle_name, patient.last_name AS patient_last_name, patient.dob AS patient_dob, patient.ssn AS patient_ssn, patient.email AS patient_email, patient.gender AS patient_gender, patient.transgender AS patient_transgender, patient.race AS patient_race, patient.race_other AS patient_race_other, patient.ethnicity AS patient_ethnicity, patient.languages AS patient_languages, patient.languages_other AS patient_languages_other, patient.has_interpreter_yn AS patient_has_interpreter_yn, patient.education_level AS patient_education_level, patient.marital_status AS patient_marital_status, patient.veteran_yn AS patient_veteran_yn, patient.housing_status AS patient_housing_status, patient.housing_status_other AS patient_housing_status_other, patient.years_living_in_area AS patient_years_living_in_area, patient.months_living_in_area AS patient_months_living_in_area, patient.city_or_county_of_residence AS patient_city_or_county_of_residence, patient.temp_visa_yn AS patient_temp_visa_yn, patient.has_transport_yn AS patient_has_transport_yn, patient.student_status AS patient_student_status, patient.employment_status AS patient_employment_status, patient.years_unemployed AS patient_years_unemployed, patient.months_unemployed AS patient_months_unemployed, patient.employment_changes AS patient_employment_changes, patient.spouse_employment_status AS patient_spouse_employment_status, patient.spouse_years_unemployed AS patient_spouse_years_unemployed, patient.spouse_months_unemployed AS patient_spouse_months_unemployed, patient.spouse_employment_changes AS patient_spouse_employment_changes, patient.years_at_current_employer AS patient_years_at_current_employer, patient.spouse_years_at_current_employer AS patient_spouse_years_at_current_employer, patient.last_healthcare AS patient_last_healthcare, patient.insurance_status AS patient_insurance_status, patient.coverage_type AS patient_coverage_type, patient.coverage_type_other AS patient_coverage_type_other, patient.has_prescription_coverage_yn AS patient_has_prescription_coverage_yn, patient.has_vcc AS patient_has_vcc, patient.has_pcp_yn AS patient_has_pcp_yn, patient.has_psychiatrist_yn AS patient_has_psychiatrist_yn, patient.wants_psychiatrist_yn AS patient_wants_psychiatrist_yn, patient.eligible_insurance_types AS patient_eligible_insurance_types, patient.applied_for_vets_benefits_yn AS patient_applied_for_vets_benefits_yn, patient.eligible_for_vets_benefits_yn AS patient_eligible_for_vets_benefits_yn, patient.applied_for_medicaid_yn AS patient_applied_for_medicaid_yn, patient.denied_medicaid_yn AS patient_denied_medicaid_yn, patient.medicaid_date_effective AS patient_medicaid_date_effective, patient.applied_for_ssd_yn AS patient_applied_for_ssd_yn, patient.ssd_date_effective AS patient_ssd_date_effective, patient.care_due_to_accident_yn AS patient_care_due_to_accident_yn, patient.accident_work_related_yn AS patient_accident_work_related_yn, patient.recently_lost_insurance_yn AS patient_recently_lost_insurance_yn, patient.head_of_household_yn AS patient_head_of_household_yn, patient.filed_taxes_yn AS patient_filed_taxes_yn, patient.claimed_as_dependent_yn AS patient_claimed_as_dependent_yn, patient.how_food_and_shelter AS patient_how_food_and_shelter, patient.how_other_expenses AS patient_how_other_expenses, patient.last_modified_by_id AS patient_last_modified_by_id, patient.created_by_id AS patient_created_by_id \nFROM patient \nWHERE EXISTS (SELECT 1 \nFROM patient_referral \nWHERE patient.id = patient_referral.patient_id AND patient_referral.from_app_user_id IN (%(from_app_user_id_1)s) AND patient_referral.status = %(status_1)s) ORDER BY coalesce(patient_referral.last_modified, patient_referral.created)) AS anon_1' {'from_app_user_id_1': 1, 'status_1': 'COMPLETED'}

Traceback (most recent call last):
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask_login.py", line 758, in decorated_view
    return func(*args, **kwargs)
  File "/Users/mapsam/codeforamerica/github/rva-screening/app/decorators.py", line 13, in decorated_function
    return f(*args, **kwargs)
  File "/Users/mapsam/codeforamerica/github/rva-screening/app/views.py", line 691, in index
    your_open_referrals_outgoing=your_open_referrals_outgoing
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/templating.py", line 128, in render_template
    context, ctx.app)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/flask/templating.py", line 110, in _render
    rv = template.render(context)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/mapsam/codeforamerica/github/rva-screening/app/templates/index.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/Users/mapsam/codeforamerica/github/rva-screening/app/templates/base.html", line 6, in top-level template code
    {% block content %}{% endblock %}
  File "/Users/mapsam/codeforamerica/github/rva-screening/app/templates/index.html", line 13, in block "content"
    <i class="fa fa-home"></i> Filter <span class="filter-count">{{ org_completed_referrals_outgoing.count() }}</span>
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2643, in count
    return self.from_self(col).scalar()
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2429, in scalar
    ret = self.one()
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2398, in one
    ret = list(self)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2441, in __iter__
    return self._execute_and_instances(context)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2456, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 841, in execute
    return meth(self, multiparams, params)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 322, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 938, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1070, in _execute_context
    context)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1271, in _handle_dbapi_exception
    exc_info
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1063, in _execute_context
    context)
  File "/Users/mapsam/.virtualenvs/rva-screening/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 442, in do_execute
    cursor.execute(statement, parameters)
ProgrammingError: (ProgrammingError) missing FROM-clause entry for table "patient_referral"
LINE 6: ..._referral.status = 'COMPLETED') ORDER BY coalesce(patient_re...
                                                             ^
 'SELECT count(*) AS count_1 \nFROM (SELECT patient.created AS patient_created, patient.last_modified AS patient_last_modified, patient.id AS patient_id, patient.full_name AS patient_full_name, patient.first_name AS patient_first_name, patient.middle_name AS patient_middle_name, patient.last_name AS patient_last_name, patient.dob AS patient_dob, patient.ssn AS patient_ssn, patient.email AS patient_email, patient.gender AS patient_gender, patient.transgender AS patient_transgender, patient.race AS patient_race, patient.race_other AS patient_race_other, patient.ethnicity AS patient_ethnicity, patient.languages AS patient_languages, patient.languages_other AS patient_languages_other, patient.has_interpreter_yn AS patient_has_interpreter_yn, patient.education_level AS patient_education_level, patient.marital_status AS patient_marital_status, patient.veteran_yn AS patient_veteran_yn, patient.housing_status AS patient_housing_status, patient.housing_status_other AS patient_housing_status_other, patient.years_living_in_area AS patient_years_living_in_area, patient.months_living_in_area AS patient_months_living_in_area, patient.city_or_county_of_residence AS patient_city_or_county_of_residence, patient.temp_visa_yn AS patient_temp_visa_yn, patient.has_transport_yn AS patient_has_transport_yn, patient.student_status AS patient_student_status, patient.employment_status AS patient_employment_status, patient.years_unemployed AS patient_years_unemployed, patient.months_unemployed AS patient_months_unemployed, patient.employment_changes AS patient_employment_changes, patient.spouse_employment_status AS patient_spouse_employment_status, patient.spouse_years_unemployed AS patient_spouse_years_unemployed, patient.spouse_months_unemployed AS patient_spouse_months_unemployed, patient.spouse_employment_changes AS patient_spouse_employment_changes, patient.years_at_current_employer AS patient_years_at_current_employer, patient.spouse_years_at_current_employer AS patient_spouse_years_at_current_employer, patient.last_healthcare AS patient_last_healthcare, patient.insurance_status AS patient_insurance_status, patient.coverage_type AS patient_coverage_type, patient.coverage_type_other AS patient_coverage_type_other, patient.has_prescription_coverage_yn AS patient_has_prescription_coverage_yn, patient.has_vcc AS patient_has_vcc, patient.has_pcp_yn AS patient_has_pcp_yn, patient.has_psychiatrist_yn AS patient_has_psychiatrist_yn, patient.wants_psychiatrist_yn AS patient_wants_psychiatrist_yn, patient.eligible_insurance_types AS patient_eligible_insurance_types, patient.applied_for_vets_benefits_yn AS patient_applied_for_vets_benefits_yn, patient.eligible_for_vets_benefits_yn AS patient_eligible_for_vets_benefits_yn, patient.applied_for_medicaid_yn AS patient_applied_for_medicaid_yn, patient.denied_medicaid_yn AS patient_denied_medicaid_yn, patient.medicaid_date_effective AS patient_medicaid_date_effective, patient.applied_for_ssd_yn AS patient_applied_for_ssd_yn, patient.ssd_date_effective AS patient_ssd_date_effective, patient.care_due_to_accident_yn AS patient_care_due_to_accident_yn, patient.accident_work_related_yn AS patient_accident_work_related_yn, patient.recently_lost_insurance_yn AS patient_recently_lost_insurance_yn, patient.head_of_household_yn AS patient_head_of_household_yn, patient.filed_taxes_yn AS patient_filed_taxes_yn, patient.claimed_as_dependent_yn AS patient_claimed_as_dependent_yn, patient.how_food_and_shelter AS patient_how_food_and_shelter, patient.how_other_expenses AS patient_how_other_expenses, patient.last_modified_by_id AS patient_last_modified_by_id, patient.created_by_id AS patient_created_by_id \nFROM patient \nWHERE EXISTS (SELECT 1 \nFROM patient_referral \nWHERE patient.id = patient_referral.patient_id AND patient_referral.from_app_user_id IN (%(from_app_user_id_1)s) AND patient_referral.status = %(status_1)s) ORDER BY coalesce(patient_referral.last_modified, patient_referral.created)) AS anon_1' {'from_app_user_id_1': 1, 'status_1': 'COMPLETED'}
127.0.0.1 - - [18/Sep/2015 14:11:35] "GET /?__debugger__=yes&cmd=resource&f=style.css HTTP/1.1" 200 -
127.0.0.1 - - [18/Sep/2015 14:11:35] "GET /?__debugger__=yes&cmd=resource&f=jquery.js HTTP/1.1" 200 -
127.0.0.1 - - [18/Sep/2015 14:11:35] "GET /?__debugger__=yes&cmd=resource&f=debugger.js HTTP/1.1" 200 -
127.0.0.1 - - [18/Sep/2015 14:11:35] "GET /?__debugger__=yes&cmd=resource&f=ubuntu.ttf HTTP/1.1" 200 -
127.0.0.1 - - [18/Sep/2015 14:11:35] "GET /?__debugger__=yes&cmd=resource&f=console.png HTTP/1.1" 200 -
127.0.0.1 - - [18/Sep/2015 14:11:35] "GET /?__debugger__=yes&cmd=resource&f=source.png HTTP/1.1" 200 -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment