Skip to content

proposal: simplify database configuration #27

@dannyrandall

Description

@dannyrandall

The most complex part of the av-control-api as it stands is the database configuration. There is a lot of overhead that we've introduced from our early SQL migration as well as legacy configuration items would either no longer use, or thought we would need but don't. I think that it would make it much easier for other organizations to use and configure their systems if we take the time to simplify the configuration by removing unnecessary pieces.

I'll go through each of the databases and note all of the changes that could be made to each of them.

Buildings

There is zero useful info in the buildings database. Remove it.

Room Configurations

This is a notoriously confusing database. Its function is to make it possible to pick specific command evaluators for a given room. In practice, we have written command evaluators that will work in all cases, and just use the same room configuration in every single room. I think that removing this database and "baking" the command evaluators to run into the API itself would make the configuration much easier to understand - the theoretical loss in picking which command evaluators to use would require smarter command evaluators in some cases, which I think is a worthwhile tradeoff.

Rooms

  • Remove the configurationID block since it will no longer be needed with the removal of room configurations.
  • The name field can be removed; only the _id field should be used for identifiying the document.
  • Add a tags block - a map of string to interface{} (string, bool, number, or object). If someone wants the ability to filter their rooms in some manner, you could do so with tags. We could add predetermined tags into the config tool (like notes below) if we wanted specific tags to be filled out by the installers or support.
  • Remove description. notes can be added to tags to match what it would be used for in the config tool.
{
  "_id": "ASB-A343",
  "designation": "production",
  "tags": {
      "notes": "- Has a light in the ceiling\n - Secret door behind the podium",
      "capacity": 50,
      "roomType": "MMC", // or podium, etc
      "activeClassroom": true
  }
}

Device Types

  • Remove the description field
  • Remove the display_name field
  • Remove the source, destination, and tags fields
  • Remove ports - it's only being used for our config tool right now
  • Remove roles: Its functionality can be met through commands - e.g., if there is a command to GetBlank, then that should be reflected in the API response. To figure out which devices should be shown in the API response (roles VideoOut, AudioIn, etc), we simply build the graph for both audio & video and know that the devices at the end of the graph are devices that should be in the response.
  • commands
    • becomes a map of CommandID to an object that includes the following fields:
      • address: the full URL of request for the av-api to send
      • order: if multiple actions are generated at the same time, this defines the order they should be executed in. If order is missing, the command is placed after all order'd commands
    • remove description
    • remove microservice object
    • remove endpoint object
{
  "_id": "Atlona6x2",
  "commands": {
  // this is a map because I can't think of a reason to have multiple of
  // a specific command. If there is a reason, this can be and array
  // of objects.
    "ChangeInput": {
        "address": "http://localhost:8026/{{.Address}}/output/{{.Output}}/input/{{.Input}}/6x2",
        "order": 10
    },
    "InputStatus": {
        "address": "http://localhost:8026/{{.Address}}/ouput/{{.Port}}/6x2",
        "order": 10
    }
  }
}

Devices

  • Remove display_name - this belongs in the UI configuration.
  • Remove description. notes can be added in tags like in Rooms.
  • Change type._id to just be typeID - it still maps back to a device type
  • Remove roles - see the above reasons on device types.
  • Proxy remains the same
  • ports
    • _id changes to name
    • remove friendly_name, description, source_device, destination_device
    • add source - a bool indicating that the traffic "originates" from this device
    • add type - a string indicating the type of "traffic" going to/from the port
    • add endpoint - the ID of the device connected to the other side of the port
  • Change tags to match Room tags
{
    "_id": "TNRB-240-SW1",
    "address": "10.66.51.242", // or a hostname here
    "typeID": "Atlona6x2",
    "proxy": {
        ".*": "TNRB-240-CP1.byu.edu"
    },
    // we do have cases where multiple ports with the same name
    // exist, so this should be an array - not a map
    "ports": [
        {
    	    "name": "IN1",
    	    "endpoint": "ITB-1101-VIA1",
    	    "source": false,
            "type": "video"
        },
        {
            "_id": "OUT33",
            "endpoint": "TNRB-240-D1",
            "source": true,
            "type": "video"
        }
    ],
    "tags": {
        "notes": "Located in the ceiling in TNRB 250",
        "color": "red",
        "speed": 300,
        "old": false
    }
}

UI Configuration

The database changes for UI Configuration will be addressed in a proposal in the UI repo

Making these changes will require updating the av-control-api command evaluators to use the new configuration objects, as well as any services that also use the configuration (via, shure, device-monitoring, BFF, etc). We would also want to write a script to go through items in the database and convert their existing data into this new format. I would expect this change to take my time and two students' time for around a month to get the core API and drivers updated. There would be additional time required to update SMEE depending on how far along we are with that tool, and some (around 1 sprint of time, one person) to update the BFF.

Please feel free to respond with any thoughts you have on how we can improve these changes.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions