Download the concept dictionary in CSV format

I am having a problem getting around this I dumped a concept dictionary from an existing OpenMRS instance and uploading it seems to work fine because searching concepts seems to work. select count(*) from concept where retired = 0 returns the approximate number of expected concepts.

The problem comes when I try to view/download my concept dictionary as a CSV file… The file generated only has header rows. with no concepts…

tailing logs/catalina.out shows: ERROR - DownloadDictionaryServlet.doGet(164) |2016-05-16 16:30:23,641| Error while downloading concepts. org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.openmrs.User#59]

many thanks. @darius @akanter @kasiiti @dkayiwa

Is it possible these rows have a USER ID not present in the other distribution? I usually change all of the user IDs to 1 for Admin when I distribute the CIEL concept dictionary by SQL.

Andy is correct, the problem is that one of your rows in concept (or concept_name, or some other concept_* table) has a creator, changed_by, or voided_by, or retired_by whose value is 59 but you have no row in the users table with user_id = 59.

(You need to either change the values in the concept* tables, or else create a user with that user_id.)

Thanks @darius Could there be a simpler way of doing this? I think I need find the concept* table with this ID. Or does changing the ID of some user to this one (59) complicate data integrity in the database since its a primary key.

I assume that you already did something that violates the databases strict integrity (either deleting a bunch of data but keeping concepts when switching from testing to production, or maybe you moved the concept dictionary from one implementation to another).

So it’s likely that you’ll find more problems than just this one. (The error message is only reporting the first.)

Your options at this point are:

  1. Add any missing users back
  2. Switch any concepts that refer to missing users so they point to an existing user (e.g. user_id=1)

The shortcut for #2 is to just update all of the non-null creator, changed_by, voided_by, retired_by columns to have the value 1 (assuming you still have that user).

I have the user with ID 1 not sure how to update all of the non-null creator attributes though. some sql pointers would be real helpful :slight_smile: