How to sort concepts by id from OCL API

Hey there,

I’m looking for a way to get the latest concept ID in the BHGO dictionary.

The sortAsc parameter does not order appropriately and it appears to return concepts in random order.

When I use this url, https://api.openconceptlab.org/orgs/bandahealth/sources/BHGO/concepts/?sortAsc=id&verbose=true, I expect to get the first concept with ID 725 but this is not the case.

Thank you.

Andrew

Anyone who might point me in the right direction? :slight_smile:

Hi @amoko! Sorry I missed your first post, so thank you for sending a follow-up. :slight_smile:

I also couldn’t get the ID sorting to work in the BHGO source. @Sny Is this a bug?

Here are the API parameters I tried (copied from TermBrowser):

1 Like

There is a sorting bug that makes sorting in-effective when no search criteria is provided. Thats, fixed on staging and blocked from being released on production due to some other changes which are in testing.
I will update here once its released on production.

2 Likes

Sounds good. Keep us posted :slight_smile:

Andrew

1 Like

Allow me to provide some context: I’m utilizing the bulk import feature to upload concepts and mappings. It would be helpful to have the capability to identify the last ID, which will be incremented in the upload CSV file. Unless OCL provides a custom ID generator feature?

Thanks

Oh! Actually we do have that ID generator feature, as long as you’re okay with using simple sequential numbers. Here’s an example source (link and see screenshot below) where I turned on OCL’s ID autoassignment. Now, when I load concepts via bulk import or make them in the TermBrowser, OCL will assign IDs to them when created.

One caveat though - I would advise against doing more than one bulk import if you choose to use this method. Otherwise, OCL might create duplicate concepts with different IDs. Happy to clarify further if needed!

2 Likes

This is exactly what I needed. You can’t imagine how much it simplifies our tasks.

Thanks a bunch!

1 Like