Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / rename.rake
Created October 21, 2010 14:45
A Rails 3 rake task for renaming the application
namespace 'rails' do
desc 'Renames the current app'
task 'rename' do
# Get the new name
new_name = ENV["NEW_NAME"].capitalize || nil
if new_name.nil?
puts "\nYou must pass in a new name"
exit
end
@ebot
ebot / gist:374311
Created April 21, 2010 19:44
Find documents that were not uploaded..
#!/usr/bin/env ruby -wKU
require "FileUtils"
puts "#{Time.now} - Getting documents that were proccessd."
docs = File.new 'document_list.txt', 'w'
Dir.glob( '*.log' ) do |log_file|
puts " Reading #{log_file}"
docs << "#{log_file}\n"
#!/usr/bin/env ruby
require 'rubygems'
require 'coderay'
require 'win32/clipboard'
require 'htmlclipboard.rb'
include Win32
# gather the file information
code_file_name = ARGV[0]
@ebot
ebot / read_server_log.rb
Created February 23, 2010 14:56
Reads the apache server log to gather statistics on the web site.
#!/usr/bin/env ruby
require 'rubygems'
require 'RedCloth'
require 'net/ssh'
require 'net/scp'
host_name = 'host_name'
username = 'user_name'
password = 'password'
@ebot
ebot / get_processed_files.rb
Created February 15, 2010 18:26
Reads through specified log files to get the list of files that were processed.
#!/usr/bin/env ruby -wKU
output = File.new( 'processed.yml', 'w' )
(1..85).each do |number|
file_name = "batch_acquire_results_#{number}.log"
puts "Reading #{file_name}"
input = File.new( file_name, 'r' )
output << "#{file_name}\n"
input.each_line do |line|