Mapping: main()
Contents
The next step is to examine the main()
function, which is the first function that the Iguana Translator calls when it starts to run your script. The main()
function drives your program, everything starts from here. The rest of your scripts simply define the tasks that main()
is in charge of executing.
In this example script, main()
is passed the variable Data
, which contains the message data that we want to process.
Notice that main()
also calls another function, MapData()
. This function performs the actual work of mapping the data, and is defined further down in our code.
The box that appears to the right of the main()
function is an example of an annotation. Annotations indicate what information from the sample data is being accessed in the adjacent code. In other words, you can see how your code works with message data in real-time. For this particular main()
function, the annotation displays what is stored in the Data
variable (the entire sample message).
Tip: When writing script code, we suggest that you use short variable names (such as T
, shown in the example above). This makes your code more compact, leaving more space to display annotations.
Next Step?
Now you understand the purpose of the main()
function. Next we will examine MapData()
, the first function that main()
calls, and learn how it parses incoming HL7 messages using hl7.parse()
and db.tables()
.