5 Replies Latest reply on Nov 27, 2017 4:38 PM by pselvaraj-2 RSS
    khayes Apprentice

    Data modelling question


    I was wondering what peoples thoughts might be as the best way to achieve some data storage in my project.


    I am trying to create a table to store how a customer wants the server to respond to certain events (i.e. via sms, email, no response etc.). Our remote assets produce a number of events types (c.30 different types) which are subscribed to on the platform. These are events things like 'Fault condition' 'User Login' 'Temperature too high'.


    I am trying to create a mash up which will allow a customer to configure which events they wish to be notified about. So, my question is what would be the best way of storing their notification configuration? Assuming I have a datashape to describe the response for each event type, something like

    What would be the best method to store the user defined configuration. Bearing in mind that there will be hundreds of customers, and that we might/will add more event types, which of the following should I use?

    1. Infotable of the above shape as property of each customer thing
    2. One Data Table for all customers, where each row would reflect the datashape above but include a customer id
    3. One data table for each customer
    4. Thingshape that has properties to encapsulate every event type and how the customer wishes to be notified. I could add this thingshape to the customer thing.


    Thanks in advance.

      • Re: Data modelling question
        pchung Collaborator

        I would probably go with either the InfoTable property of a Customer Thing or the DataTable.

        A little more robust in a DataTable but response will be a bit slower.

        • Re: Data modelling question
          wposner-2 Creator

          I'm assuming customers are actual TWX users (have a username and pw).  If so, you can simply add your infotable property to the UserExtensions Thing Shape and not have to worry about a custom customer thing.  But every time you have an event occur, you would need to loop through all your users to get their subscribed events and method of notification. 


          I think it will be faster to store everything in a DT, and then for each event, query the DT for that event ID to get just the users subscribed to that event, along with their notification preference.  This quickly gives you a single IT to deal with that you can loop over and fire notifications based on the boolean preference selection rather than having to loop over every user, check if they're subscribed to the event and then do something.

          • Re: Data modelling question
            pselvaraj-2 Explorer

            Thing properties are sit in JVM so obivously it would raise performance isssues if the user count increases. so keeping infotable has a property is not advisable. If there is a way to categorize the user types then you can create streams for each category and keep the notification configuration information. Compare to datatable, stream will be having faster reponse since it is optomised and comes with default timestamp filters.