Issue #120 resolved

If patient age is null, exports fall over

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. David Platten, 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 David Platten ?

  5. Log in to comment