Adding a lab result

<< Click to Display Table of Contents >>

Navigation:  Technical documentation > Importing data >

Adding a lab result

Previous pageReturn to chapter overviewNext page

The import routine is used by FastTrak to import labdata, but other applications may also use this feature.   Adding labdata is done with a call to the AddLabData procedure.

 

EXEC AddLabData 233, '2008-12-31 14:33:00', 'S-Cholesterol', 7.2, 2, NULL, NULL, 3444

 

This is the definition of the procedure, as extracted from the FastTrak database.

 

PROCEDURE AddLabData( 

  @PersonId INT, @LabDate DateTime,

  @LabName varchar(40), @NumResult FLOAT,

  @DevResult INT = NULL, @TxtResult Text = NULL,

  @Comment Text = NULL, @BatchId INTEGER = NULL )

 

 

Parameter

NULLABLE?

Comment

PersonId

NOT NULL

The Person this labdata is for

LabDate

NOT NULL

The date the sample was taken

LabName

NOT NULL

A name for this lab test, for example "S-Cholesterol"

NumResult

NULLABLE

A numeric result, you may use NULL if the result has numeric data.

DevResult

NULLABLE

0 = Normal result, 1 = Below normal range, 2 = Above normal range, 3 = Outside normal range.  If normality is unspecified (i.e. you don't know if this is a normal result or not), use NULL.

TxtResult

NULLABLE

A text representation of the result, for example "Negative"

Comment

NULLABLE

An optional comment about this result

BatchId

NULLABLE

A valid BatchId, enforced with a foreign key constraint to the ImportBatch table.

 

Comments

If there is is no data (NumResult and TxtResult are both NULL), nothing will happen.  There will be no error message, and no data written to the LabData table.  It is also recommended to use parameterized queries, to reduce problems with DateTime values.