Skip to content

Instantly share code, notes, and snippets.

@ebot
ebot / 01_README.markdown
Created October 18, 2011 18:47
How to gather data on open and closed deficiencies
  1. Get the the list of active deficiencies by running the 02_open_deficiencies.sql.
    1. Def Assignment TAT = DeficiencyCreateDateTime - DocumentCreateDateTime
  2. Get the list of completed deficiencies by running the 03_completed_deficiencies.sql.
    1. Parse the ListData field's xml.
      1. If the DocId is not listed in the deficiencies table in the operational database and the DocType is valid:
        1. Def Assignment TAT = //Deficiency/CreateDateTime - Document.CreateDateTime
  3. Def Completed TAT = Event.StartDateTime - Document.CreateDateTime
@ebot
ebot / gist:1339448
Created November 4, 2011 14:31
Script that compresses all Mongo DBs except admin and local.
var hospitals = db.getMongo().getDBNames();
for(var h in hospitals){
if (hospitals[h] != "admin" && hospitals[h] != "local") {
var db = db.getMongo().getDB( hospitals[h] );
var size_before = ((db.stats()["dataSize"] / 60) / 60);
print( "Repairing DB " + db.getName() + " - " + size_before );
db.repairDatabase();
var size = ((db.stats()["dataSize"] / 60) / 60);
print( " Complete - " + size + ". Size reduced by " + ( size_before - size ) + " MB." );
}
@ebot
ebot / convert_xml.py
Created November 15, 2011 17:43
Convert Soarian Xml Declarations to ZOS Compatible Ones
#!/usr/bin/python
#
# Soarian Conversion Script
# Created By Ed Botzum
#
# This script replaces the UTF xml declaration with an IBM one.
input_file = open( 'soar_1-1-0.xml', 'r' )
input_text = input_file.read()
print input_text.replace( 'utf-8', 'IBM-1047' )
@ebot
ebot / declare_messages.xsl
Created November 17, 2011 14:09
Format Statement Messages
<xsl:template name="p1">
<xsl:variable name="message" select="string(./messages/element[purpose='1']/text)"/>
<text><xsl:text>$message-p1$</xsl:text><xsl:value-of select="$message"/></text>
</xsl:template>
<xsl:template name="p2">
<xsl:variable name="message" select="string(./messages/element[purpose='2']/text)"/>
<text><xsl:text>$message-p2$</xsl:text><xsl:value-of select="$message"/></text>
</xsl:template>
@ebot
ebot / gen_recovery_csv.rb
Created December 20, 2011 17:39
Ruby script that reads the Extraction/Export error logs to generate recovery csv files.
encounters = []
Dir.glob( '*.txt' ).each do |log|
puts "Reading #{log}"
input = File.new log, 'r'
input.each_line do |line|
if line.include? '):'
encounter = line.split( '):' )[0].split( ' - ' )[1]
encounters << encounter unless encounters.include? encounter
end
end
@ebot
ebot / email.conf
Created January 9, 2012 15:39
Java Email Function
# Email Settings
SMTP Server: tbd
Email Account: [email protected]
Email Recipients: [email protected];[email protected]
@ebot
ebot / update_year.bat
Created January 13, 2012 18:03
Changed the year wildcard
@echo off
mysql -uuser -ppass dbname -e "Update Files Set Name = '*%date:~-2%' Where JobId = 1059;"
Echo Finished updating the year to %date:~-2%
@ebot
ebot / merge_files.py
Created January 18, 2012 20:50
Merges separate Soarian XML files into one xml
#!/usr/bin/python
#
# Soarian Merge Script
# Created By Ed Botzum
#
# This script reads the specified input xml files in the specified
# directory and merges them into one mod file. It then deletes the
# specified files from the processing directory.
import glob
@ebot
ebot / decode.rb
Created February 9, 2012 17:02
Sample encoding and decoding hl7 messages from EDM ADR
#!/usr/bin/env ruby -w
# encoding: UTF-8
require 'base64'
input = ''
unless ARGV[0] == 'hl7'
input = File.read 'doc_base64.txt'
else
input = File.read( 'hl7_samples/working_hl7_sample.txt' ).split( '^Base64^' )[1]