Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a to_dict() method to Element #22

Open
prschmid opened this issue Nov 7, 2016 · 1 comment
Open

Add a to_dict() method to Element #22

prschmid opened this issue Nov 7, 2016 · 1 comment

Comments

@prschmid
Copy link

prschmid commented Nov 7, 2016

Many times it's easier to quickly view the contents of an HL7 message in a dictionary format (or convert it to JSON). It would be great if there was a simple to_dict() method on Element that would recursively "do the right thing" and call the to_er7() method while retuning that contents as a dict. I've written some helper methods that I have used for my use case, that could relatively easily be adapted to this use case:

https://gist.github.com/prschmid/801e86891026a39b1fb4df7178828321

Let me know if you have any questions, or if you would like this as a pull request.

@n-mcf
Copy link

n-mcf commented Nov 30, 2019

Ideally this would be a to_json() method. Many elements in HL7 can repeat and thus would need to go into an array instead of a direct dictionary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants