Skip to content

Instantly share code, notes, and snippets.

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
<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;
@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
@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 / connect.coffee
Created March 21, 2012 19:53
Nodejs script that is the simplest possible way to log into a remote server with basic authentication.
http = require("http")
uname = "uname"
pword = "pword"
options =
host: "server_name_or_ip"
port: 80
path: "/path/to/page.aspx"
headers:
@ebot
ebot / make_echo_additions.rb
Created May 15, 2012 17:15
Splits unmatched accounts into an additions file for the mainframe.
#!/usr/bin/env ruby -wKU
input = File.new 'accounts.txt', 'r'
output = File.new 'additions.txt', 'w'
input.each_line do |line|
line = line.chomp.strip
enc = line.split '-'
output << " #{'%011d' % enc[0]}#{enc[1]}\n" unless line.nil?
end
require 'fastercsv'
require 'fileutils'
require 'date'
docs = {}
rename = {}
FasterCSV.foreach( 'dupe_docs.txt', :headers => true, :col_sep => ';' ) do |row|
begin
fname = "#{row['OwnerFolderDate'].split(' ')[0]}_#{row['OwnerTypeName'].strip}_#{row['DocTypeName'].strip}_#{row['file_name']}"
folder = "#{DateTime.parse( row['OwnerFolderDate']).strftime('%Y')}-data"
require 'nokogiri'
# Read the csv and check each file listed like so
doc = File.read 'file_name.xml'
check_marks = doc.xpath("/ClinicalDocument/StructuredBody/section/title[starts-with(text(), 'CHECK')]/../text/text()").collect(&:text)
add_to_report if check_marks.nil?
@ebot
ebot / count_csvs.rb
Created September 20, 2012 16:12
Compare's Iron Mountain's actual documents with what their csvs say should be there.
#!/usr/bin/env ruby -wKU
require 'faster_csv'
puts "Reading the Iron Mountain CSVs"
encounters = Hash.new
error_text = ''
enc_no = '' # Include information from a specific encounter
lines = 0
Dir.glob( '*.csv' ).each do |file|
@ebot
ebot / Recursion.java
Created October 9, 2012 16:24
Samples for Donita
public class Recursion {
private String sentence;
public Recursion(String sentence) {
this.sentence = sentence;
}
public String getSentence() {
return sentence;
}