Excel Export: AccessionNumber and PatientID with significant leading zero('s)

22 views
Skip to first unread message

luuk_o...@hotmail.com

unread,
Nov 8, 2016, 9:54:14 AM11/8/16
to OpenREM
Hi,

first of all: Thanks for this great tool!

I had an issue with exporting CT data to XLSX format.


Our PatientIds always have 8 digits, sometimes with leading zero('s). As patientIds are, by definition, strings the leading zero's are significant.

Our AccessionNumbers are even more interesting and are formed as nnnnnnn.nnnnnnnn (where n is a digit 0-9) and here also the AccessionNumber is a string.

Converting these to XLSX with Openrem completely ruins the accessionNumber (as we are using a comma as decimal separator and a dot as thousands separator).

So I made some changes to xlsx.py. The main changes are:
- workbook is created with 'strings_to_numbers' set to false
- The str() conversions in _ct_get_series_data are removed
- float-conversions are added to the return_for_export() of float types (if not None)
- The columns for PatientId (if exists) and accessionNumber are set to text-format (although this seems unnecessary)

This results in a XLSX-document that keeps PatientID and AccessionNumber in text-format and all other numbers are kept as numbers.

If you like I can send you the adapted xlsx.py.

Best regards,

Luuk

Ed McDonagh

unread,
Nov 8, 2016, 4:39:28 PM11/8/16
to OpenREM, luuk_o...@hotmail.com
Hi Luuk

Thanks for the feedback. Could you fork the bitbucket repostory and show me your changes there? Don't worry if that isn't something you are comfortable with though - you can send your version direct instead :-)

Kind regards

Ed

Luuk Oostveen

unread,
Nov 9, 2016, 2:58:34 AM11/9/16
to Ed McDonagh, OpenREM

Hi Ed,


The most easiest way (for now) is sending you the file (see attached). The same should actually be done for the DX en RF exports. But as I don't have DX in the database and RF is not working due to Issue442, I won't try to change it now.


Sometimes you need to be a bit uncomfortable to learn something....Suppose I want to work on issue442, do I need to do the following in Sourcetree (not used to work with git repositories nor with bitbucket / sourcetree)

(I try to use their terminology)?

1. Clone the repo

2. Pull remote branch issue442RFfilterexports

3. Apply changes to the file (rf_export.py)

4. Pull local branch to remote issue442RFfileterexports branch


I could have done the same for this file, but I needed to create a branch instead of pulling it. Correct?


Best regards,

Luuk




Van: Ed McDonagh <e...@openrem.org>
Verzonden: dinsdag 8 november 2016 21:39
Aan: OpenREM
CC: luuk_o...@hotmail.com
Onderwerp: Re: Excel Export: AccessionNumber and PatientID with significant leading zero('s)
 
xlsx.py

Ed McDonagh

unread,
Nov 9, 2016, 3:49:51 AM11/9/16
to Luuk Oostveen, OpenREM
Thanks for the file. I'll create a ticket for it and take a look at your changes.

I haven't worked with Sourcetree either - I normally work on Linux with git in a shell and using PyCharm as a development environment including the git tools in there. But it should be the same, and has the advantage of the bitbucket tutorials to help you.

I would say the process would be as follows - your terminology was nearly correct:
1. Fork the OpenREM repo (will become LuukO/OpenREM)
1. Clone your version of the repo
2. Check out branch issue442RFfilterexports
3. Apply changes to the file (rf_export.py)
4. Commit changes, with a comment and preferably with the phrase 'refs #442', as that will link the commit to the issue ticket
5. Push your changes (will be to your fork of the repo)
6. Send me a pull request using the bitbucket website, ensuring that you select the issue442RFfilterexports branch as the destination in the original OpenREM/OpenREM repo.

For the changes to xlsx.py, it would be pretty much the same process. Ideally, you would branch from an existing branch (normally develop) and work in your new branch. This is the step I have already done with the issue442RFfilterexports branch, and if you fork the repository you'll get all the branches with it.

Thanks for contributing! 

Kind regards
Reply all
Reply to author
Forward
0 new messages