# The value of hierarchy\_root\_url couldn't be bulk-imported

**URL:** <https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139>\
**Category:** General\
**Tags:** ocl\
**Created:** [April 1, 2025, 8:25am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139 "2025-04-01T08:25:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![forest](https://chat.openconceptlab.org/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@forest](https://chat.openconceptlab.org/u/forest)\
**Post date:** [April 1, 2025, 8:25am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/1 "2025-04-01T08:25:19Z")

</div>

Source concept hierarchy:

```auto
Root Food
    C1 Vegitables
        C1.1 Greens
    C2 Fruits

```

* * *

The value of `hierarchy_root_url` in the [my demo Source](https://app.openconceptlab.org/#/users/forest/sources/DemoFoods/) couldn’t be bulk-imported using the Bulk Import panel on the OCL Online.

In my json lines file:

```json
"hierarchy_root_url": "/users/forest/sources/DemoFoods/concepts/Root/",

```

But it’s null in the download of the source metadata:

```json
"hierarchy_root_url": null,

```

---

<div class="post-metadata">

**Author:** ![forest](https://chat.openconceptlab.org/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@forest](https://chat.openconceptlab.org/u/forest)\
**Post date:** [April 1, 2025, 9:00am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/2 "2025-04-01T09:00:44Z")

</div>

The `child_concept_urls` of [the concept `Root`](https://api.openconceptlab.org/users/forest/sources/DemoFoods/concepts/Root/) are also missing after bulk-import:

```auto
"child_concept_urls": [
		"/users/forest/sources/DemoFoods/concepts/C1/",
		"/users/forest/sources/DemoFoods/concepts/C2/"
	]

```

Meanwhile, the `parent_concept_urls` and `child_concept_urls` for the other concepts are OK.

---

<div class="post-metadata">

**Author:** ![jamlung](https://chat.openconceptlab.org/user_avatar/chat.openconceptlab.org/jamlung/32/10_2.png) [@jamlung](https://chat.openconceptlab.org/u/jamlung)\
**Post date:** [April 1, 2025, 3:09pm UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/3 "2025-04-01T15:09:56Z")

</div>

> [@forest](#):
>
> The value of `hierarchy_root_url` in the [my demo Source](https://app.openconceptlab.org/#/users/forest/sources/DemoFoods/) couldn’t be bulk-imported using the Bulk Import panel on the OCL Online.
> 
> In my json lines file:
> 
> `"hierarchy_root_url": "/users/forest/sources/DemoFoods/concepts/Root/",`

This is a known bug, unfortunately. See [JSON Bulk Import Gaps · Issue #856 · OpenConceptLab/ocl\_issues · GitHub](https://github.com/OpenConceptLab/ocl_issues/issues/856).

My current workaround is to use a PUT API call to apply a `hierarchy_root_url` to an existing source (which has already been imported via Bulk Import). Example below with the PUT statement and the body as JSON:

```auto
PUT https://api.openconceptlab.org/orgs/Regenstrief-Institute/sources/LOINC-3/

{"hierarchy_root_url": "/orgs/Regenstrief-Institute/sources/LOINC-3/concepts/ROOT/"}

```

---

<div class="post-metadata">

**Author:** ![forest](https://chat.openconceptlab.org/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@forest](https://chat.openconceptlab.org/u/forest)\
**Post date:** [April 1, 2025, 10:14pm UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/4 "2025-04-01T22:14:42Z")

</div>

@jamlung Great! Thanks.

---

<div class="post-metadata">

**Author:** ![forest](https://chat.openconceptlab.org/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@forest](https://chat.openconceptlab.org/u/forest)\
**Post date:** [April 2, 2025, 7:55am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/5 "2025-04-02T07:55:00Z")

</div>

Hi, @jamlung . The key-value for `hierarchy_root_url` has been successfully added to [my demo source](https://app.openconceptlab.org/#/users/forest/sources/DemoFoods/) with the workaround you suggested.

 ![image](https://chat.openconceptlab.org/uploads/default/original/1X/605f296f4d37cbf44ac862d04dd9c2b725bf7e9b.png)

But how to add the following `child_concept_urls` to [the concept `Root`](https://api.openconceptlab.org/users/forest/sources/DemoFoods/concepts/Root/) ?

```auto
"child_concept_urls": [
		"/users/forest/sources/DemoFoods/concepts/C1/",
		"/users/forest/sources/DemoFoods/concepts/C2/"
	]

```

* * *

When the request has the body:

```auto
{
    "child_concept_urls": [
		"/users/forest/sources/DemoFoods/concepts/C1/",
		"/users/forest/sources/DemoFoods/concepts/C2/"
	]
}

```

The response is:

```auto
{
    "names": [
        "A concept must have at least one name"
    ]
}

```

* * *

If using the full import json line of the concept `Root` as the request body, the missing `child_concept_urls` also couldn’t be added although the response is `200 OK` and returns the updated concept `Root`.

* * *

What’s next then?

Thanks.

---

<div class="post-metadata">

**Author:** ![jamlung](https://chat.openconceptlab.org/user_avatar/chat.openconceptlab.org/jamlung/32/10_2.png) [@jamlung](https://chat.openconceptlab.org/u/jamlung)\
**Post date:** [April 2, 2025, 12:03pm UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/6 "2025-04-02T12:03:18Z")

</div>

Oops, I wrote this reply and forgot to submit it. 😅

> [@forest](#):
>
> The `child_concept_urls` of [the concept `Root`](https://api.openconceptlab.org/users/forest/sources/DemoFoods/concepts/Root/) are also missing after bulk-import:
> 
> ```auto
> "child_concept_urls": [
> "/users/forest/sources/DemoFoods/concepts/C1/",
> "/users/forest/sources/DemoFoods/concepts/C2/"
> ]
> 
> ```
> 
> Meanwhile, the `parent_concept_urls` and `child_concept_urls` for the other concepts are OK.

One potentially helpful tip here: OCL implies the `child_concept_urls` using the `parent_concept_urls`. If all of your child concepts have a `parent_concept_urls`, then OCL will auto-create the `child_concept_urls`.

Meaning, I only specify parent concept URLs in my bulk import files, not child concept URLs

---

<div class="post-metadata">

**Author:** ![forest](https://chat.openconceptlab.org/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@forest](https://chat.openconceptlab.org/u/forest)\
**Post date:** [April 2, 2025, 12:16pm UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/7 "2025-04-02T12:16:14Z")

</div>

@jamlung , thanks a lot! Ah…I will check it out tomorrow.

> [@jamlung](#):
>
> Meaning, I only specify parent concept URLs in my bulk import files, not child concept URLs

This operation is not working, even leading to more parent-child relationships lost.  
In addition, PUT or Patch operations for a Concept are also not able to add the parent-child relationships lost.

---

<div class="post-metadata">

**Author:** ![forest](https://chat.openconceptlab.org/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@forest](https://chat.openconceptlab.org/u/forest)\
**Post date:** [April 3, 2025, 2:25am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/8 "2025-04-03T02:25:32Z")

</div>

@jamlung  
It was found that, when a concept id has a value “Root” or “TempRoot” (maybe other strings), it would lose its parent-child relationships, including `parent_concept_urls` and `child_concept_urls`. On a whim, the root concept id was tentatively changed from “Root” to “C”, the bulk import successfully completed and didn’t lose the parent-child relationships. Meanwhile, the temporary concept “TempRoot” still lost the expected parent-child relationships. **Haha…** So it seems that the bulk import process is **a bit picky about the `id` string** of the concept. **Any rules about concept `id` value?**

 ![image](https://chat.openconceptlab.org/uploads/default/original/1X/bad84102d9e92cc4d0b7ed3f6e5962b4469d4c06.png)

---

<div class="post-metadata">

**Author:** ![forest](https://chat.openconceptlab.org/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@forest](https://chat.openconceptlab.org/u/forest)\
**Post date:** [April 3, 2025, 2:31am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/9 "2025-04-03T02:31:33Z")

</div>

Perfect show 😅

 ![image](https://chat.openconceptlab.org/uploads/default/original/1X/b370abd913907e2f21a4ac823121e1e72b7e967d.png)

---

<div class="post-metadata">

**Author:** ![jamlung](https://chat.openconceptlab.org/user_avatar/chat.openconceptlab.org/jamlung/32/10_2.png) [@jamlung](https://chat.openconceptlab.org/u/jamlung)\
**Post date:** [April 3, 2025, 11:50am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/10 "2025-04-03T11:50:37Z")

</div>

@Sny Would there be any rule about the term “root” being part of the concept ID?

---

<div class="post-metadata">

**Author:** ![Sny](https://chat.openconceptlab.org/user_avatar/chat.openconceptlab.org/sny/32/112_2.png) [@Sny](https://chat.openconceptlab.org/u/Sny)\
**Post date:** [April 7, 2025, 4:43am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/11 "2025-04-07T04:43:57Z")

</div>

@jamlung I dont think so

---

<div class="post-metadata">

**Author:** ![forest](https://chat.openconceptlab.org/letter_avatar_proxy/v4/letter/f/f1d935/32.png) [@forest](https://chat.openconceptlab.org/u/forest)\
**Post date:** [April 7, 2025, 8:05am UTC](https://chat.openconceptlab.org/t/the-value-of-hierarchy-root-url-couldnt-be-bulk-imported/139/12 "2025-04-07T08:05:43Z")

</div>

Agree. Because I’ve searched the OCL github repo although I don’t actually understand the source codes completely yet. Thanks, @Sny .
