Move Patient Name(s) from First Name field to Last Name Field

  • Hi,


    I assume the name is stored like first^last. In any case you can use lua string processing to fix this. When does the issue occur? Is it after a query or after it loads images for display.


    In one case you can add e.g. in dicom.ini (untested)


    [lua]

    QueryResultConverter0 = string.find(Data.PatientName or '', '^%^') then Data.PatientName = string.gsub(Data.PatientName or '', '^%^', 'unknown') end


    Look for lua pattern matching to understand what goes on ('^%^' matches ^ on begin of string, while '%^$' matches ^ at end of string). In the other case you can do this in RetrieveResultConverter0.


    Marcel

  • Thanks Marcel for your reply.


    The issue is that the viewer does not display patient name unless Last name is populated.


    With Both first and last name entered (usually at modality equipment), the viewer will display LASTNAME Firstname,


    However, when all the names are entered in first name field, The name column is blank when returning query results from server.


    Is there a way to sort this out using dicom.ini? Because when the name is edited, moving the names to last name field, all is well.


    Thanks.

  • Hi,


    using string processing like this, you can with:


    ImportConverter0: modify images after reception prior to storage and database update

    QueryResultConverter0: modify query results without change in database

    RetrieveResultConverter0: modify images prior to sending, without changing them on disk


    So conquest is flexible enough. Learn a bit of lua and write a simple program to modify the string, you can then call this program from any of these events using dofile('filename'), or as in my example just put the actual code in dicom.ini


    Marcel

  • I quick one:


    I would like to use ImportConverter to remove "^" if exists as first character in PatientName.


    How would I frame the second part of the converter to remove the character?

  • This below would do it, replace a ^ (written as %^) at begin of line (written as ^) with nothing. The or '' bit is to avoid an error if Data.PatientName is empty.


    Data.PatientName = string.gsub(Data.PatientName or "", "^%^", "")


    ' and " behave the same in Lua.


    Marcel

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!