Adding a Python Script to Remove the Leading Zeros
To remove the leading zeros from the Patient ID:
Double-click the PID - Patient Identification segment in the Workspace. The PID Segment Definition appears.
Locate Field 3 - Patient Identifier List.
PID Segment Definition
Click the Inbound Script ellipsis button. The Editing Script window appears.
Copy the following script, and paste it into the Editing Script window.
value = strip_leading_chars('0', value)
Click OK to save the script. You will notice that the PID segment has an asterisk beside its name in the Workspace. This indicates that a PID segment field has an associated Python script.
PID Segment, Showing it Contains an Associated Python Script
The next step is to test all the changes you made using the Message Browser. This will confirm that the Magic Hospital message will be parsed correctly.