Friday, December 11, 2015

How Elixir is Transforming My Mind

Last month I presented a talk to Montreal.rb on Elixir - a language I have been exploring on and off over the last year. Like any good talk from a newbie, it contains bloopers, mis-information and whole lot of gusto. Watch it at your peril!


How Elixir is Transforming My Mind from Nicholas Henry on Vimeo.


Saturday, September 5, 2015

Recently Launched: Wardware 2.0

Over the last year I have had the pleasure to work with Airslie Ltd, a UK-based medical informatics company, and King's College Hospital (NHS Foundation Trust) to rewrite and extended their clinical observations and assessments system, Wardware®. Wardware enables the entry, analysis and display of Early Warning Scores and other patient datasets for clinical use locally or remotely on mobile and desktop computers. The application was originally built using PHP, sans framework, and the company who originally authored the application, Airslie, was motivated to rewrite it using an application framework. Their chosen framework was Ruby on Rails and they approached me to lead the development effort.

Mobile Desktop

Desktop and Mobile views of Patient Chart

Facilitating the National Early Warning Score (NEWS)

The pivotal component of Wardware is the Observations and Assessments module. This module implements a number of assessments, including a key assessment for patient health, the - National Early Warning Score (NEWS). Early Warning Scores (EWS) are used to "quickly determine the degree of illness of a patient". This is determined by the scoring of physiological parameters such as temperature, heart rate and blood pressure. The total score assigns a patient to a risk category and the appropriate response, based on a predefined protocol, is carried out.

Physiological parameters are recorded using a mobile device, the MioCare Tablet, at the patient's bedside. The patient's charts, such as the NEWS chart can be viewed either on a desktop or the mobile device. The application has been developed using a Responsive front-end framework, allowing a single UI to be used for both desktop and mobile devices.

An extendible platform for supporting different assessments

The Observations and Assessments module is designed to be extended. It is a platform for implementing other assessments by simply configuring the physiological parameters and the assessment's calculator. Beyond NEWS, the Wardware installation at King's College Hospital is currently configured for:

Key assessments summarized in configurable Wardboards and Charts

Key assessments scores for patients such as NEWS along with assessment frequencies and due times are summarized on the Wardboard.


Wardboard summarizing current admissions for a specific ward.

Assessments with a specific threshold (e.g. a NEWS score greater than two) are also summarized at a ward and site-wide level.

Observation and Assessment Charts are presented in three formats:

1. Graphical


2. Tabular with the most recent 20 observations


3. Tabular with all historical patient data paginated


A range of modules supporting a patient's tracking and analysis requirements

Wardware doesn't just support observations and assessments, it supports various tracking and analysis requirements to monitor a patient. Briefly these include:

  • Oxygen Delivery Management, including the tracking of patient oxygen concentration targets
  • Response Management, recording responses to assessments such as NEWS
  • Device Management for surgical and urinary devices. Device Management tracks insertion and removal of devices for a patient, including the recording of complications
  • Diarrhoea Management integrated with Stools based on the Bristol Stool type
  • Blood Products Management (e.g. RBC, FFP, Platelets)
  • Fluid Management tracking patient's fluid balance and reporting

Integrated admission management with the hospital's Patient Information Management System

Wardware's Admissions module completes the admission process by assigning patients to a bed in their designated ward. Admissions for wards are automatically populated through a custom module integrating Wardware with KCH's Patient Information Management System (PIMS) using the Health Level-7 (HL7) messaging format, "a set of international standards for transfer of clinical and administrative data between software applications".

And there's a lot more

There is a lot more detail I can go into, but this post is long enough. Here are some facets that I'll highlight here:

  • Authentication and Authorization Management
  • Patient search via bar code scan from admission bracelet
  • Business Continuity Programme (offline storage of patient obs)

Domain Modeling Challenges

In future blog posts I will discuss some of the interesting domain modelling challenges of this project and how I leveraged Martin Fowler's Analysis Patterns. His patterns for observations and measurements is based on his work with the Cosmos Clinical Process Model for the UK National Health Service.

Thursday, May 28, 2015

Learning OO Design through Design Patterns

Last week at Montreal.rb there was an open discussion on RailsConf held in Atlanta which I had attended this year. We discussed favorite talks, themes and general experiences. I prepared a few notes prompting folks to explore design patterns after seeing Sandi Metz's talk, Nothing is Something. Why?

In the first half of Sandi's presentation she presented an example of using the Null Object Pattern as an example of sending messages to resolve her adversion to conditionals. During this portion of the presentation, she made an interesting comment explaining how she (re)discovered this pattern herself and then presented it to her co-worker. Sandi's co-worker described as "being a little more well read", told Sandi that this pattern had a name, the "Null Object Pattern". (OK, so I've cheated a little here. Sandi discusses this in her Bath Ruby version of her talk, not in the RailsConf version.)

Sandi goes on to suggest that we don't need to solve specific problems ourselves, as others have already solved these for us. She doesn't mention this explicitly but I interpreted this as Design Patterns. It just requires a little bit of research and reading. But where to start?

Two Book Recommendations

The classic Gang of Four Design Patterns book maybe a little intermediating for some, I know I've never found it appealing. However, there are some good alternatives. I recommend two.

The first book that really helped enter the world of design patterns was Design Patterns Explained by Shalloway and Trott. As the sub-title suggests, "A New Perspective on Object-Oriented Design", explains design patterns in the context of good OO design.

Likewise, Head First Design Patterns, also describes design patterns in the context of OO design, connecting design patterns with principles such as "Encapsulate what varies" and "Favor composition over inheritance". The first chapter is a great example of presenting these principles first in an example, and then identifying it as the Strategy Pattern. It removes the notion of using a pattern for patterns sake and focuses the discussion on solving problems, using principles and proven solutions.

The Head First series of books maybe off putting to some. Personally I've never been attracted to the series, but the Design Patterns book they have published, I feel, is first class. The examples they use really stick in your head and a great lever for accessing the patterns in the future. I've also heard good things about the Object-Oriented Analysis and Design book as well, although I haven't read it. (If I remember correctly, I think Sandi mentioned this title when I attended her course in Durham; however I not suggesting this is an endorsement of the book by her.)

Don't fear patterns, use appropriately

So rather trying to solve problems that have already been solved, I recommend investigating Design Patterns and these books are a great introduction. Design Patterns in the past do have a bad rap in the Ruby community, but I think that is no longer the case as the community matures. The original adversion to design patterns maybe due to the overuse within the Java community. Please remember, each design pattern needs to be used appropriately, and always consider a simpler approach.

I believe these book recommendations would be a good follow-up to Sandi's book Practical Object-Oriented Design in Ruby, to help triangulate your understanding of OO design.

Let me know how it goes!

Sunday, May 24, 2015

Rebecca Wirfs-Brock on Object Design

Building an object-oriented application means inventing appropriate machinery. We represent real-world information, processes, interactions, relationships, even errors, by inventing objects that don't exist in the real world. We give life and intelligence to inanimate things. We take difficult-to-comprehend real-world objects and split them into simpler, more manageable software ones. We invent new objects. Each has a specific role to play in the application. Our measure of success lies in how clearly we invent a software reality that satisfies our application's requirements -- and not in how closely it remembers the real world.

-- Rebecca Wirfs-Brock, Object Design

I pulled this quote from Avdi Grimm's excellent keynote presentation, The Soul of Software as a reminder this very important idea on object-oriented design: that we invent new objects that don't have a corresponding object in the real world. If we limit our domain objects to those that are represented in the real world, we miss opportunities to encapsulate variation in behaviour within our application.

Friday, June 20, 2014

Talk: Don't Commit Your Secrets

On Tuesday this week, I presented a talk to Montreal.rb on keeping your application secrets safe. Posted below is the video, slides and some follow-up questions during and after the presentation. Enjoy!




How can I remove a secret from your Git repository?
GitHub has an excellent post on how to do this: Remove sensitive data. However, if you have committed a secret to your repository which has been push to a remote, then consider that secret compromised. You will need to reset the secret (i.e. create a new API key) and configure your application using the techniques described above.

How can I keep my secrets safe with an application pre-Rails 4.1?
Check out these options:

  • foreman: recommended - any Rack app
  • dotenv: great for plain old Ruby Gems too
  • figaro: YAML
  • capistrano: linking to a configuration file in production

Tuesday, April 22, 2014

Modeling on the Right Side of the Brain

Update: A transcript exists on Confreak's GitHub translations repository.

Update: The presentation is now online. Unfortunately the color has been washed out when the slides were filmed, so I highly recommend you follow along with the slide deck below. Enjoy!

If you attended my talk at RailsConf, Modeling on the Right Side of the Brain, thank you so much for your support and I hope you found the talk helpful. Embedded below are the slides for my talk and resources listed below that you will find helpful in learning more about Object Modeling.

If you have no idea what I'm talking about, here is the abstract from my talk that I gave at RailsConf 2014 in Chicago.

"Since your first web application, you have struggled with identifying domain objects. Assigning business rules and services appears to be a talent that only other developers are born with. Fear not! Object Modeling is a learnable, teachable skill. This talk demonstrates the five essential skills you need for modeling objects and their responsibilities. Think beyond ActiveRecord and your database, and learn how color and patterns will help you explain, maintain and extend your application."

While the book I referenced in the talk Java Modeling in Color with UML is no longer in print, it can be sourced from Amazon if you wish to purchase a used copy. However, there is an excellent on-line resource I highly recommend authored by Stephen R. Palmer titled Peter Coad's 'Modeling in Color' which will provide all you need to get started immediately.


Listed below are the three key books that got me excited (and continue to do so) about Object Modeling:

Java Modeling in Color with UML

Object Models: Strategies, Patterns, and Applications

Streamlined Object Modeling: Patterns, Rules, and Implementation

Online Resources

Peter Coad's 'Modeling in Color' authored by Stephen R. Palmer. As mentioned above, this is a great online resource to get you started today.

Streamlined Object Modeling is the book site hosted by one of the authors Mike Abney. While this is not a stand alone resource, as it does require the book to introduced some of the concepts discussed, it does provide you some insight on this specific approach buidling on Peter Coad's techniques.

If there is anything else you need, please feel free to contact me directly or leave a comment below.

Wednesday, October 23, 2013

Installation instructions for Quarto on OSX

I was trying out Avdi Grimm's Quarto a week or so back for ebook generation. The toolchain looks very promising, but has a few dependencies that need to be installed before you can start publishing. These are listed in the README.

Here's a quick guide in getting those installed on OSX (Mountain Lion). Note I already had the following setup:

  • Git
  • HomeBrew
  • pygentize
  • xmllinit

Command line instructions:

The big one here is to ensure ~/.cabal/bin is in your path when you run the rake task to publish.

Please note this blog is no longer maintained. Please visit CivilCode Inc - Custom Software Development.