Category Archives: Science

Science

Converting HRS’ OASIS Schedule Output to Google Calendar

The Heart Rhythm Society uses a system called OASIS for online schedule planning. I wanted to put the output into google calendar, but they only output it in formats that were not compatible with Google Calendar. However, one of those formats is CSV, and it’s not too hard to process with perl, so I made a little converter.

Caveats: It was designed to work with this year’s OASIS, it discards some data, it may be full of bugs, etc. It was hacked out in less than an hour until it did its job sufficiently well, then left as it was.

That said, it worked great for me. Also, it puts all posters from a given session in the event description of a single session item. Here it is:


#!/usr/bin/env perl

use strict;

unless (@ARGV == 1){
print "Usage: convert_itinerary.pl <input filename>";
}

open(INPUT, "<$ARGV[0]") || die "Failed to read file $ARGV[0]: $!\n";
chomp(my @input = <INPUT>);
close(INPUT);

my $line = 0;

shift(@input);

print "\"Subject\",\"Start Date\",\"Start time\",\"End Date\",\"End Time\",\"Description\",\"Location\"\n";

my %psessions = {};

foreach my $line (@input){
my @tmp = split(/,/, $line);

my $subject = '';
my $description = '';
my $location = '';

for(my $i=0; $i<=12; $i++){
$tmp[$i] =~ s/"//g;
$tmp[$i] =~ s/^\s+//g;
$tmp[$i] =~ s/\s+$//g;
}

# Use session time if no presentation time given
if($tmp[5] == ''){
$tmp[5] = $tmp[3];
$tmp[6] = $tmp[4];
}

# Split times and dates
$tmp[5] =~ /([0-9]+\/[0-9]+\/[0-9]+)\s+([0-9]+:[0-9]+\s+[AP]M)/;
my $stime = $2;
my $sdate = $1;

$tmp[6] =~ /([0-9]+\/[0-9]+\/[0-9]+)\s+([0-9]+:[0-9]+\s+[AP]M)/;
my $etime = $2;
my $edate = $1;

# Posters
if ($tmp[11] =~ /^Poster Session$/){
my $pskey = "$tmp[7]";
if(!defined($psessions{$pskey})){
print STDERR "Found poster session $pskey\n";
$psessions{$pskey} = {};
$psessions{$pskey}{'subject'} = $tmp[8];
$psessions{$pskey}{'stime'} = $stime;
$psessions{$pskey}{'sdate'} = $sdate;
$psessions{$pskey}{'etime'} = $etime;
$psessions{$pskey}{'edate'} = $edate;
$psessions{$pskey}{'location'} = $tmp[9];
}
if(!defined($psessions{$pskey}{'description'})){
$psessions{$pskey}{'description'} = '';
}
$psessions{$pskey}{'description'} .= "$tmp[0] - $tmp[12] by $tmp[1] $tmp[2]\r";
}else{
$subject = "$tmp[7] - $tmp[8] - $tmp[12]";
$description = "by $tmp[1] $tmp[2]";
$location = "$tmp[9]";
print "\"$subject\",\"$sdate\",\"$stime\",\"$edate\",\"$etime\",\"$description\",\"$location\"\n";
}
}

# print poster sessions
my @subkeys = qw(subject sdate stime edate etime description);

foreach my $key ( keys %psessions ){
my $sep = '","';
print '"';
foreach my $subkey (@subkeys){
print $psessions{$key}{$subkey}.$sep;
}
print $psessions{$key}{'location'}.'"'."\n";
}

The Heart Rhythm Podcast Without iTunes

The Heart Rhythm Society has an interesting podcast, wherein the author of an article in each issue is interviewed, often by Dr. Doug Zipes. I tried to sign up for it here, but it only gives directions for subscribing with iTunes. I don’t care for iTunes these days, so I went about finding the real RSS feed for the podcast.

If you want it, here it is:

http://podcasts.elsevierhealth.com/HRTHM/hrthm_rss.xml

Hopefully the webmaster at HRS will wise up and post this link as well. Enjoy!