Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in
beat.backend.python
beat.backend.python
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 5
    • Issues 5
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • beat
  • beat.backend.pythonbeat.backend.python
  • Issues
  • #34

Closed
Open
Opened Jun 09, 2020 by Amir MOHAMMADI@amohammadi
  • Report abuse
  • New issue
Report abuse New issue

The database View class could be simplified

I don't know exactly the internals of beat but I wonder why the database view class needs to be this complicated? There may be some technical reasons behind this but I don't think this should be exposed to the users. These Views are just a container as far as I can see. So, I wonder if having something like:

class Train:
    """The training set"""

    def __init__(self, parameters=None, root_folder=None):
        self.parameters = parameters
        self.root_folder = root_folder
        # initialize the db interface here
        # e.g. load a csv file
        import pandas as pd

        self.df = pd.read_csv(...)

    def __len__(self):
        # return the total number of items in here
        return len(self.df)

    def __getitem__(self, index):
        # return the nth row in here
        row = self.df.iloc[index]
        # load the data here if necessary
        row.image = load(row.filename)
        return row

would not satisfy the requirements.

Edited Jun 09, 2020 by Amir MOHAMMADI
Assignee
Assign to
Interactivity and Intuitive API
Milestone
Interactivity and Intuitive API
Assign milestone
Time tracking
None
Due date
None
0
Labels
None
Assign labels
  • View project labels
Reference: beat/beat.backend.python#34