kevingill1966/python-hl7 — pull request #1 by e2jk (2012-10-15 18:59:53+00:00)
Title: HL7 spec numbering

You have implemented support for Repetitions, Components and Sub-components, as well as a method for simple access via path. The numbering used for that method conforms to the numbering used by the HL7 standard, however the numbering for accessing the information through the lists (like `msg[A][B][C][D][E]` don't.

The numbering is mixed: `A`, `C`, `D` and `E` use a 0-based numbering, whereas `B` uses 1-based numbering. This means that:
```python
msg["PID.3.1.2.2"] == msg[1][3][0][1][1]
```

This pull request corrects this and makes all elements (except the segment index `A`, which stays 0-based) 1-based. That way:
```python
msg["PID.3.1.2.2"] == msg[1][3][1][2][2]
```

This is accomplished by adding an empty element `u""` at the beginning of each list when creating a new item or assigning it, and removing that first element when displaying the item with `unicode()` or accessing it via a path. Granted it is using a bit more storage space, but that cost is well worth it for easy-to-use numbering that is coherent with the HL7 standard.

I'm first sending the pull request to you, as you added the support for these fields. The ultimate goal is to have it merged "upstream", i.e. in the `johnpaulett/python-hl7` repository.

Thanks for your work on expanding this useful library by adding in those needed features.