From 1533f114af2dab5db12fabcb791a04b2463f80b5 Mon Sep 17 00:00:00 2001 From: yibeichan Date: Fri, 19 Jan 2024 11:55:14 -0500 Subject: [PATCH] get unique order --- reproschema/redcap2reproschema.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reproschema/redcap2reproschema.py b/reproschema/redcap2reproschema.py index 47473cb..a2c5596 100644 --- a/reproschema/redcap2reproschema.py +++ b/reproschema/redcap2reproschema.py @@ -248,6 +248,10 @@ def create_form_schema( matrix_list, scores_list, ): + + # Use a set to track unique items and preserve order + unique_order = list(dict.fromkeys(order.get(form_name, []))) + # Construct the JSON-LD structure json_ld = { "@context": schema_context_url, @@ -258,7 +262,7 @@ def create_form_schema( "schemaVersion": "1.0.0-rc4", "version": "0.0.1", "ui": { - "order": order.get(form_name, []), + "order": unique_order, "addProperties": bl_list, "shuffle": False, },