MEDomicsLab coding standards
Table of contents
Recommended Software
Framework used in the platform
npmjs - Library manager for javascript language
Electron - Web based programming for standalone app developpement
Nextjs - Abstraction of React adding server side rendering and optimisations
Go - Server side language
Project Repository Structure
Folder Description Contains distribution relative files
Contains Go code acting as a server
Electron related contents
Contains saved libraries (created from npm install
)
Python virtual environment utils
NextJs ressources (icons, etc.)
NextJs ressources (icons, etc.)
Style
Copy import 'bootstrap/dist/css/bootstrap.min.css' ;
import <all other global css libraries>
Naming Conventions
Javascript/react
Component file name : camelCase
Each file name should be the same as the component defined inside
Component creation : prioritize function implementation over class
Copy export default const myComponent = (someProps) = Β > {
return (<></>)
}
Function creation: prioritize arrow implementation
Copy const myFct = (someParams) = Β > {}
See react naming convention
Components Structure
Directory tree of the application components
Copy components
ββββdataTypeVisualisation
β dataTablePopoverBPClass.jsx
β dataTableWrapper.jsx
β dataTableWrapperBPClass.tsx
β
ββββevaluation
β dashboard.jsx
β evaluationPageContent.jsx
β pageConfig.jsx
β pageEval.jsx
β predictPanel.jsx
β
ββββextractionImage
β β extractionJPG.jsx
β β
β ββββextractionTypes
β extractionDenseNet.jsx
β
ββββextractionMEDimage
β β docLink.jsx
β β flowCanvas.jsx
β β
β ββββbuttonsTypes
β β resultsButton.jsx
β β viewButton.jsx
β β
β ββββnodesTypes
β β extractionNode.jsx
β β featuresNode.jsx
β β filterNode.jsx
β β segmentationNode.jsx
β β standardNode.jsx
β β
β ββββfilterTypes
β β gaborFilter.jsx
β β lawsFilter.jsx
β β logFilter.jsx
β β meanFilter.jsx
β β waveletFilter.jsx
β β
β ββββstandardNodeForms
β discretizationForm.jsx
β inputForm.jsx
β interpolationForm.jsx
β reSegmentationForm.jsx
β
ββββextractionTabular
β β extractionTabularData.jsx
β β
β ββββextractionTypes
β extractionBioBERT.jsx
β extractionTSfresh.jsx
β
ββββflow
β β btnDiv.jsx
β β codeEditor.jsx
β β errorRequestDialog.jsx
β β flowPageBase.jsx
β β groupNode.jsx
β β handlers.jsx
β β node.jsx
β β nodeWrapperResults.jsx
β β sidebarAvailableNodes.jsx
β β workflowBase.jsx
β β
β ββββcontext
β β flowFunctionsContext.jsx
β β flowInfosContext.jsx
β β flowResultsContext.jsx
β β
β ββββresults
β pipelinesResults.jsx
β resultsPane.jsx
β
ββββgeneralPurpose
β errorRequestContext.jsx
β loaderContext.jsx
β progressBarRequests.jsx
β
ββββinput
β groupingTool.jsx
β holdOutSetCreationTool.jsx
β mergeTool.jsx
β simpleCleaningTool.jsx
β subsetCreationTool.jsx
β
ββββlayout
β β actionContext.jsx
β β iconSidebar.jsx
β β layoutContext.jsx
β β layoutManager.jsx
β β
β ββββflexlayout
β β mainContainerClass.tsx
β β popout.html
β β popupMenu.tsx
β β simple.layout
β β tabStorage.tsx
β β utils.tsx
β β zoomPanPinchComponent.jsx
β β
β ββββsidebarTools
β β components.jsx
β β fileCreationBtn.jsx
β β recursiveChildrenTest.js
β β
β ββββdirectoryTree
β β renderItem.js
β β sidebarDirectoryTreeControlled.jsx
β β workspaceDirectoryTree.jsx
β β
β ββββpageSidebar
β evaluationSidebar.jsx
β explorerSidebar.jsx
β extractionSidebar.jsx
β flowSceneSidebar.jsx
β homeSidebar.jsx
β inputSidebar.jsx
β layoutTestSidebar.jsx
β searchSidebar.jsx
β
ββββlearning
β β checkOption.jsx
β β input.jsx
β β modalSettingsChooser.jsx
β β workflow.jsx
β β
β ββββnodesTypes
β β datasetNode.jsx
β β loadModelNode.jsx
β β optimizeIO.jsx
β β selectionNode.jsx
β β standardNode.jsx
β β
β ββββresults
β ββββnode
β β analyseResults.jsx
β β dataParamResults.jsx
β β modelsResults.jsx
β β saveModelResults.jsx
β β
β ββββutilities
β dataTablePath.jsx
β parameters.jsx
β
ββββmainPages
β β application.jsx
β β evaluation.jsx
β β exploratory.jsx
β β extractionImage.jsx
β β extractionMEDimage.jsx
β β extractionText.jsx
β β extractionTS.jsx
β β home.jsx
β β htmlViewer.jsx
β β input.jsx
β β learning.jsx
β β modelViewer.jsx
β β output.jsx
β β results.jsx
β β terminal.jsx
β β test.jsx
β β
β ββββdataComponents
β β datasetSelector.jsx
β β dataTableFromContext.jsx
β β dataTableFromContextBP.jsx
β β dropzoneComponent.jsx
β β dropzoneComponent2.jsx
β β listBoxSelector.jsx
β β wsSelect.jsx
β β
β ββββmoduleBasics
β modulePage.jsx
β pageInfosContext.jsx
β
ββββworkspace
dataContext.jsx
medDataObject.js
workspaceContext.jsx
To generate this : tree .\renderer\components\ /f
Syntax
(ES6 for JS as mentioned by Electron, for Python Electron follows Chromium's Coding Style)
Installation
Install prettier and plugin (should be included in package.json so a npm install
should do it) npm install prettier eslint-plugin-prettier eslint-config-prettier
Open workspace settings
Can be accessed directly from this path: .vscode/settings.json
Or press CTRL+SHIFT+P
and type Preferences: Open Workspace Settings (JSON)
Copy {
"eslint.options" : {
"overrideConfigFile" : ".eslintrc.js"
} ,
"editor.formatOnSave" : true ,
"eslint.validate" : [ "javascript" ] ,
"editor.defaultFormatter" : "esbenp.prettier-vscode"
}
Usage
There are 2 config files:
prettier -> .prettierrc.js
A higher priority is placed on Prettier wich handles basic formatting
see config file for more information on what it rules
then, all standards rules are placed in eslint config file. So if you need to add specific rules, it should be in .eslintrc.js file
Use CTRL+S
to save and format files. Eslint may triggered error displayed as a red underline so you can hover these conventions error, then click on 'quick fix' and click on 'fix all/the problem(s)'
Documentation
Docstring
Copy /**
* @param {type} someParams description
* @return {type} description
* @description
* functionnal description of the function/React object
*/
const myfct = (someParams) = Β > {}
Comments
Do not over detailed the code for readability
Comments are meant to help understand important or critical actions in code
Documentation generation
Not tested : https://www.npmjs.com/package/react-doc-generator
(Comments, docstrings, documentation generator...)
Python Coding Standard
(see MEDomicsTools for Python )