Members

(constant) Identifiers :string

Enum for different identifiers fr different pages

Type:
  • string

Methods

Generates a dropdown menu

Parameters:
NameTypeDescription
closedTextString

Text in button when dropdown is closed

openTextString

Text in button when dropdown is open

closedClassNameString

Classes of button when dropdown is closed

openClassNameString

Classes of button when dropdown is open

optionsString

List of all dropdown menu options separated by spaces

optionClassNameString

Classes of dropdown menu item

menuClassNameString

Classes of full dropdown menu

onOptionClickfunction

Callback function to handle option click

HelpButton(title, instructions) → {JSX.Element}

Parameters:
NameTypeDescription
titleString
instructionsString
Returns:
Type: 
JSX.Element

Legend(title, instructions, setShowLegend) → {JSX.Element}

Parameters:
NameTypeDescription
titleString
instructionsString
setShowLegendfunction
Returns:
Type: 
JSX.Element

LegendItem(color, outline, itemName) → {JSX.Element}

Parameters:
NameTypeDescription
colorString
outlineString
itemNameString
Returns:
Type: 
JSX.Element

generateAcronym(description) → {string}

Generates an acronym from a description.

Parameters:
NameTypeDescription
descriptionstring

The description to generate an acronym from.

Returns:
  • The generated acronym.
Type: 
string

handleFileRecord(fileId, fileName, creationDate, modifiedDate, token, patientId) → {Promise.<void>}

Handles file record management in the database. Creates a new file record if it doesn't exist, or updates an existing one. Also creates file assignments for new files.

Parameters:
NameTypeDescription
fileIdstring

The unique identifier for the file

fileNamestring

The name of the file

creationDatestring

The creation date of the file

modifiedDatestring

The last modified date of the file

tokenstring

The authorization token for the user session

patientIdstring

The ID of the patient associated with the file

Returns:
  • Resolves when the operation is complete, throws on error
Type: 
Promise.<void>

insertRegionsAndGetIds(regions) → {Object}

Inserts new regions into the region_name table and returns a mapping of region names to their IDs.

Parameters:
NameTypeDescription
regionsArray.<string>

Array of region names.

Returns:
  • A mapping of region names to their IDs.
Type: 
Object

mapConsecutive(arr, n, fn) → {Array}

Code from https://labex.io/tutorials/javascript-map-consecutive-elements-28479

Parameters:
NameTypeDescription
arrArray

Array to be iterated over

nNumber

Number of consecutive elements within a sub-array

fnfunction

Function to operate on a sub-array (accepts the whole sub-array as input)

Returns:
Type: 
Array

parseCSVFile(file, coordinates, showError) → {Promise.<{identifier: string, data: Object}>}

Parses a CSV file and returns the parsed data.

Parameters:
NameTypeDescription
fileFile

The CSV file to be parsed.

coordinatesboolean

Whether the file is a coordinates file.

showErrorfunction

Function to display error messages.

Returns:

A promise that resolves with the identifier and parsed CSV data.

Type: 
Promise.<{identifier: string, data: Object}>

parseDesignation(data) → {Object}

Parses designation CSV data into a data structure format.

Parameters:
NameTypeDescription
dataArray.<Object>

Parsed CSV data from PapaParse

Returns:

A data structure with the format [{ label: 'A'', contacts: [contact, contact, ...] }, ... ]

Type: 
Object

parseLocalization(data) → {Object}

Parses localization CSV data into a nested dictionary format.

Parameters:
NameTypeDescription
dataArray.<Object>

Parsed CSV data from PapaParse

Returns:

A nested dictionary with the format { Label: { ContactNumber: {"electrodeDescription": "Left Entorhinal", "contactDescription": "Left Entorhinal", "associatedLocation": "GM"}, ... }, ... }

Type: 
Object

parseStimulation(data) → {Object}

Parses stimulation CSV data into a data structure format.

Parameters:
NameTypeDescription
dataArray.<Object>

Parsed CSV data from PapaParse

Returns:

A data structure with the format [{ label: 'A'', contacts: [contact, contact, ...] }, ... ]

Type: 
Object

parseTests(data) → {Object}

Parses stimulation CSV data into a data structure format.

Parameters:
NameTypeDescription
dataArray.<Object>

Parsed CSV data from PapaParse

Returns:

A data structure with the format [{ label: 'A'', contacts: [contact, contact, ...] }, ... ]

Type: 
Object

saveCSVFile(identifier, data, patientId, createdDate, modifiedDate, download) → {Object|void}

Saves a CSV file from data and downloads it or returns the data.

Parameters:
NameTypeDescription
identifierstring

The identifier for the first line.

dataObject

The data to be saved.

patientIdstring

The patient ID for the first line.

createdDatestring

The created date for the first line.

modifiedDatestring

The modified date for the first line.

downloadboolean

Whether to download the file or return the data.

Returns:

The parsed data if download is false, otherwise void.

Type: 
Object | void

saveDesignationCSVFile(designationData, localizationData, patientId, createdDate, modifiedDate, download, type) → {string}

Saves a CSV file from data and downloads it or returns the data.

Parameters:
NameTypeDescription
designationDataArray.<Object>

The data to be saved.

localizationDataArray.<Object>

The localization data to be used.

patientIdstring

The patient ID for the first line.

createdDatestring

The created date for the first line.

modifiedDatestring

The modified date for the first line.

downloadboolean

Whether to download the file or return the data.

typestring

The type of designation data.

Returns:

The CSV content.

Type: 
string

saveLocalizationToDatabase(data, fileId)

Saves localization data to the database in the format of the three tables.

Parameters:
NameTypeDescription
dataObject

The nested dictionary data from parseLocalization.

fileIdnumber | string

The unique file identifier

saveStimulationCSVFile(stimulationData, planOrder, type, patientId, createdDate, modifiedDate, download) → {string}

Saves a CSV file from data and downloads it or returns the data.

Parameters:
NameTypeDescription
stimulationDataArray.<Object>

The data to be saved.

planOrderstring

The plan order for the stimulation.

typestring

The type of stimulation.

patientIdstring

The patient ID for the first line.

createdDatestring

The created date for the first line.

modifiedDatestring

The modified date for the first line.

downloadboolean

Whether to download the file or return the data.

Returns:

The CSV content.

Type: 
string

saveTestCSVFile(testData, contacts, patientId, createdDate, modifiedDate, download) → {string}

Saves a CSV file from data and downloads it or returns the data.

Parameters:
NameTypeDescription
testDataArray.<Object>

The test data to be saved.

contactsArray.<Object>

Contacts associated with tests.

patientIdstring

The patient ID for the first line.

createdDatestring

The created date for the first line.

modifiedDatestring

The modified date for the first line.

downloadboolean

Whether to download the file or return the data.

Returns:

The CSV content.

Type: 
string

sendShareNotification(recipientEmail, senderName, fileType, patientId, creationDate) → {Promise.<Object>}

Sends an email notification when a file is shared.

Parameters:
NameTypeDescription
recipientEmailstring

The email address of the recipient

senderNamestring

The name of the user sharing the file

fileTypestring

The type of file being shared

patientIdstring

The ID of the patient

creationDatestring

The creation date of the file

Returns:
  • The response from the email service
Type: 
Promise.<Object>