|
|
1 mēnesi atpakaļ | |
|---|---|---|
| .. | ||
| __mocks__ | 1 mēnesi atpakaļ | |
| bin | 1 mēnesi atpakaļ | |
| docs | 1 mēnesi atpakaļ | |
| public | 1 mēnesi atpakaļ | |
| src | 1 mēnesi atpakaļ | |
| .babelrc | 1 mēnesi atpakaļ | |
| .env.example | 1 mēnesi atpakaļ | |
| CODE_OF_CONDUCT.md | 1 mēnesi atpakaļ | |
| LICENSE | 1 mēnesi atpakaļ | |
| README.md | 1 mēnesi atpakaļ | |
| jest.config.ts | 1 mēnesi atpakaļ | |
| package.json | 1 mēnesi atpakaļ | |
| project.json | 1 mēnesi atpakaļ | |
| tsconfig.json | 1 mēnesi atpakaļ | |
| tsconfig.lib.json | 1 mēnesi atpakaļ | |
| tsconfig.spec.json | 1 mēnesi atpakaļ | |
LabelStudio DataManager is a vital component within the Label Studio ecosystem, designed to efficiently manage and navigate through annotated data. It provides users with advanced capabilities to organize, filter, and browse their datasets seamlessly.
DataManager boasts several key features, enhancing data handling within Label Studio:
.env.example file located in the DataManager directory and rename the copy to .env..env file. The key configurations to consider are:NX_API_GATEWAY: Set this to your API root. For example, https://localhost:8080/api/dm.LS_ACCESS_TOKEN: This is the access token for Label Studio, which can be obtained from your Label Studio account page.DataManager provides specific scripts for operation and testing:
Important Note: These scripts must be executed within the web folder or its subfolders. This is crucial for the scripts to function correctly, as they are designed to work within the context of the web directory's structure and dependencies.
yarn dm:watch: Build DataManager continuously.
yarn dm:unit: Run unit tests on DataManager.
DataManager integrates closely with Label Studio, handling various events:
dm.on('submitAnnotation', () => /* handle the submit process */)
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 parameters 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 object instead
apiEndpoints: {
updateTab: {
path: "/api/tabs/:id",
method: "post"
}
}
// 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
}
}
}
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`
}
}
}
