When working with Nemsis XML you very quickly discover that many of the fields are numeric codes instead of normal names and addresses.

In the image below there is a sample patient. Some of the elements are human readable. Notice with ePatient.14 that there are two values with seven digit codes.

What does "2514009" mean?

These are codes which must be referenced by using a Nemsis dictionary file. We will work with Nemsis dictionaries in this article.

Source Data

Nemsis downloads are located at http://nemsis.org/v3/downloads/index.html

I will be using the Test Cases & XML Samples and the Dataset Dictionaries.

The Dataset Dictionaries are located here http://nemsis.org/v3/downloads/datasetDictionaries.html

Nemsis Element List

The Nemsis element list is data separated by vertical bars. The first line is the header definition. There are 2,944 lines in the file Combined_ElementEnumerations.txt.

'DatasetName'|'ElementNumber'|'ElementName'|'Code'|'CodeDescription'|

'DEMDataSet'|'dCustomConfiguration.03'|'Custom Data Type'|'9902001'|'Binary'|

'DEMDataSet'|'dCustomConfiguration.03'|'Custom Data Type'|'9902003'|'Date/Time'|

'DEMDataSet'|'dCustomConfiguration.03'|'Custom Data Type'|'9902005'|'Integer/Number'|

'DEMDataSet'|'dCustomConfiguration.03'|'Custom Data Type'|'9902007'|'Other'|

'DEMDataSet'|'dCustomConfiguration.03'|'Custom Data Type'|'9902009'|'Text/String'|

'DEMDataSet'|'dCustomConfiguration.03'|'Custom Data Type'|'9902011'|'Boolean'|

Source Code

The source code for these examples is available on my GitHub page https://github.com/twodawg/NemsisDictionary

The project is written in Visual Studio 2017 using a .NET Core 1.1 Console application.

Execution beings in Program.cs. I begin by populating a local variable elementEnumerations. This contains by Nemsis dictionary data.

Lookup Class

I use a Lookup class to import all the data from the Combined_ElementEnumerations.txt file.

I define a file path where the target file will be found. I use File.ReadAllLines to load all the data into a string array named enumerationArray. Next a results List collection is used to return the values.

Element Enumerations

I use a custom type named ElementEnumerations to store the data as these property names. The names, ordering, and types must match the dictionary file headers.

Parse Line

Each line in the Nemsis dictionary file is parsed by this function. I used string methods to trim and split each row into a string array. I use these values to create the ElementEnumerations. System.Linq is used to skip columns and pick either the first or last records.

Example Program

Navigating back to the Program.cs file, we write a simple example demonstrating the capability added. The lookups are loaded into memory which is queried using System.Linq. Codes from the Nemsis XML sample can be entered and the values are returned.

Example Output

The results of the program show the code 2514009 is the patient race of Native Hawaiian or Other Pacific Islander.

Support

Has this post been useful to you?

Support me via a PayPal donation http://epcr.allcode.net/donation

Share this article to social media:

Tweet