Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Importing lots of data points


  • Hi guys,

    In the past I've seen a video (or couple of them) around here explaining how to import lots of data points using an excel + word combination.
    I wanted to try that but I can't seem to find those videos anywhere anymore.

    Can someone give me a hand please?
    Regards
    Rodrigo



  • I've also offered a few python scripts from time to time that can do this effectively. They're all based on having the base JSON for something and some kind of input (like a CSV or formula) to populate the JSON.

    import json
    from StringIO import StringIO
    
    baseItem = """{"xid":"DP_12345", "name":"%(name)s", "someKey":"%(someValue)s"}"""
    
    csvFile = open("/path/to/csv")
    output = {"items":[]}
    for line in csvFile :
      data = line.replace("\r", "").replace("\n", "").split(",")
      output["items"].append( json.load( StringIO( baseItem % {"name": data[1], "someValue": data[2]} ) ) )
    
    csvFile.close()
    
    outputFile = open("/path/to/output.json", "w+")
    outputFile.write(json.dumps(output, sort_keys=False, indent=4, separators=(",",": ")))
    outputFile.close()
    

  • I answer more than a month late, but thanks (better late, than never).

    I'll check on your sugestions now.

    Regards
    Rodrigo


  • Hi Joel,
    In the video you recommended, you say that in a future video you are going to explain how to use CSV files to import lots of data points, you haven't made that video yet, right?
    In this video you explain how to use the property template, I found this tool to be extremely useful, but my lack of imagination :) doesn't let me understand how to use that to import lots of data points, are you trying to tell me that I should create the points one by one, and use the property template to assign the same properties to all of them?

    Hi Phil
    I thank you for your attempt to help me, but I know nothing about coding, so for me, what you wrote may well be chinese :$
    I really appreciate your message though.

    Regards,
    Rodrigo


  • Looks like you are correct. I'll try to do a video on that soon. Basically, you can export a data source as csv using the csv icon on the data source page next to each data source. You can then modify the file and import the csv again on the Configuration Import Export page but be sure to change the drop down from json to csv when importing.

    When importing csv you have to specify the xid of each data point and you also need to assign a template to each data point in the csv.

    Hope that helps.


  • @JoelHaggar

    Thanks Joel, I'll try that, now I'm trying to use the json import export.
    I have 70 fan coils on a building an each fan coil controller has 10 points or so, I created all the points for one controller, exported this in json format and now I'm modifying that file and adding the points of the rest, let's see how it goes.

    Regards,
    Rodrigo