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

@heartexlabs/datamanager

v2.0.5

Published

[Website](https://labelstud.io/) • [Docs](https://labelstud.io/guide) • [Twitter](https://twitter.com/heartexlabs) • [Join Slack Community](https://docs.google.com/forms/d/e/1FAIpQLSdLHZx5EeT1J350JPwnY2xLanfmvplJi6VZk65C2R4XSsRBHg/viewform?usp=sf_link)

Downloads

10

Readme

Data Manager 2.0 · Build and Test · npm version

WebsiteDocsTwitterJoin Slack Community

Data exploration tool for Label Studio.

Summary

Quickstart

npm install @heartexlabs/datamanager

Features

  • Grid and list view to easily explore your datasets
  • Customizable data representation: select what data you want to see and how to show it
  • Easily slice your datasates with filters for more precise exploration
  • Deep integration with Label Studio Frontend

Usage

You can use DataManager as a standalone module.

Keep in mind that DataManager requires backend api to operate. In case of standalone usage you need to implement backend yourself.

Installation

npm install @heartexlabs/datamanager

Initialize

import { DataManager } from '@heartexlabs/datamanager';

const dm = new DataManager({
  // Where to render DataManager
  root: document.querySelector('.app'),
  // API gateway
  apiGateway: 'https://example.com/api',
  // API settings
  apiEndpoints: {
    // here you can override API endpoints
    // default config could be found in api-config.js
  },
  // Disable requests mocking
  apiMockDisabled: process.env.NODE_ENV === 'production',
  // Passing parameters to Label Studio Frontend
  labelStudio: {
    user: { pk: 1, firstName: "James" }
  },
  // Table view settings
  table: {
    hiddenColumns: {/*...*/},
    visibleColumns: {/*...*/}
  },
  // Setup links. Null value will hide the button
  links: {
    import: '/import',
    export: '/export',
  }
})

Events

DataManager forwards most of the events from Label Studio.

dm.on('submitAnnotation', () => /* handle the submit process */)

API endpoints

To have access to the backend DataManager uses endpoints. Every endpoint is converted into a named method that DM will use under the hood. Full list of those method could be found here.

Every endpoint could be either a string or an object.

API endpoint paths also support :[parameter-name] notation, e.g. /tabs/:tabID/tasks. These parameteres are required if specified. This means DM will throw an exception if the parameter is not present in the API call.

// In this case DM will assume that api.columns() is a get request
apiEndpoints: {
	columns: "/api/columns",
}

For requests other than GET use object notation:

// If you want to specify a method, use oject instead
apiEndpoints: {
  updateTab: {
    path: "/api/tabs/:id",
    method: "post"
  }
}
Response conversion
// In case you already have the api but the response doesn't fit the format expected by DM
// you can convert the response on the fly
apiEndpoints: {
  tabs: {
    path: "/api/tabs",
    convert: (response) => {
			/* do whatever you need with the response */
      /* then return the modified object */
      return response
    }
  }
}
Request mock

DataManager supports requests mocking. This feature comes handy for the development purposes.

apiEndpoints: {
  columns: {
    path: "/api/columns",
    mock: (url, requestParams, request) => {
      // here you can process the request and return the response
      // execution of this method can be disabled by using `apiMockDisabled: true`
    }
  }
}

Under the hood

Build and run

Run in development mode with server API

Ensure that Label Studio is running, then configure your environment. Copy .env.defaults into .env and change settings:

  • API_GATEWAY=http://localhost:8080/api/dm or other API root if you have one
  • LS_ACCESS_TOKEN — to get this token go to LS, open menu from avatar in top right corner, go to Account page, copy token

Also you have to change data-project-id in public/index.html to project you want to use. DM always works with only one project at a time.

Then start DM with simple command:

npm run start

Build for production and standalone usage

Builds a CommonJS compatible module

npm run build:module

Build for Label Studio

Wait until the artifact is built, then navigate to the Label Studio directory and execute the following command in your command line:

node scripts/get-build.js dm [branch-name]

branch-name – optional, default: master

Development

Prerequisites

For the development it is required to have Label Studio installed and running as the DataManager uses LabelStudio API to operate.

If you're using your own backend, make sure that the API implements all the methods DataManager requires.

Running local version of DataManager

npm ci

Run local version of the DataManager

npm start

DataManager and Label Studio Frontend

By default DataManager comes with the latest version of Label Studio Frontent available on npm at the moment.

If you need another version, you have several options to connect it.

Using version from unpkg.com

You can take whatever version of LSF you need from unpkg.com and replace the existing one in public/index.html.

Using local clone

If need more control over the changes or you're developing some sort of integration between DataManager and Label Studio Frontend, you'll need to clone label-studio-frontend locally first.

  1. Follow the Development guide first and build a production version of Label Studio Frontend.
  2. Grab the contents of ./build/static directory and copy it over to Data Manager public folder.
  3. Edit public/index.html, you will need to replace these two lines:
<!-- Label Studio Frontend -->
-    <link href="https://unpkg.com/label-studio@latest/build/static/css/" rel="stylesheet">
-    <script src="https://unpkg.com/label-studio@latest/build/static/js/main.js"></script>
+    <link href="./static/css/" rel="stylesheet">
+    <script src="./static/js/main.js"></script>

Using custom DM build in Label Studio

You can install DataManager into Label Studio by replacing bundle files.

First, build the DataManager itself:

npm ci && npm run build:module

Next replace the bundle in Label Studio with a new one:

cp -r ./build/**/* [your-label-studio-path]/label-studio/static/dm/

Now you can start Label Studio if it's not running, or refresh the page in the browser.

Ecosystem

| Project | Description | |-|-| | label-studio | Server part, distributed as a pip package | | label-studio-frontend | Frontend part, written in JavaScript and React, can be embedded into your application | | label-studio-converter | Encode labels into the format of your favorite machine learning library | | label-studio-transformers | Transformers library connected and configured for use with label studio | | datamanager | Data exploration tool for Label Studio |

License

This software is licensed under the Apache 2.0 LICENSE © Heartex. 2020