Skip to content

Instantly share code, notes, and snippets.

@ebot
ebot / gist:2121607
Created March 19, 2012 17:57
Find Duplicate RB Encounters
Select e.EncounterNo, e.EncntrStartDate as old_encounter, e2.EncntrStartDate as new_encounter
From DocTypes as dt
Inner Join documents as d on dt.DocType = d.DocType
Inner Join DocsOwners as do on d.DocId = do.DocId
Inner Join Encounters as e on do.OwnerId = e.EncntrOwnerId
Inner Join Encounters as e2 on e.EncounterNo = e2.EncounterNo
Where DocTypeName in ( 'SNGRPT', 'SNGRPTR' )
And e.EncntrOwnerId <> e2.EncntrOwnerId
And e2.EncntrStartDate > '1/1/2005'
And (Select Count(*) From Documents as d2
@ebot
ebot / gist:2037992
Created March 14, 2012 17:16
Get List of EncounterNos, DocsType, and Dates from tag files.
#!/usr/bin/env ruby -wKU
out = File.new 'delete.csv', 'w'
encounters = []
doc_dates = []
doc_types = []
Dir.glob('*.tag').each do |tag|
input = File.new tag, 'r'
input.each_line do |line|
val = line.split(':')[1].strip
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>ICD Threat Level</title>
<style type="text/css" media="screen">
/* line 93, /var/www/rails/adhocs/app/assets/stylesheets/adhocs.scss */
.threat {
width: 100px;
background-color: green;
padding: 4px 45px 4px 45px;
SELECT OwnerTypeName AS Folder,
EncounterNo, EncntrStartDate,
EnrolleeName,
DocTypeName, d.DocId, ModifyDateTime
FROM DocTypes AS dt
INNER JOIN documents AS d ON dt.DocType = d.DocType
INNER JOIN docsowners AS do ON d.DocId = do.DOcId
INNER JOIN Owners AS o ON do.OwnerId = o.OwnerId
INNER JOIN OwnerTypes AS ot ON o.OwnerType = ot.OwnerType
INNER JOIN Encounters AS e ON do.OwnerId = e.EncntrOwnerId
@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]
@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 / 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 / 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 / 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 / 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>