Knowledge Graph
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Introduction The Label Repository is a unique repository within TelOS, designed to store label metadata associated with a specific record_key. The primary responsibility of the Label Repository is to handle CRUD operations and search functionality. Labels stored in this repository can be generated through various sources, including human input, AutoML, or other processes. For instance, consider an image where the system has identified various types of fruits and labeled them accordingly. ![](https://hackmd.io/_uploads/By9Zv2Zd3.jpg) image source: https://www.superannotate.com/blog/guide-to-data-labeling The Label Repository is responsible for storing these labels at an atomic level, which includes: 1. **Record Key** – Identifying what we are labeling. 2. **Label Type** – Determining the type of labeling. 3. **Label Value** – Storing the value of the label type for the given record key. 4. **Label Source** - Identifying whether it is auto-labeled (with metadata of the model) or human-labeled (with metadata of the individual who labeled it). 5. **Label Status** – Indicating whether it is at the final stage of labeling or not. 6. **Label Confidence** - Providing the level of confidence in the label. ### Functional Requirements: 1. **Create Labels**: The service should be able to create new labels with all required attributes such as label key, label type, label value, label source, label status, and confidence score. 2. **Read Labels**: The service should be able to retrieve labels based on various parameters such as record key, label type, label source, and status. 3. **Update Labels**: The service should be able to update existing labels. This could include changing the label value, status, or confidence score. 4. **Delete Labels**: The service should be able to delete labels based on the record key. 5. **Search Labels**: The service should provide a search functionality to find labels based on various parameters such as label type, label source, Confidence, and status. 6. **Label History**: The service should maintain a history of changes to a label, allowing users to track how a label has evolved over time. ### Non-Functional Requirements: 1. **Performance**: The service should be able to handle a large number of labels and perform CRUD operations quickly. 2. **Scalability**: The service should be able to scale to support growth in data volume and user traffic. 3. **Reliability**: The service should be highly reliable, with minimal downtime. 4. **Security**: The service should ensure that the data is securely stored and accessed. This includes implementing proper access controls and encryption. 5. **Data Integrity**: The service should ensure the accuracy and consistency of stored data. 6. **Usability and User Interface**: The service should be easy to use, with a well-designed API that makes it easy for developers to perform CRUD operations. Additionally, it should provide a user-friendly interface for manual labeling. Users should be able to query for labels under a certain confidence level and manually label them through this interface. The user interface should be intuitive, responsive, and accessible, allowing users to efficiently and effectively interact with the system. 7. **Dashboarding**: The service should provide a comprehensive dashboard that allows users to visualize the performance of the models over time. This dashboard should present key metrics and trends in an easy-to-understand format, enabling users to gain insights into model performance and make informed decisions. It should support various types of visualizations and allow users to customize the dashboard based on their specific needs. 7. **Maintainability**: The service should be easy to maintain, with clear documentation and well-structured code. 8. **Data Backup and Recovery**: The service should have mechanisms in place for backing up data and recovering it in case of a failure. 9. **Monitoring and Logging**: The service should have robust monitoring and logging capabilities to track its performance and troubleshoot issues. # Proto ```protobuf syntax = "proto3"; package telos.repository.label; option java_package = "com.telos.repository.label"; option java_multiple_files = true; import "telos/core/base/token/token.proto"; import "telos/core/record/record.proto"; import "telos/cortex/model/input.proto"; import "telos/cortex/model/output.proto"; import "telos/core/quantity/quantity.proto"; import 'google/protobuf/timestamp.proto'; import 'telos/core/base/status.proto'; message Label { telos.core.record.RecordKey label_key = 1; LabelType type = 2; LabelValue label_value = 3; LabelSource label_source = 4; LabelStatus status = 5; double confidence_score = 6; google.protobuf.Timestamp label_time = 10; } //message LabelKey { // oneof label_key_is_one_of { // telos.core.base.Token id = 1; // ex. Entity Instance Type/Instance // telos.core.record.RecordKey record_key = 2; // ex. Any feature // } //} // LabelType ontology is stored in the KG // label_type is coming from a Label Collection in KG which can have all possible types enum LabelType { LABEL_TYPE_UNKNOWN = 0; // image LABEL_TYPE_IMAGE_CLASSIFICATION = 1; LABEL_TYPE_IMAGE_BOUNDING_BOX = 2; LABEL_TYPE_IMAGE_SEGMENTATION = 3; LABEL_TYPE_IMAGE_SENTIMENT = 4; LABEL_TYPE_IMAGE_OBJECT_DETECTION = 5; LABEL_TYPE_IMAGE_OBJECT_TRACKING = 6; // text LABEL_TYPE_TEXT_CLASSIFICATION = 101; LABEL_TYPE_TEXT_SENTIMENT = 102; // entity LABEL_TYPE_NAMED_ENTITY_RECOGNITION = 200; } message LabelValue { telos.core.quantity.Quantity value = 1; // Label Should one_of ModelOutput: ModelClassificationOutput, ModelRegressionOutput? } message LabelSource { google.protobuf.Timestamp labeling_time = 1; // redundant?? oneof label_source_is_one_of { ManualLabelSource manual = 2; // rename to HumanLabelSource? AutomatedLabelSource automatic = 3; // rename to MachineLabelSource? } } message ManualLabelSource { uint64 user_id = 1; } message AutomatedLabelSource { uint64 model_instance_id = 1; } enum LabelStatus { LABEL_STATUS_UNKNOWN = 0; LABEL_STATUS_START = 1; LABEL_TO_BE_REVIEWED = 2; LABEL_UNDER_REVIEW = 3; LABEL_REVIEWED = 4; LABEL_APPROVED = 5; LABEL_REJECTED = 6; LABEL_STATUS_COMPLETE = 7; // add more label statuses as needed } message CreateLabelsRequest { repeated Label labels = 1; } message CreateLabelsResponse { telos.core.base.Status status = 1; repeated Label labels = 2; } message UpdateLabelsRequest { telos.core.record.RecordKey record_key = 1; } message UpdateLabelsResponse { telos.core.base.Status status = 1; repeated Label labels = 2; } message GetLabelsRequest { telos.core.record.RecordKey record_key = 1; // What about getting the latest of all the labels or query by confidence score? } message GetLabelsResponse { telos.core.base.Status status = 1; repeated Label labels = 2; } message DeleteLabelsRequest{ telos.core.record.RecordKey record_key = 1; // What about deleting the latest of all the labels or query by confidence score?labels or delete where (confidence score < x)? } message DeleteLabelsResponse { telos.core.base.Status status = 1; } ``` # HLD ![](https://hackmd.io/_uploads/ByOkSmn_2.jpg) # Design decisions ### CAP Theorem: Consistency Over Availability In the context of our Label Repository service, we prioritize consistency over availability. This decision is rooted in the potential business implications of dealing with inconsistent data. Labels play a critical role in our system. They are used to train machine learning models, make predictions, and ultimately drive business decisions. **If the labels are inconsistent, it could lead to inaccurate model training and erroneous predictions**. This, in turn, could lead to poor business decisions and potential loss. For instance, consider a scenario where we have a label that classifies a particular product. If due to a lack of consistency, the same product gets different labels, it could lead to confusion and misinterpretation. This could affect various downstream processes, including product recommendations, inventory management, and sales forecasting. Therefore, ensuring the consistency of our labels is of utmost importance. While availability is also important, we believe that it is more crucial to ensure that every read receives the most recent write. Even if this approach might lead to the service being temporarily unavailable under certain rare conditions (like network partitions), we consider it a worthwhile trade-off to prevent the potential business loss that could result from inconsistent data. This approach aligns with the principles of the CAP theorem, which states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees: Consistency, Availability, and Partition tolerance. In our case, we choose to prioritize Consistency and Partition tolerance over Availability. ### Asynchronous Mode Given the potential for dealing with large volumes of data in our Label Repository service, we have incorporated an asynchronous mode of operation. This mode is particularly useful when users need to create and upload large batches of labels. In the asynchronous mode, **users can create upload jobs that are processed in the background**. This means that the user doesn't have to wait for the upload to complete and can continue with other tasks. The system handles the upload process, freeing up the user's time and resources. Once an upload job is initiated, the system provides a job ID that can be used to track the progress of the upload. Users can check the status of their upload jobs at any time, providing them with flexibility and control over their tasks. Upon completion of the upload job, a report is generated detailing the outcome of the operation. This report includes information such as the number of labels successfully uploaded, any errors encountered, and other relevant details. This allows users to quickly identify and resolve any issues with their data. This asynchronous mode of operation enhances the scalability of our service, enabling it to efficiently handle large data volumes. It also improves the user experience by providing a non-blocking, responsive interface. ### Database Given our data structure and the composite primary key requirement (`record_key` + `label_type` +`label_time`), here are a few databases that could be suitable: 1. **PostgreSQL**: PostgreSQL is a powerful, open-source object-relational database system. It has strong support for JSON fields, which we need for the `label_value` field. It also supports composite primary keys. PostgreSQL is known for its robustness and its compliance with SQL standards. 2. ~~**MySQL**: MySQL is another popular open-source relational database management system. It also supports JSON fields and composite primary keys. However, its JSON support is not as advanced as PostgreSQL's.~~ 3. ~~**Cassandra**: Apache Cassandra is a highly scalable, high-performance distributed database designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. It supports composite primary keys and has some support for JSON, but it's not as comprehensive as PostgreSQL or MySQL.~~ 4. **MongoDB**: MongoDB is a source-available cross-platform document-oriented database program. It's classified as a NoSQL database program, and it uses JSON-like documents with optional schemas. However, MongoDB doesn't natively support composite primary keys. We would need to create a compound index on `record_key` and `label_time` fields. 5. **Couchbase**: Couchbase Server is a NoSQL document database with a distributed architecture for performance, scalability, and availability. It enables developers to build applications easier and faster by leveraging the power of SQL with the flexibility of JSON. Given our data structure, here's how you could define a PostgreSQL table to store label data: ```sql CREATE TABLE labels ( record_key text, -- type_id + uint64 label_type text, label_value jsonb, label_source text, status text, confidence_score numeric, label_time timestamp, PRIMARY KEY (record_key, label_type, label_time) ); ``` # Useful Links [How To Set Up An ML Data Labeling System](https://towardsdatascience.com/how-to-set-up-an-ml-data-labeling-system-4eea9b15181f) [TelOS Repository Master Presentation By Praveen](https://rilcloud-my.sharepoint.com/:p:/r/personal/vankayalapati_p_ril_com/_layouts/15/Doc.aspx?sourcedoc=%7B6885D71A-AF3E-48BE-B8C7-45AF30DE4785%7D&file=TelOS%20Repositories.pptx&action=edit&mobileredirect=true&DefaultItemOpen=1&login_hint=Krishna.Tiwari%40ril.com&ct=1687770118144&wdOrigin=OFFICECOM-WEB.START.EDGEWORTH&cid=bee14274-fc8d-4796-8b3b-fa346c45cea6&wdPreviousSessionSrc=HarmonyWeb&wdPreviousSession=07fa0c00-a0e9-4d99-a6a4-1761773749c9) [Annotation Service PRD by Praveen](https://rilcloud.sharepoint.com/:w:/r/sites/TelsOs/_layouts/15/Doc.aspx?sourcedoc=%7B09C4CEB1-0D28-45F9-B5C0-2A2959233C8A%7D&file=Annotation%20Service%20PRD.docx&action=default&mobileredirect=true) # Team Product : Praveen Tech Team : Supriyo, Shrimant, Krishna

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully