Skip to content

Instantly share code, notes, and snippets.

@pmdgithub
pmdgithub / grab_avatars_for_git_users.pl
Created November 19, 2010 14:39
Grab avatars for github users, use for: gource --user-image-dir .git/avatar/
#!/usr/bin/perl
#fetch Gravatars
use strict;
use warnings;
use LWP::Simple;
use Digest::MD5 qw(md5_hex);
my $size = 90;
Nested Loop (cost=7266.02..13939862.13 rows=197203686 width=152)
Output: zcp.pmd_pclaim_id, zcp.pmd_client_id, zcp.pmd_session_id, zcp.pmd_patient_id, zcp.pmd_provider_id, zcp.pmd_pharmacy_id, zcp.date_of_service, zcp.product_service_id_qual, zcp.product_service_id, zcp.product_service_desc, zcp.quantity_dispensed, zcp.days_supply, zcp.drug_strength, zcp.prescriber, zcp.mtm_patient_id, (max(z.id)), zcp.mtm_medication_id, zcp.mtm_pclaim_id, zcp.mtm_provider_id, zcp.mtm_pharmacy_id, zcp.zpclaiminsert, zcp.zpclaimupdate, zcp.mtm_patientprovider_id
-> HashAggregate (cost=7266.02..7758.77 rows=39420 width=15)
Output: z.ndc, max(z.id)
-> Seq Scan on drugs z (cost=0.00..6702.68 rows=112668 width=15)
Output: z.id, z.lvl1conceptname, z.lvl2conceptname, z.lvl3conceptname, z.lvl4conceptname, z.lvl5conceptname, z.lvl6conceptname, z.ndc9, z.productnamelong, z.productnameshort, z.routename, z.brand_name, z.brand, z.ingredientname, z.ndc, z.dosage, z.dosageunit, z.eprescribingnam
UPDATE zpmdl_pclaim zcp
SET mtm_drug_id = ydrg.id
FROM
(SELECT z.ndc, MAX(z.id) AS id
FROM drugs z
GROUP BY z.ndc) ydrg
WHERE ydrg.ndc = zcp.product_service_id
Indexes:
"pk_zpmdlpclaim_pmdpclaimid" PRIMARY KEY, btree (pmd_pclaim_id)
"idx_zpmdlpclaim_pmdpatientid" btree (pmd_patient_id)
"idx_zpmdlpclaim_pmdpclaimid" btree (pmd_pclaim_id)
"idx_zpmdlpclaim_pmdpharmacyid" btree (pmd_pharmacy_id)
"idx_zpmdlpclaim_pmdproviderid" btree (pmd_provider_id)
"idx_zpmdlpclaim_productserviceid" btree (product_service_id)
Foreign-key constraints:
"fk_provider_pmdproviderid" FOREIGN KEY (pmd_provider_id) REFERENCES zpmdl_provider(pmd_provider_id)
<%= @node[:environment][:framework_env] %>:
adapter: postgresql
database: <%= @app_name %>_<%= @node[:environment][:framework_env] %>
username: <%= @username %>
password: <%= @db_pass %>
host: <%= @node[:db_host] %>
require 'pp'
#
# Cookbook Name:: postgres
# Recipe:: default
#
#
if node[:instance_role] == 'db_master' || node[:instance_role] == 'solo'
postgres_root = '/var/lib/postgresql'
postgres_version = '8.3'