Members
(constant) Identifiers :string
Enum for different identifiers fr different pages
- string
- Source
Methods
Dropdown(closedText, openText, closedClassName, openClassName, options, optionClassName, menuClassName, onOptionClick)
Generates a dropdown menu
Name | Type | Description |
---|---|---|
closedText | String | Text in button when dropdown is closed |
openText | String | Text in button when dropdown is open |
closedClassName | String | Classes of button when dropdown is closed |
openClassName | String | Classes of button when dropdown is open |
options | String | List of all dropdown menu options separated by spaces |
optionClassName | String | Classes of dropdown menu item |
menuClassName | String | Classes of full dropdown menu |
onOptionClick | function | Callback function to handle option click |
- Source
HelpButton(title, instructions) → {JSX.Element}
Name | Type | Description |
---|---|---|
title | String | |
instructions | String |
- Source
- Type:
- JSX.
Element
Legend(title, instructions, setShowLegend) → {JSX.Element}
Name | Type | Description |
---|---|---|
title | String | |
instructions | String | |
setShowLegend | function |
- Source
- Type:
- JSX.
Element
LegendItem(color, outline, itemName) → {JSX.Element}
Name | Type | Description |
---|---|---|
color | String | |
outline | String | |
itemName | String |
- Source
- Type:
- JSX.
Element
generateAcronym(description) → {string}
Generates an acronym from a description.
Name | Type | Description |
---|---|---|
description | string | The description to generate an acronym from. |
- Source
- 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.
Name | Type | Description |
---|---|---|
fileId | string | The unique identifier for the file |
fileName | string | The name of the file |
creationDate | string | The creation date of the file |
modifiedDate | string | The last modified date of the file |
token | string | The authorization token for the user session |
patientId | string | The ID of the patient associated with the file |
- Source
- 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.
Name | Type | Description |
---|---|---|
regions | Array.<string> | Array of region names. |
- Source
- 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
Name | Type | Description |
---|---|---|
arr | Array | Array to be iterated over |
n | Number | Number of consecutive elements within a sub-array |
fn | function | Function to operate on a sub-array (accepts the whole sub-array as input) |
- Type:
- Array
parseCSVFile(file, coordinates, showError) → {Promise.<{identifier: string, data: Object}>}
Parses a CSV file and returns the parsed data.
Name | Type | Description |
---|---|---|
file | File | The CSV file to be parsed. |
coordinates | boolean | Whether the file is a coordinates file. |
showError | function | Function to display error messages. |
- Source
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.
Name | Type | Description |
---|---|---|
data | Array.<Object> | Parsed CSV data from PapaParse |
- Source
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.
Name | Type | Description |
---|---|---|
data | Array.<Object> | Parsed CSV data from PapaParse |
- Source
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.
Name | Type | Description |
---|---|---|
data | Array.<Object> | Parsed CSV data from PapaParse |
- Source
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.
Name | Type | Description |
---|---|---|
data | Array.<Object> | Parsed CSV data from PapaParse |
- Source
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.
Name | Type | Description |
---|---|---|
identifier | string | The identifier for the first line. |
data | Object | The data to be saved. |
patientId | string | The patient ID for the first line. |
createdDate | string | The created date for the first line. |
modifiedDate | string | The modified date for the first line. |
download | boolean | Whether to download the file or return the data. |
- Source
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.
Name | Type | Description |
---|---|---|
designationData | Array.<Object> | The data to be saved. |
localizationData | Array.<Object> | The localization data to be used. |
patientId | string | The patient ID for the first line. |
createdDate | string | The created date for the first line. |
modifiedDate | string | The modified date for the first line. |
download | boolean | Whether to download the file or return the data. |
type | string | The type of designation data. |
- Source
The CSV content.
- Type:
- string
saveLocalizationToDatabase(data, fileId)
Saves localization data to the database in the format of the three tables.
Name | Type | Description |
---|---|---|
data | Object | The nested dictionary data from parseLocalization. |
fileId | number | | The unique file identifier |
- Source
saveStimulationCSVFile(stimulationData, planOrder, type, patientId, createdDate, modifiedDate, download) → {string}
Saves a CSV file from data and downloads it or returns the data.
Name | Type | Description |
---|---|---|
stimulationData | Array.<Object> | The data to be saved. |
planOrder | string | The plan order for the stimulation. |
type | string | The type of stimulation. |
patientId | string | The patient ID for the first line. |
createdDate | string | The created date for the first line. |
modifiedDate | string | The modified date for the first line. |
download | boolean | Whether to download the file or return the data. |
- Source
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.
Name | Type | Description |
---|---|---|
testData | Array.<Object> | The test data to be saved. |
contacts | Array.<Object> | Contacts associated with tests. |
patientId | string | The patient ID for the first line. |
createdDate | string | The created date for the first line. |
modifiedDate | string | The modified date for the first line. |
download | boolean | Whether to download the file or return the data. |
- Source
The CSV content.
- Type:
- string
sendShareNotification(recipientEmail, senderName, fileType, patientId, creationDate) → {Promise.<Object>}
Sends an email notification when a file is shared.
Name | Type | Description |
---|---|---|
recipientEmail | string | The email address of the recipient |
senderName | string | The name of the user sharing the file |
fileType | string | The type of file being shared |
patientId | string | The ID of the patient |
creationDate | string | The creation date of the file |
- Source
- The response from the email service
- Type:
- Promise.<Object>