Skip to content

[electrophysiology_browser] Fix extra event fields API serialization - #11211

Closed
MaximeBICMTL wants to merge 1 commit into
aces:mainfrom
MaximeBICMTL:fix-ephys-browser-extra-events-serialization
Closed

MaximeBICMTL wants to merge 1 commit into
aces:mainfrom
MaximeBICMTL:fix-ephys-browser-extra-events-serialization

Conversation

@MaximeBICMTL

@MaximeBICMTL MaximeBICMTL commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fix the electrophysiolgy browser event extra columns serialization by adding missing iterator_to_array around SQL query, ensuring the module API always returns an array whether or not the query is populated. The current code returns an empty object rather than an empty array when there is no extra column.

Testing

Raisinbread URL: http://loris.local/electrophysiology_browser/sessions/167?outputType=all_types
(opening this URL straight in your browser will give you HTML, but go to the network inspector to see the same request in JSON mode, which highlights the fix).

Before fix

{
  "patient": {
    "pscid": "OTT167",
    "dccid": "300167",
    "visit_label": "V1",
    "site": "Ottawa",
    "sex": "Female",
    "cohort": "Fresh"
  },
  "database": [
    {
      "file": {
        "id": 1,
        "name": "sub-OTT167_ses-V1_task-faceO_eeg.edf",
        "summary": {
          "sampling_frequency": 512,
          "eeg_channels": 128,
          "eog_channels": 7,
          "reference": "CMS",
          "powerline_frequency": 60
        },
        "details": {
          "task_name": "FaceHouseCheck",
          "recording_type": "continuous",
          "recording_duration": 1201,
          "manufacturer": "BioSemi"
        },
        "events": {
          "count": 1599,
          "instances": [
            {
              "id": 1,
              "onset": 11.734,
              "duration": 0,
              "trial_type": "checker-right"
            },
            {
              "id": 2,
              "onset": 12.533,
              "duration": 0,
              "trial_type": "house-upright"
            },
            {
              "id": 3,
              "onset": 13.332,
              "duration": 0,
              "trial_type": "face-upright"
            },
            "... 1,595 events omitted ...",
            {
              "id": 1599,
              "onset": 1179.062,
              "duration": 0,
              "trial_type": "face-inverted"
            }
          ],
          "extra_columns": {},
          "hed_tag_count": 8,
          "hed_endorsements": [],
          "channel_delimiter": ","
        }
      }
    }
  ],
  "sessions": [166, 167, 168, 170, 171, 172, 173, 174, 175, 176],
  "previous_session": 166,
  "next_session": 168
}

Notice "extra_columns": {}

After fix

{
  "patient": {
    "pscid": "OTT167",
    "dccid": "300167",
    "visit_label": "V1",
    "site": "Ottawa"
  },
  "database": [
    {
      "file": {
        "id": 1,
        "name": "sub-OTT167_ses-V1_task-faceO_eeg.edf",
        "events": {
          "instances": [
            {
              "PhysiologicalTaskEventID": 1,
              "Onset": "11.734000",
              "Duration": "0.000000",
              "TrialType": "checker-right"
            },
            {
              "PhysiologicalTaskEventID": 2,
              "Onset": "12.533000",
              "Duration": "0.000000",
              "TrialType": "house-upright"
            },
            {
              "PhysiologicalTaskEventID": 3,
              "Onset": "13.332000",
              "Duration": "0.000000",
              "TrialType": "face-upright"
            },

            "... 1,595 events omitted ...",

            {
              "PhysiologicalTaskEventID": 1599,
              "Onset": "1179.062000",
              "Duration": "0.000000",
              "TrialType": "face-inverted"
            }
          ],
          "extra_columns": [],
          "hed_tags": [
            "... 8 HED tags omitted ..."
          ],
          "hed_endorsements": [],
          "channel_delimiter": ","
        },

        "datasetTags": {
          "... dataset-level HED mappings omitted ..."
        },
        "datasetTagEndorsements": [],
        "output_type": "raw",
        "hedSchema": [
          "... 1,623 schema nodes omitted ..."
        ]
      }
    }
  ],
  "sessions": [
    166,
    167,
    168,
    170,
    171,
    172,
    173,
    174,
    175,
    176
  ],
  "nextSession": 168,
  "prevSession": 166
}

Notice "extra_columns": []

@github-actions github-actions Bot added Language: PHP PR or issue that update PHP code Module: electrophysiology_browser PR or issue related to electrophysiology_browser module labels Sep 18, 2026
@MaximeBICMTL MaximeBICMTL added Category: Bug PR or issue that aims to report or fix a bug Difficulty: Simple PR or issue that should be easy to implement, review, or test labels Sep 18, 2026
@MaximeBICMTL
MaximeBICMTL marked this pull request as ready for review September 18, 2026 10:17
@MaximeBICMTL

Copy link
Copy Markdown
Contributor Author

Closed in favor of #11003.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Bug PR or issue that aims to report or fix a bug Difficulty: Simple PR or issue that should be easy to implement, review, or test Language: PHP PR or issue that update PHP code Module: electrophysiology_browser PR or issue related to electrophysiology_browser module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant