Friday, December 28, 2012

Medical records data - HL7

I keep thinking about a career adjustment - basically converting from more general applications development to more specialized applications.  I had considered going back to college for a masters degree in bioinformatics and trying to start over from there.  I decided that was too much disruption to my family mainly for just my benefit - at least while my kids are young.  I have considered trying to learn HL7 (mainly v3) and look for an appropriate job opportunity.  That is by the fact that my current employment takes more time than I care to admit and to the detriment of my family as well some days. 

[Update] I decided that it is more practical to look into career paths more inline with my existing eduction and some other interests.  I still find it useful to understand the technology as you never know when it will come in handy in some way.

I have looking into HL7 for a year or 2.  This was challenging since there was little freely available information/tools.  In the meantime, some of basic information is now more freely available along with a few tools.  The only other major hurdle is that I would likely learn using freely available Java resources whereas it seems, based on job postings, that most jobs are doing .NET solutions (or mainframe).  Learning .NET (versus just C/C++ on Windows from years ago) is on my list to do but time consuming as well.  My current job will likely require an increasing amount of .NET work so given time.. but this is off topic a bit.

I'm trying to keep a list of potentially useful resources (with a majority of focus on freely available resources) to learn/utilize.  I have not reviewed any of these in more than passing at this time.
  • http://en.wikipedia.org/wiki/Health_Level_7
  • http://www.hl7.org/participate/toolsandresources.cfm
  • http://sourceforge.net/projects/hl7inspector/
  • http://www.openehealth.org/display/ipf2/Home
I would have liked to join in some free webinars related to HL7 but so far they have always occurred at times when I was not able to take off from work (nor could I really justify it during my normal work day since it is not really related to my current employment).

Finding realistic sample data to learn from may be challenging.  Anyways, even if this doesn't lead to a job change, I think it is still a worthwhile to stretch my knowledge into other areas.  I find it quite amazing when some seemingly unrelated information helps me with a current difficult task.

 I'll hopefully add more interesting and useful content related to this over time.


Friday, December 21, 2012

IT and requests for Cloud Technology solutions

[2016/05/19] Update
 Ok, I'm actually finding some reasonable use cases for 3rd party cloud solutions. I still don't think it makes sense in instances where multiple large applications and lots of integration's are involved but for "point" solutions with few integration needs it may make good sense.  The cases I am thinking about (outside of family :) ) are development tools/process related.  With staffing so slim, it is pretty risky having only one person that knows how all the development and operations infrastructure is built, installed, setup and maintained. Having someone else deal with most of that means that staff have more time to focus on actual development. As is, maintenance of development tools/processes is falling to the wayside more and more for lack of time - that increases risk that something could go very wrong resulting in loss of assets or substantial disruption to systems/processes.  I will say that a cloud solution isn't a silver bullet though - it has its own risks like provider outages, network disruptions etc which can have a large negative impact on development processes too.  Which risks are more likely and have the higher negative impact?  Hard to tell right now but worth thinking about.

Anyways, use the appropriate tool for the job..
-------------------------------------------------------

This post is a bit of a general complaint against some people in IT and management.  It seems that there is an increasing tendency for people to request "cloud" applications or make requests to convert existing applications to "cloud" applications.  Why should this concern anyone?  I find it concerning because these requests are made for a specific solution instead of having a specific need or requirement where "the cloud" is the best solution.  The decisions behind any IT solutions should be made to solve specific problems or meet specific requirements.  Technology decisions based mainly on some research companies "quadrant" leads me to
  • wonder whether the solution is really a good fit for the organization
  • concern regarding the longer term viability of a solution
  • concern whether a project is setup for failure from the start
  • concern that the total/on-going cost will be wasteful of money and/or other resources
I am not saying that there is anything wrong with "cloud" technology but I am saying that many people don't understand more than the executive briefing level of information that the media pushes.  Although, if management makes a final decision that they want "cloud solutions" then I (and anyone else) should abide an employers decisions and do their best to make it work as well as possible.  If a person cannot get themselves  to do that then they should consider a different employer - but let me leave that for a different post.

The type of situation that leads me to finding a lack of in-depth understanding includes someone trying to justify a cloud solution by saying it will save money but can't back that with any further details.  If the only further justification is "we don't need to by hardware" then you are likely in the same situation.  If the application/service is a mission critical application then you may end up with a really big problem. 

If someone wants to talk about cloud solutions with me then I expect them to be willing to start the discussion with the following items at a minimum:
  1. Security requirements
    1. application access
    2. data sensitivity
  2. User base
    1. size
    2. locations
    3. types of users
      1. public
      2. internal only
      3. etc
  3. Data sources, locations and integration types
  4. Performance/capacity requirements
  5. Availability requirements
  6. Disaster recovery requirements
  7. Compliance/auditing requirements
 If the answers don't exclude cloud solutions then some cloud questions/discussion items should include:
  1. Potential internal staffing needs
    1. training
      1. developers
      2. operations/support personnel
  2. Potential network requirements
  3. cloud types
    1. 3rd party -  external cloud / hosted solution
    2. internal cloud
    3. hybrid
This last question (especially if potentially working with 3rd party/external cloud) should lead into
  1. Potential maintenance logistics/coordination
    1. If you require specific availability windows unsupported by the 3rd party then what?
    2. If you have maintenance windows for integrations/data sources then how is that handled/coordinated?
  2. Help desk / communications logistics
    1. If there is a problem, how is it reported?
    2. How are users notified?
  3. Monitoring
    1. how is it performed?  Can you leverage existing infrastructure? 
    2. Who performs it?
    3. what are the boundries?  If there is a performance issue, how do you identify whether it is a cloud issue or a data source integration issue?
  4. Contracts
    1. Do you have adequate legal counsel to help in evaluating contracts so you are not left high and dry if a problem of any sort comes up?
      1. hosting company goes out of business
      2. hosting company raises rates beyond what is affordable
      3. hosting company can no longer meet your needs
      4. hosting company not adaptable to changing technology needs
    2. Cost model
      1. Are you able to account for all changes required by your organization and still determine that there is a real cost savings?
This last item should cause you to ask - if you are forced to leave a hosting company:
  • Can you get all your data out?
  • What format is your data available in?
  • How transportable is your application/service to some other cloud vendor?    Do you have to rewrite your application from scratch? 
 This is certainly not a comprehensive list of things to consider but is meant to cause people to pause and consider more than just the short briefs on cloud computing (and technology in general for that matter).  Every organization is different so decision makers must use knowledge, experience and common sense of  their own and from people with a proven track record that work for them.



Saturday, December 15, 2012

Scala for Java properties file conversion utility

Recently it was determined that it would be best for some of our custom applications to source their text (UI labels, messages, errors, etc) from a database than from text files.  The main application of interest uses ResourceBundles in many cases and has around 10 base bundle names which are translated (somewhat incompletely) into Spanish from the main English data.  There are around 3200 data items involved.  In a previous application, I was able to simply do some regex work in notepad++ and generate some SQL scripts to populate a database table being used to back up the resource bundles (via a customized ResourceBundle.Control class).

For the application at hand though, it seemed awkward after learning a few lessons from the previous application.  The solution I chose to follow instead was a simple Scala script.  Not trying to ruin the story but I will say that the end result is pretty nice.  It allows me to rerun the process without having to worry about missing steps as was the case when doing it by hand.

Why use Scala?  It seems more "composable"?  It definitely has less boilerplate code.  Was it faster to create this than a similar Java utility - maybe not.  Scala isn't my day to day language but you won't improve without working with it.  This was a low risk opportunity to improve my Scala skills.

import scala.io._
import java.io.{File, PrintStream}
import scala.util.matching.Regex

def getlang(file: File) : String = file.getName.lastIndexOf('_') match
{   
    case -1 => "EN"
    case x:Int => file.getName.substring(x+1,x+3).toUpperCase   
}

def getbasename(file : File) : String = file.getName.lastIndexOf('\\') match
{
    case -1 => file.getName.replaceFirst("_.+", "").replaceFirst("\\..+", "")
    case x:Int =>  file.getName.substring(x+1,  file.getName.lastIndexOf('.')).replaceFirst("_.+", "").replaceAll("\\", ".")
}
val myOut = new PrintStream(new File("C:\\<path>\\<app-id>-msgs.sql"), "UTF-8" );

myOut.println("set escape on")
myOut.println("set define off")
myOut.println("truncate table <app-id>_MSGS_TBL;")

val ignoreFiles = Set("conn.properties", "log4j.properties", "packtag.properties", "struts.properties");

for (file <- new File("C:\\<path>").listFiles.filter(f => """.*\.properties$""".r.findFirstIn(f.getName).isDefined).filter(f => !ignoreFiles.contains(f.getName())))
{    
    val lang = getlang(file)
    val basename = getbasename(file)
    try
    {
        for(line <- Source.fromFile(file, "Cp1252").getLines().filter(l => l.indexOf("=") != -1 && l.trim.charAt(0) != '#'))
        {       
            val key = line.substring(0, line.indexOf("=")).trim
            val v = line.substring(line.indexOf("=")+1).trim.replaceAll("'", "''").replaceAll("&","\\&");
           
            myOut.printf("Insert into <app-id>_MSGS_TBL(LANGUAGE,COUNTRY,VARIANT,BASENAME,KEY,VAL) values ('%s',' ' ,' ','%s', '%s', NVL(N'%s', N' '));\n", lang, basename, key, v);
        }
    }
    catch
    {
        case e:Throwable => println("-- Error with file:" + file.getName)
    }
}
Notes
  • Sorry the formatting isn't optimum.  
  • I purposely removed some path/file information directly related to my employer- so this example would need minor changes to run in a real environment.
  • The source properties files only existed in the root of the src code directory so I didn't have to worry about full Java package names or traversing sub-directories.
  • The script does escape single quotes and ampersands as needed.
  • The source English text was in the base bundle but I remap that to associate it with the English language.
  • The script ignores some non-text resource related files which I identified upfront.
  • This skips comment lines.
  • I coded the insert statement to never insert null into the val column since I defined it as non-null.  A single space was used in place of null.  This just fits our environment better.
  • Not a lot of error handling in place.
  • The original resource authors apparently used the cp1252 encoding instead of the expected iso-8859-1 encoding which caused some confusion briefly. 
  • Execution of the resulting SQL script identified issues such as duplicate property keys/values.  Each of those was researched and resolved manually (since some had different text for same key).