---
# System prepended metadata

title: OD-1156 Investigating ordering of child data profiles

---

# OD-1156 Investigating ordering of child data profiles

The goal is to be able to reorder the position of sibling data profiles within the hierachy on the description tab of the data profile.

![](https://i.imgur.com/IE41M4h.png)

## Option 1: Custom Ordering

In this case, the goal is to be able to easily rearrange the order in which sibling data profiles are displayed for example by dragging each sibling data profile.
The main challenge at the frontend with this option is how to display the drag feature within the ui.

* The recommended approach would be to implement something similar to what is currently being done with the resources:

    ![](https://i.imgur.com/GADQP2N.png)
    
    A new tab can be created where all the children of a data profile are listed, and can then be re-ordered.

* Another option here would be to select the children instead of the parent within the relationship instead of the parent. This approach is not recommended as it would affect the user experience.

    ![](https://i.imgur.com/3IEP5bq.png)




### Backend Implementation methods

> :warning: If there are going to foreign keys linking any columns in the `package_relationship` or `package_relationship_revision` tables, ensure that these foreign key relations are removed when the dataset is deleted or purged.

> Whatever methods being implemented should not break the ordering if there is no position value within the db.

#### Method 1
One way of implementing this in the backend would be add a `position` column to the `package_relationship` and `package_relationship_revision` tables.
An helper method can then be added to ensure that the relationships are sorted according to their position.

#### Method 2
Another method would be to create a seperate table for the relationship positions, and then sort them the way they would have been done in the previous method.


## Option 2: Predefined Selectable ordering

In this case, the goal is to defined the ways the dataprofile can be ordered depending on the data profile properties. For example, they could be ordered alphabetically (either ascending or descending), etc.

This option does not require that the state be stored in the db and would take significantly less time than the previous option. There is also the problem of where to put the sort options within the ui. It could be a drop down above the hierachy description.

Helper methods can be written to sort according to a particular dataprofile property. Since there would probably not ne a need to store the state of the relationship order, this can also be implemented directly with javascript.

If this option is be taken, a list of the sort opions would be required, for example, in alphabetic order, date created, etc.