smart_arrays_dbstore 2.0.1
smart_arrays_dbstore: ^2.0.1 copied to clipboard
For Web applications which need to store arrays and their metadata data on the local device (PC, tablet, phone) over a longer time period.
Smart Arrays Database Store #
What the package can do for you #
-
This package was designed for Web applications which need to store data on the local device (PC, tablet, phone) over a longer time period, e.g. to view or process the data by a Web app during multiple sessions.
-
The package is capable of saving one- and two-dimensional arrays of double values and String-valued maps in databases, optionally along with metadata containing additional information about the actual array data.
-
Arrays with their metadata are considered as "datasets" of type
DSet
. ADSet
can be created from arrays and metadata using this package. -
Each dataset
DSet
is stored in its own database of typeindexed_db
under the browser. The user must define its name (similar as one would do it under a file system) for later retrieval. -
Many datasets, even of big size (e.g. array sizes of several megabytes) may be stored. The exact limits are browser dependent. Browsers derive their limits from the available storage, the number of expected applications, and other parameters.
-
The package was tested using the following browsers: Chrome under Windows, Linux, Android, iOS. Safari under iOS.
-
Datset sets will remain stored until
- they are explicitely deleted by using respective API functions provided by this package.
- the user deleted the browser data via respective functions of the operating system or from the browser's advanced settings menu.
- the browser itself decided to delete the data. Although this is not usually the case and was never observed by the author over years, browsers reserve the right to do so to recover from serious problems. For this reason this package is not suitable for long-term data archiving.
-
This packages utilizes
indexed_db
databases managed by the browser. Their technical storage method and storage location on a device is browser dependent, and also depends on the origin from which the Web app is served. For Chrome, you can list the databases by enteringchrome://indexeddb-internals
into the browser's address field.
The major API functionalities #
-
Class
DSet
to create a datset from arrays and its metadata: -
Class
DSkey
to create a datset key (dataset identifier) under which a dataset will be stored. -
Class
DSetStore
, a handler to store datasets on the device, to load stored datasets, to delete, copy, rename datasets, to obtain a list (directory) of stored datasets, to save information common to all datasets in a global store, to classify datasets intoprojects
. -
Class
DSetDB
to initially create aDSetStore
required to apply the functionalities above. -
Basic usage to store a datset:
- create a dataset of type
DSet
from your array and metadata (constructorDSet
). - create a
DSkey
identifier for your data in the store (methodDSKey.create
) - create a
DSetStore
storage handler (methodDSetDB.createDSetStore
). - invoke
DSetStore.dsSave
to store the data
- create a dataset of type
-
Basic usage to load a stored datset:
- create a
DSkey
identifier for the data you want to load from the store (methodDSKey.create
) - create a
DSetStore
storage handler (methodDSetDB.createDSetStore
). - invoke
DSetStore.dsLoad
to load stored data
- create a
-
Basic usage to find out which datasets are available in the store:
- create a
DSetStore
storage handler (methodDSetDB.createDSetStore
). - invoke
DSetStore.projectsGet
to get a list of all projects. - For each project, invoke
DSetStore.dskeysWithProject
to get a list of the dataset keys of the dataset stored under this project. You will use then such a key to load the data. Or you can build a GUI displaying the projects with their datasets.
- create a
Please check the provided example for details.
Detailed API
Please view the detailed API documentation in the API
reference of this package (sidebar at the right of this page).
Related packages #
smart_arrays_base
: Basic functions for 1D and 2D arrays
smart_arrays_numerics
: Numerics with 1D and 2D arrays
smart_arrays_compress
: Compress 1D and 2D arrays to a smaller size.
smart_arrays_peaks
: Detect peaks in 1D and 2D arrays.
smart_lorentz-gauss
: Compute Lorentz-Gauss (pseudo-Voigt) line shapes.