Skip to content

Overview

Ashley Davis edited this page Dec 27, 2023 · 6 revisions

Data-Forge Notebook (DFN) is developed by Ashley Davis.

It is a notebook-style app for data analysis, transformation and visualization in JavaScript for Windows, MacOS and Linux.

Data-Forge Notebook includes Node.js and contains everything you need to start coding in JavaScript.

When are you coding in Data-Forge Notebook you are simply coding against Node.js. Anything you can do in Node.js you can also do in Data-Forge Notebook. When you have finished developing your code in Data-Forge Notebook you can export it to a Node.js project and deploy it to your production environment.

Have feedback? Please get in touch.

Where did DFN come from?

Data-Forge Notebook was built by Ashley Davis and was inspired by:

DFN isn't possible without the mountain of open-source code it is built on, including, but not limited to:

  • Electron
  • ApexCharts
  • Leaflet
  • Kajero
  • React
  • Webpack
  • and many more...

What are the core principles of DFN?

  • Notebook code runs on Node.js (in the future it will support browser-based JavaScript code as well)
  • All code that works in DFN should also work just on Node.js (this is becoming more difficult to maintain as DFN supports more sophisticated visualizations).
  • Supports TypeScript out of the box
  • Prototype code then export it and use it in production (v1 only, may be implemented again for v2)
  • Includes everything you need, just download it and start coding.
  • Notebook files are saved as markdown which makes it easier to read them as text files and easier to merge changes in version control.

What does DFN include?

Data-Forge Notebook includes a portable embedded version of Node.js. This won't interfere with any existing Node.js you may already have installed on your system.

Coding in Data-Forge Notebook is very similar to coding in Node.js, except you have access to some advanced and interactive visualization capabilities. DFN executes your code using the embedded Node.js.

You can use all the normal Node.js facilities, using installed npm libraries, using your own reusable JavaScript code modules and accessing the file system to load and save data.

TypeScript is also supported and can be enabled for entire notebook. In this case DFN automatically compiles your TypeScript code to JavaScript before evaluating it.

Think of your notebook as you would any single JavaScript of TypeScript file. DFN concatenates together your code cells before it evaluates your notebook. Variables that you define in cells can be accessed in other cells, they are global to the notebook.

Data-Forge Notebook comes bundled with a suite of example notebooks that demonstrate a variety of data wrangling and visualization techniques. To explore the examples click Open example notebook from the File menu.

How does DFN work?

Data-Forge Notebook is a cross-platform Electron app.

Code evaluation

When you start DFN it starts a seperate Node.js process called the evaluation engine (using the embedded Node.js mentioned earlier). This separate process is used to evaluate the code in your notebook. When you hit the run button to trigger evaluation of your code DFN pushes your notebook to the evaluation engine to be executed.

Output and errors

Any output or errors produced by the code in your notebook are sent back to DFN for display within the notebook. When you save your notebook, DFN also saves the output and errors within it so that the next time you open the notebook all the results from the last evaluation are restored.

Error handling

The evaluation engine is designed to handle errors from your code and be resilliant. It can also handle being aborted and restarted, just in case you put an infinite loop in your code. You can even put a call to process.exit in your notebook and DFN will automatically restart the evaluation engine after you aborted it. However the evaluation engine isn't perfect and you can probably find unusual ways to corrupt it from the inside - if you do, in the interest of improving it, please let us know!

npm modules

To install an npm module, simply require or import it into your code. DFN will automatically detect the modules you want and install them for you. You can also pre-install npm modules using npm from the command line, just make sure you install them in the same directory as your notebook or in the parent directory.

Working with the file system

When evaluating your notebook DFN automatically sets the current working directory for the evaluation to be the directory where the notebook is saved. Thus when using Node.js file system functions you can access your files by using paths that are relative to the directory that contains your notebook.