From 48247ad8a4d7680f4911036b2a8d59a5a9aa359f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Tue, 14 Feb 2023 22:04:46 +0100
Subject: [PATCH] wip

---
 integrationtests/test-profile/profile.yml |  2 +-
 src/bids-cfood/cfood.yml                  | 30 +++++++++++------------
 src/bids-cfood/model.yml                  | 29 ++++++++++++++++++++--
 3 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/integrationtests/test-profile/profile.yml b/integrationtests/test-profile/profile.yml
index 2c28573..ee66919 100644
--- a/integrationtests/test-profile/profile.yml
+++ b/integrationtests/test-profile/profile.yml
@@ -22,7 +22,7 @@ default:
     # list of `NAME: PATH` pairs or a single path.  
     extroot:
     #  "": "paths/extroot"
-      "": "../../unittests/test_data/valid_dataset/"
+      "": "../../bids-examples/"
     #
     #  "base": "/path/to/base/dir"
     #  "other": "/path/to/other"
diff --git a/src/bids-cfood/cfood.yml b/src/bids-cfood/cfood.yml
index 3123de1..4866654 100644
--- a/src/bids-cfood/cfood.yml
+++ b/src/bids-cfood/cfood.yml
@@ -175,6 +175,9 @@ Converters:
     BIDSFUNCDirectory:
       package: bidsconverter.bids_dir_converter
       converter: BIDSFUNCDirConverter
+    BIDSSessionDirectory:
+      package: bidsconverter.bids_dir_converter
+      converter: BIDSSessionDirConverter
 project_level:
   type: Directory
   match: ^(?P<name>.*)$
@@ -202,15 +205,16 @@ project_level:
             Authors:
               type: DictListElement
               match_name: ^Authors$
-              debug_match: True
               match_value: ^(.*)$
               subtree:
                 Author:
                   type: TextElement
                   match_value: ^(?P<val>((?!,).)*)$
                   records:
+                    # TODO how to deal with those two case and identifiable
                     Person:
-                      name: $val
+                      firstName: ""
+                      lastName: $val
                     Dataset:
                       Author: +$Person
                 AuthorSplit:
@@ -307,15 +311,16 @@ project_level:
           Subject: +$Subject
       subtree:
         session_level:
-          type: Directory
-          match: ^(ses-(?P<seslabel>[a-zA-Z0-9]+))$
+          type: BIDSSessionDirectory
+          match: ^.*$
+          debug_match: True
           records:
             Session:
               label: $seslabel
             Subject:
               Session: +$Session
           subtree:
-            func:
+            func: &func_subtree
               type: BIDSFUNCDirectory
               match: ^(?P<datatype>func)$
               subtree:
@@ -342,15 +347,13 @@ project_level:
                       - suffix: "((?!events|bold|cbv|sbref|stim)((?!_).)*?)"
                         parent: "RawData"
 
-            anat:
+            anat: &anat_subtree
               type: BIDSANATDirectory
               match: ^(?P<datatype>anat)$
-              debug_match: False
               subtree:
                 series_list:
                   type: ListElement
                   match_name: (?P<series_no>.*)
-                  debug_match: False
                   records:
                     AnatomyImaging:
                       parents: [AnatomyImaging]
@@ -398,15 +401,13 @@ project_level:
                         parent: "MagnetizationTransferRatio"
                       - suffix: "(?!defacemask|MERGE|MESE|VFA|ITR1|MP2RAGE|MPM|MTS|T1w|MTR)"
                         parent: "RawData"
-            meg:
+            meg: &meg_subtree
               type: BIDSMEGDirectory
               match: ^(?P<datatype>meg)$
-              debug_match: False
               subtree:
                 series_list:
                   type: ListElement
                   match_name: (?P<series_no>.*)
-                  debug_match: False
                   records:
                     Magnetoencephalography:
                       parents: [AnatomyImaging]
@@ -434,15 +435,14 @@ project_level:
                         parent: "PhotoFile"
                       - suffix: "headshape"
                         parent: "HeadshapeFile"
-            eeg:
+            eeg: &eeg_subtree
               type: BIDSEEGDirectory
               match: ^(?P<datatype>eeg)$
-              debug_match: False
               subtree:
                 series_list:
                   type: ListElement
                   match_name: (?P<series_no>.*)
-                  debug_match: False
+                  debug_match: True
                   records:
                     Electroencephalography:
                       parents: [Electroencephalography]
@@ -466,7 +466,7 @@ project_level:
                         parent: "ElectrodeFile"
                       - suffix: "photo"
                         parent: "PhotoFile"
-            fmap:
+            fmap: &fmap_subtree
               type: BIDSDirectory
               match: ^(?P<datatype>fmap)$
               debug_match: False
diff --git a/src/bids-cfood/model.yml b/src/bids-cfood/model.yml
index 71956f9..61099cc 100644
--- a/src/bids-cfood/model.yml
+++ b/src/bids-cfood/model.yml
@@ -6,10 +6,35 @@ Dataset:
     recommended_properties:
         Subject:
         DataSetDescription:
+            description: JSON file that describes the dataset
+        BIDSVersion:
+          datatype: TEXT
         ParticipantsTable:
             description: tsv files that lists the participants/subjects
-DataSetDescription:
-    description: JSON file that describes the dataset
+        Author:
+          datatype: Person
+        License:
+          datatype: TEXT
+        DatasetType:
+          datatype: TEXT
+        Acknowledgements:
+          datatype: TEXT
+        HowToAcknowledge:
+          datatype: TEXT
+        DatasetDOI:
+          datatype: TEXT
+        ReferencesAndLinks:
+          datatype: TEXT
+        EthicsApproval:
+          datatype: TEXT
+        HEDVersion:
+          datatype: TEXT
+Person:
+  recommended_properties:
+    firstName:
+      datatype: TEXT
+    lastName:
+      datatype: TEXT
 Subject:
     description: single subject data
     recommended_properties:
-- 
GitLab