Skip to content

Instantly share code, notes, and snippets.

@ebot
ebot / gist:649392
Created October 27, 2010 16:31
SQL Script to copy indexes from the old table to a new one
/******************************************************************************
* Script to copy indexes from the old table to a new one *
* Created By Ed Botzum *
* Created on 10/27/2010 *
*******************************************************************************/
Declare @table_name as nvarchar(100)
Declare @new_table_name as nvarchar(100)
Declare @index_name as nvarchar(100)
Declare @column_name as nvarchar(100)
@ebot
ebot / find_icd.rb
Created January 17, 2011 18:29
Searches adhocs for ICD Components
#!/usr/bin/env ruby
require "mongo"
connection = Mongo::Connection.new
connection.database_names.each do |name|
if name.include?('icd_')
puts "#{DateTime.now} - #{name}"
adhocs = connection.db(name).collection('adhocs')
scheduled = adhocs.find( { "schedule" => /.*/ } )
@ebot
ebot / count_echo_recs.sql
Created February 22, 2011 20:51
Patch to Delete Duplicate records from echo and then verify whats left by counting the unique patients.
-- DELETE THE BabyInformation DUPLICATES
BEGIN
SELECT [PA-PT-NO-WOSCD], [PA-ACCT-TYPE], [PA-CTL-PAA-XFER-DATE],
COUNT([PA-PT-NO-WOSCD]) AS dupes, MAX([PA-REC-CREATE-DATE]) AS last_occurance,
MIN([PA-REC-CREATE-DATE]) AS first_occurance
INTO #BabyInformation_dupes
FROM BabyInformation
GROUP BY [PA-PT-NO-WOSCD], [PA-ACCT-TYPE], [PA-CTL-PAA-XFER-DATE]
DELETE FROM BabyInformation
@ebot
ebot / gist:892960
Created March 29, 2011 18:37
Fix Patient Num
#!/usr/bin/env ruby -wKU
input = File.new 'input.txt'
output = File.new 'output.txt', 'w'
input.each_line do |line|
account = line.split '-'
puts " #{"%011d" % account[0]}#{account[1]}"
output << " #{"%011d" % account[0]}#{account[1]}"
end
@ebot
ebot / gist:893675
Created March 30, 2011 01:03
Passenger Setup Notes
To fix server permissions
===========================
In httpd.conf (/etc/apache2)
* Comment out User and Group
* Add User <name of admin user>
Create App Entries
====================
@ebot
ebot / fix_csv.rb
Created March 31, 2011 16:40
Strips out doc id brackets at trims white space on csv files
#!/usr/bin/env ruby -wKU
input = File.new 'generic_doc_labels.csv'
output = File.new 'generic_document_labels.csv', 'w'
line_number = 0
input.each_line do |line|
unless line_number == 0
fields = line.split '","'
@ebot
ebot / find_failed_export_docs.rb
Created June 14, 2011 18:56
Scans the export logs and locates the doc id of specified job ids.
#!/usr/bin/env ruby -wKU
job_ids = [ '9555141D-0728-473C-9C98-F62E2D944F2F',
'C8AB8CF9-1A1D-45D8-A6E0-D65C3F6D7DBB',
'C8531ECE-E771-432C-8D24-86E1881EEA41',
'3531688C-BD89-4394-A786-DCF6FEE4753B',
'3C8890BE-4D24-4521-A780-1E896A3BB49B',
'D4A2B1D7-3ABE-4CA2-B22E-720552936D7D',
'309B2CD2-4277-45ED-870D-E7AC2CC51700',
'20B56A51-6D47-4207-AD34-8C0EAE49C6F9',
@ebot
ebot / gist:1054804
Created June 29, 2011 20:05
kickstart
# Initialize the var
dupe_docs = {}
# In your loop/routine
dupe_docs[doc_id] = [] if dupe_docs[doc_id].nil?
dupe_docs[doc_id] << encounter_number
# At the bottom, output the totals
puts "There were #{dupe_docs.count} duplicate documents:"
dupe_docs.each do |doc, encounters|
@ebot
ebot / .gemrc
Created July 6, 2011 14:19
My Standard git, gem, and rspec configurations for Ruby development.
gem: --local --no-rdoc --no-ri
@ebot
ebot / non_leap_year_download.rb
Created August 12, 2011 16:33
Script that downloads file on Mar 1 if Feb only has 28 days
#!/usr/bin/env ruby -wKU
# Non Leap Year Download Script
# Create By Ed Botzum
# Last Updated 2011-08-12
# Code maintained at https://gist.github.com/1142420
#
# This script will download the specified files on March 1 in years when
# February has only twenty eight days, b/c the normal monthly job is scheduled
# to run on the twenty ninth of each month. This custom job will run on the
# first of each month. Yay rediculous waste!