Skip to content

Instantly share code, notes, and snippets.

@aoswalt
Created January 24, 2020 18:37
Show Gist options
  • Save aoswalt/73ce82cf3ce84ebc6caf0508f3333c9a to your computer and use it in GitHub Desktop.
Save aoswalt/73ce82cf3ce84ebc6caf0508f3333c9a to your computer and use it in GitHub Desktop.
Problematic database output with UltiSnips
pid | running_time | client_addr | client_port | application_name | state | query
-------+------------------+--------------+-------------+------------------+---------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
72041 | 00:00:00.615529 | 00.0.000.000 | 20440 | aspire_pg prod | idle in transaction | SELECT f0."id", f0."template", f0."schema", f0."ui_schema", f0."tags", f0."data", f0."context", f0."modified_at", f0."modified_by", f0."id" FROM "aspire"."form" AS f0 WHERE (f0."id" = $1)
66244 | 00:00:00.351732 | 00.0.000.000 | 60920 | aspire_pg prod | active | SELECT v1."patient_name__c", e0."patient_id", e0."assessment_status", e0."date_of_service", e0."id" FROM "aspire"."encounter" AS e0 INNER JOIN "salesforce"."v_patients" AS v1 ON e0."patient_id" = v1."sfid" WHERE (e0."provider_id" = $1) AND (e0."assessment_status" = ANY($2)) AND (e0."created_at" :: DATE <= current_date)
72275 | 00:00:00.146855 | 00.0.000.000 | 26108 | aspire_pg prod | idle in transaction | BEGIN
58464 | 00:00:00.13622 | 00.0.000.000 | 29122 | aspire_pg prod | active | SELECT v2."patient_id", v2."patient_name", a4."lastname", a4."firstname", a5."program_enrolled__pc", v2."app_id", v2."app_name", v2."market", a1."primary_contract__c", a5."patient_status__pc", a5."substatus__pc", v2."active_hospitalization", v2."recent_hospitalization", v2."active_snf", v2."recent_snf", v2."overdue", v2."limited_prognosis", v2."currentDayVisit", v2."recommended_for_discharge", v2."recent_discharge", v2."hotspotter", v6."score", a3."next_targeted_visit_date__c", f7."last_visit_date", coalesce(s8."no_acp_documents", FALSE), a3."last_call_date_time__c" FROM "aspire"."care_team_member" AS c0 INNER JOIN "salesforce"."account" AS a1 ON a1."np_care_team__pc" = c0."care_team_id"::varchar INNER JOIN "staticbi"."v_dashboard_patient_list" AS v2 ON v2."patient_id" = a1."sfid" INNER JOIN "salesforce"."account" AS a3 ON a3."sfid" = a1."sfid" INNER JOIN "salesforce"."account" AS a4 ON a4."sfid" = a1."sfid" INNER JOIN "salesforce"."account" AS a5 ON a5."sfid" = a1."sfid" LEFT OUTER JOIN "aspire"."v_patient_
66384 | 00:00:00.135498 | 00.0.000.000 | 31221 | aspire_pg prod | active | SELECT n0."id", a1."sfid", a3."name", a4."program_enrolled__pc", n0."nominated_at", n0."target_discussion_date", n0."notes", n0."reason", n0."completed_at", v6."active_hospitalization", a2."next_targeted_visit_date__c", a2."rollup_last_clinical_assessment_date__pc", v6."limited_prognosis", v6."recent_hospitalization", v6."active_snf", v6."recent_snf", v6."overdue", a4."patient_status__pc", a4."substatus__pc", NOT (e7."id" IS NULL) FROM "aspire"."nomination" AS n0 INNER JOIN "salesforce"."account" AS a1 ON a1."sfid" = n0."patient_id" INNER JOIN "salesforce"."account" AS a2 ON a2."sfid" = a1."sfid" INNER JOIN "salesforce"."account" AS a3 ON a3."sfid" = a1."sfid" INNER JOIN "salesforce"."account" AS a4 ON a4."sfid" = a1."sfid" INNER JOIN (SELECT DISTINCT ON (p1."patient_id") p1."patient_id" AS "patient_id", c0."role" AS "role", c0."user_id" AS "user_id" FROM "aspire"."care_team_member" AS c0 INNER JOIN "aspire"."patient_care_team" AS p1 ON p1."care_team_id" = c0."care_team_id" WHERE (c0."user_id" = $1)) AS s5 O
65685 | 00:00:00.020702 | 00.0.000.000 | 9598 | aspire_pg prod | idle in transaction | SELECT s0."coded_at"::date, s0."code", s0."description", s0."specific", s0."has_associated_code", s0."parent_code" FROM (SELECT p0."problem_id" AS "problem_id", p0."coded_at" AS "coded_at", i1."code" AS "code", i1."description" AS "description", i1."specific" AS "specific", p0."parent_code" AS "parent_code", p0."has_associated_code" AS "has_associated_code" FROM "clinical"."problem_to_icd_10_code" AS p0 INNER JOIN "aspire"."icd_10_code" AS i1 ON i1."code" = p0."icd_10_code" WHERE (i1."valid_from" < p0."modified_at") AND (i1."valid_to" > p0."modified_at") ORDER BY p0."coded_at" DESC) AS s0 WHERE (s0."problem_id" = $1)
45174 | -00:00:00.000495 | 00.0.000.000 | 28668 | aspire_pg prod | active | SELECT data +
| | | | | | FROM aspire.user_app_settings +
| | | | | | WHERE app = $1 AND user_id = $2 +
| | | | | | UNION ALL +
| | | | | | SELECT NULL AS data +
| | | | | | LIMIT 1 +
| | | | | |
45144 | -00:00:00.001529 | 00.0.000.000 | 7554 | aspire_pg prod | active | SELECT u0."id", u0."list", u0."reason", v1."patient_id", v1."patient_name", a3."lastname", a3."firstname", a5."program_enrolled__pc", a3."personbirthdate", v1."app_id", v1."app_name", v1."market", a2."primary_contract__c", u0."created_date", v6."score", a4."next_targeted_visit_date__c", f7."last_visit_date", coalesce(s8."no_acp_documents", FALSE), a4."last_call_date_time__c" FROM "aspire"."user_patient_list" AS u0 INNER JOIN "staticbi"."v_dashboard_patient_list" AS v1 ON v1."patient_id" = u0."patient_id" INNER JOIN "salesforce"."account" AS a2 ON a2."sfid" = u0."patient_id" INNER JOIN "salesforce"."account" AS a3 ON a3."sfid" = a2."sfid" INNER JOIN "salesforce"."account" AS a4 ON a4."sfid" = a2."sfid" INNER JOIN "salesforce"."account" AS a5 ON a5."sfid" = a2."sfid" LEFT OUTER JOIN "aspire"."v_patient_score" AS v6 ON v6."patient_id" = u0."patient_id" LEFT OUTER JOIN LATERAL (SELECT e.patient_id , max(e.date_of_service) AS last_visit_date +
| | | | | | FROM aspire.encounter AS e WHERE (e.assessment_status = ANY('{pe
58426 | -00:00:00.002426 | 00.0.000.000 | 63224 | aspire_pg prod | active | SELECT a0."sfid", a0."last_assessment__pc", a0."primary_contract__c", a0."primary_insurance_number__pc", a0."global_member_id__c", a0."np_care_team__pc", a0."ownerid", a0."aspire_practice__c", a0."referring_physician__c", a0."referring_entity__pc", a0."primary_care_physician__c", s1."id", s2."id", s3."id", s4."id", s5."id", s6."id", s7."id" FROM "salesforce"."account" AS a0 LEFT OUTER JOIN (SELECT s0."id" AS "id", s0."patient_id" AS "patient_id" FROM (SELECT e0."id" AS "id", e0."date_of_service" AS "date_of_service", e0."assessment_status" AS "assessment_status", e0."coding_status" AS "coding_status", e0."fax_status" AS "fax_status", e0."confirmed" AS "confirmed", e0."cancellation_reason" AS "cancellation_reason", e0."cancellation_reason_other" AS "cancellation_reason_other", e0."created_at" AS "created_at", e0."signed_at" AS "signed_at", e0."cancelled_at" AS "cancelled_at", e0."modified_at" AS "modified_at", e0."provider_id" AS "provider_id", e0."form_id" AS "form_id", e0."event_id" AS "event_id", e0."patie
58469 | -00:00:00.002807 | 00.0.000.000 | 31183 | aspire_pg prod | active | SELECT a0."sfid", a0."patient_status__pc" FROM "salesforce"."account" AS a0 WHERE (a0."sfid" = $1)
75075 | -00:00:00.004218 | 00.0.000.000 | 4870 | aspire_pg prod | active | INSERT INTO "salesforce"."task_cust__c" ("account_id__c","aspirecreatedby__c","assigned_to__c","case_status__c","category_2__c","completed_date__c","completed_by__c","display_in_patient_timeline__c","notes__c","parent_case__c","patient__c","status__c") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)
(11 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment