Should you require any more information or have encountered a problem, please call the support helpdesk on (07) 5456 6000.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

 

This tutorial will build on the GELLO coding introduced last time, with the calculation of an age for our test patient, the adding of clinical data to the test file, the importing of that data into the editor and then looking at the implies method for the first time.

Type or cut and past the following code:


Context HL7_v2_VMR_V1::SinglePatient
          patient.dob

Run it and choose the firstTest.xml patient file from the last tutorial:

 

We can see the date of birth is the 21st June 1955, but lets now calculate the patient's age. Assign the retrieved date of birth to be a local variable so that we can calculate with it:

Compile this and note the error message (not again this will run however). Yes, GELLO is strongly typed and the editor is suggesting the type for the local variable, so add it in. The line becomes: 


         Let dob: TS = patient.dob


We don't worry about the second message saying there is no final expression as we can say that at the end - this returns what it is we actually want - i.e. the age; and we will get to that. So here is where we up to:

 

Notice that it says _Result_ is null, again this is because we have no final expression line as yet.
Add in this code which includes the required final expression:


          Let ageInSeconds: PQ = factory.TS('today') - dob
          Let ageInYrs: PQ = ageInSeconds.convert('yr')
          ageInYrs

 

Don't worry too much about the actual code here, but it involves the use of the factory class and a method that converts units.

Unfold on the _Result_ and notice that this Physical Quantity (PQ) typed result has both a unit and a value:

 

It is best to use PQ variables in GELLO instead of just getting the value out as a Real typed variable, eg for laboratory results, as sometimes units change with lab tests and you don't want to be caught out with 'apples and oranges'! [eg think about the two following measurements: 2 cm and 0.7874016 inches. They are the same measurement in fact; but if we just wrote code using the units, 2 does not equate to 0.7874016]


The good thing about using PQs is that you can perform mathematical operations on them. The full list of methods the class understands can be seen in the editor, by looking in the Model Explorer like we did for the CD type (remember GELLO is Object oriented):

 

--------------------------------------------------------------------------------------------

Reading Test Data


Ok, next we will move on to how we load up our test data for a GELLO editing session. This is easily done by opening the ModelExplorer pane ( fold up the PQ and the iso_21090_datatype pqackage if you are still there) and unfolding on the HL7_v2_VMR_V1 package again. Go down to the SinglePatient node and right click on this. Choose the Read Test Data for class option and then choose our firstTest.xml file. This loads up the instance data for the model, which can be viewed in the data Explorer.
---------------------------------------------------------------------------------------------

The implies method

 

 

 

  • No labels