Creating Entities

Dear ODK team ,

We tried to create entities using api , by documentation while creating an entity it says we should provide uuid and label along with user-defined fields . we have 4000+ entites that has been created by this endpoint for a project .

We also know that now we have ability only to soft delete entites .

We want to create those 4000+entities along with new other entites for a newer project . we were able to create newer entites , but those 4000+ records we are having issues while creating because its already there but mapped to an older project.

Is there any way to generate uuid automatically ?
Can we completely purge the entites so that we can create it for the newer project ?
Can we migrate these entites to newer project based on uuid ?

Hi @Arunbala,

I'm sorry you are running into this problem!

Unfortunately, entity UUIDs are currently (v2023.3 and earlier) required to be unique across an entire install of Central. Your situation is a good example of why it would be useful to have the UUIDs just be unique within a project. I will discuss this possible change with the rest of the Central team.

Also, unfortunately, there isn't yet a way to purge entities (except by working directly with the database. (If you do this, please make sure to back up your data first.)) It is important and it is something we are planning to add.

Central also isn't yet set up to generate its own UUIDs for entities, but it is something we have been discussing.

Sorry to have you wait for these improvements! In the mean time...

How are you accessing the API? What language, are you using a client like ruODK or pyodk? Could you generate a new UUID for each entity when you upload it? For example, if you were using python, you could use this code to make a new version 4 UUID and there is likely a similar uuid generator utility if you are in a different language:

import uuid
myuuid = uuid.uuid4()

Hi @ktuite ,

Thanks for the reply . We did purged the entities of older project through database only . It went well and worked as expected .

We have a custom node/fastify application that we are using for accessing the api.