npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lbdudc/sensor-dsl

v0.1.10

Published

Sensor DSL is a domain specific language for describing sensors and their data.

Downloads

5

Readme

Sensor DSL

GitHub license Node.js Version npm version

The Sensor Specification DSL Library is a Node.js-based tool designed to assist users in defining sensor specifications using a comprehensive Domain-Specific Language (DSL). This library enables the creation of detailed sensor specifications and outputs the data in JSON format. This JSON specification can be utilized in software product lines to generate complex Geographic Information System (GIS) web-based systems based on the provided sensor specifications.

Features

  • DSL for Sensor Specification: Allows users to define sensor specifications using a structured and comprehensive Domain-Specific Language.
  • JSON Output: Generates a detailed JSON specification based on the provided sensor specifications.
  • Integration with Software Product Lines: Enables integration with software product lines to facilitate the generation of complex GIS web-based systems using the generated sensor specifications.

Prerequisites

Installation

  1. Add the library as a dependency to your project:

    npm install --save @lbdudc/sensor-dsl
  2. Install the dependencies:

    npm install --force

Usage

import { parse } from "@lbdudc/sensor-dsl";

const spec = parse(inputString);

Examples

There are some DSL examples within the examples folder.

The DSL instance must start with a CREATE PRODUCT sentence in order to work.

CREATE PRODUCT ProductExample USING SRID 4326;

// Create a spatial dimension to be used by the sensor
CREATE SPATIAL DIMENSION Estuary (
  geometry: Polygon
) WITH PROPERTIES (
  shortName String DISPLAY_STRING,
  name String
);

// Create the Sensor
CREATE SENSOR StationObservation (
  interval: 300,
  datasource: elasticsearch,
  geometry: Point
) WITH PROPERTIES (
  name String,
  description String,
) WITH MEASUREMENT DATA (
  temperature_ITS90 Double UNITS "ºC",
  salinity Double UNITS "PSU",
  conductivity Double UNITS "S/m"
) WITH SPATIAL GROUP Estuary (
  Estuary
) WITH BBOX ([42.7, -8.1], 9);

The following example shows a DSL instance that creates a product called ProductExample with a sensor called StationObservation and a spatial dimension called Estuary with a Polygon geometry. The sensor has a Point geometry and a measurement data composed of three measurements: temperature_ITS90, salinity and `conductivity.

This will generate a JSON output with the following structure:

{
   ## Base product features selected
   "features": [
      "GEMA_SPL",
      "SensorViewer",
      "SV_LayerManager",
      "SV_LM_Opacity",
      "SV_LM_Order",
      "SV_LM_Visibility",
      "SV_LM_Center",
      "SV_LM_ShowWMSStyle"
      ...
   ],
   ## Basic project data
   "data": {
    "basicData": {
      "name": "ProductExample",
      "index": {
        "component": "STATIC",
        "view": "welcome"
      },
      "languages": [
        "en",
        "es",
        "gl"
      ],
      "packageInfo": {
        "artifactId": "ProductExample",
        "groupId": "es.udc.lbd.productexample"
      },
      "SRID": "4326"
    },
    ## Entities to be created in the postgres database
    "dataModel": {
      "entities": [
        {
          "name": "Estuary",
          "properties": [
            {
              "name": "id",
              "class": "Long (autoinc)",
              "pk": true,
              "required": true,
              "unique": true
            },
            {
              "name": "geometry",
              "class": "Polygon"
            },
            {
              "name": "shortName",
              "class": "String",
              "displayString": true
            },
            {
              "name": "name",
              "class": "String"
            },
            {
              "name": "zone",
              "class": "String"
            }
          ],
          "displayString": "$id"
        },
        {
          "name": "StationObservationEntity",
          "properties": [
            {
              "name": "id",
              "class": "Long (autoinc)",
              "pk": true,
              "required": true,
              "unique": true
            },
            {
              "name": "geometry",
              "class": "Point"
            },
           ...
          ],
          "displayString": "$id"
        }
      ],
      "enums": []
    },
      ## Data related to the sensor and its dimensions
     "dataWarehouse": {
      "sensors": [
        {
          "id": "StationObservation",
          "entity": "StationObservationEntity",
          "defaultMap": "stationobservation-map",
          "defaultLayer": "stationobservation-layer",
          "time": 300,
          "datasource": "elasticsearch",
          "geom": "Point",
          "measureData": [
            {
              "name": "temperature_ITS90",
              "type": "Double",
              "units": "ºC"
            },
            {
              "name": "salinity",
              "type": "Double",
              "units": "PSU"
            },
          ],
          "dimensions": [
            {
              "id": "Estuary",
              "type": "SPATIAL",
              "entities": [
                "Estuary"
              ]
            }
          ]
        }
      ]
    },
    "forms": [],
    "lists": [],
    "menus": [],
    ## Data related to the map viewer in the web application
    "mapViewer": {
      "maps": [
        {
          "name": "stationobservation-map",
          "label": "StationObservation Map",
          "center": {
            "lat": 42.7,
            "lng": -8.1,
            "zoom": 9
          },
          "sortable": false,
          "layers": [
            {
              "name": "base",
              "baseLayer": true,
              "selected": true,
              "order": 0
            },
            {
              "name": "stationobservation-layer",
              "baseLayer": false,
              "style": "grayPoint",
              "selected": true,
              "order": 1
            },
            {
              "name": "Estuary",
              "baseLayer": false,
              "style": "grayPolygon",
              "selected": false,
              "order": 2
            }
          ]
        }
      ],
      "layers": [
        {
          "name": "base",
          "type": "tilelayer",
          "label": "base",
          "url": "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
        },
        {
          "name": "stationobservation-layer",
          "type": "geojson",
          "label": "StationObservationEntity",
          "entityName": "StationObservationEntity-geometry",
          "editable": false,
          "defaultStyle": "grayPoint",
          "availableStyles": [
            "grayPoint",
            "temperature_ITS90",
            ...
          ]
        },
        {
          "name": "Estuary",
          "type": "geojson",
          "label": "Estuary",
          "entityName": "Estuary-geometry",
          "editable": false,
          "defaultStyle": "grayPolygon",
          "availableStyles": [
            "grayPolygon",
            "temperature_ITS90",
            ...
          ]
        }
      ],
      "styles": [
         ...
      ]
    },
    "statics": []
   }
}

Author

Victor Lamas Email: [email protected]

License

This project is licensed under the MIT License - see the LICENSE.md file for details