If patient age is null, exports fall over

Issue #120 resolved
Ed McDonagh created an issue

If an attempt to write a value that doesn't exist is made the the task exits.

Comments (25)

  1. David Platten

    Added some checks for missing data before they are used to populate arrays. My broken radiographic export now works. To make this fix watertight every field that is used in the arrays needs to have this check done on it. I will sort that at a later date. References issue #120.

    → <<cset 1cb0b1b56b8d>>

  2. Ed McDonagh reporter

    Attempting to create a nicer way of testing for objects existing, refs #120. @dplatten, can you take a look? I've only made the changes to DX csv export. It seems to work, however, I can't generate the error that should happen if something doesn't exist! The method doesn't work for the defs on the models.

    → <<cset 167a3b21185f>>

  3. Ed McDonagh reporter

    Taken return_if_exists out of dx_export and put it into tools/get_values.py as return_for_export. Added conversion to unicode, for both strings and decimals etc. Used the function for the common fields in the xlsx DX export, haven't done the per exposure fields yet. Refs #120. Added patient sex to the DX xlsx export, refs #235

    → <<cset 4af59b8c9ce4>>

  4. Ed McDonagh reporter

    I guess if the ObjectDoesNotExist thing is because the model instance hasn't been created, then there is no reason for that check to be in return_for_export. But the function might still be useful in turning everything into a unicode string - we've had problems with exporting decimals, hence the str() functions, but if we have non-ASCII characters in the text fields then maybe it is safer to turn everything into unicode?

    Thoughts @dplatten ?

  5. David Platten

    @edmcdonagh, I think this looks good. I'm going to expand your code so that it is used throughout the dx_export file, test it, and then commit it back.

  6. David Platten

    Finished updating the dx_export.py file with checks to ensure relationships exist before trying to use them. THIS IS NOT TESTED. References issue #120

    → <<cset d04a46074de0>>

  7. Ed McDonagh reporter

    Finished updating the dx_export.py file with checks to ensure relationships exist before trying to use them. THIS IS NOT TESTED. References issue #120

    → <<cset d04a46074de0>>

  8. Ed McDonagh reporter

    Corrected call to return_for_export for display name. Other calls in exportcsv and dx_export are fine. xlsx, rf_export and the nbsp version have yet to be modified. Refs #120

    → <<cset 731fa8b6f86f>>

  9. Ed McDonagh reporter

    Converted some of the al-data sheet db lookups to use the try/except approach, but not followed all the way through. The changes that have been done work. Refs #120. Changed copyright date to 2015.

    → <<cset 7de09cfc09e5>>

  10. Log in to comment