i've seen an example where one uses the map method to 'extract' images from hardcoded data (eg an array containing image paths) to display pictures on a webpage.
i'd like to do something similar except this data which is now external sits in a mysql database.
my thinking is maybe there's a way to import mysql data into an array variable to expose this data to the map method, mimicking the hardcoded scenario? just looking to see if i'm on the right track or whether i should be barking up another tree.
Related
My model in Autodesk construction cloud contains several properties which I need to track. I have downloaded the sqlite file using fetch derivative download URL without any errors.
However when comparing export with what I see in ACC, or the Fetch all properties call, some properties are entirely missing. For instance, the fetch all properties call returns the 20 expected property values whereas only 3 of these values exist in the SQLite download. Any explanation why the SQLite file may be incomplete? There doesn't seem to any size restriction or filter in the call returning SQLite which may explain partial results.
It is expected that the design metadata returned via sqlite and via JSON may not be the same. For example, the metadata captured in the sqlite database use "instancing" where multiple design elements may inherit certain properties from another element (and the resolution of the inherited properties is left to whomever is reading this file). The JSON format on the other hand does not support any kind of inheritance, so properties are duplicated for each individual design element.
I am working on a GUI (PyQt6) where the user loads some files and adds metadata for each. So for each file, I would like to have a window (QDialog) which is essentially a form with fields which are specified by a json schema.
I am new to PyQt and I can code the mechanism to open a form (QDialog with QLabels and QLineEdit which essentially looks like a form. see image). However, I would like to automatize this step using the schema that's stored in a json file (consider any example json schema).
Is there already a python library for this and I'm absolutely obvious about it?
How would you go about coding this? Thanks!
Blocked out the data for personal reasons.
Essentially I am passing images from a MongoDB to NodeRed and parsing the actual image file back to base64 to create a set of up to 100 images (records) and the "alarm" description. The table is done in HTML template with input coming from Mongo Query.
With 3 pieces of information that is "linked" together (Time, Alarm, Image) the information separately does no good.
What I'm trying to determine if there is a good way to download the full table (images included) in a logical way.
Methods tried:
Excel download - Formatted properly, rows/columns exist but images are not saved properly because they technically aren't being stored in the table, just referencing from the MongoDB Query.
Canvas->Table inside Canvas: this one has yielded little success. Idea: Make a canvas and have the table inside (yielding an image that could be saved, removing search-ability but easy to view). Either I don't fully understand how HTML canvas drawing works or Node-Red handles some things differently. I got a blank canvas when linking table to canvas by object ID of table.
SelectAll/Copy/Paste: This one works, pasting into a doc has everything formatted in table, but not automated/scripted.
Looking for a way to "triggered"/on button press to save the current table contents and save them. CtrlP/print to PDF and such work fine. Looking specifically to save the Table or an object similar in nature.
I cannot post/link the flow because of data/security reasons.
If there is a better option for managing data that needs to be in a format with 3 columns and 100 rows I am also open to changing the HTML. I am not an expect in best practices for frontend, this is only going to be used for creating a report.
I would like to visualize data from csv file at node-red ui.
What I would like to do is to show behind a flag of a country the countity from the csv file. So into the csv file I have 2 columns (country, quantity).
Because of I am new at node-red I would like to get some hints how to do that.
Thanks in advance.
my flow with CSV data
Welcome to Node-RED!
Firstly you need to decide what kind of UI you would like. Node-RED has options for a number ranging from the creation of data driven web pages using the http-in/out and template nodes through the more dynamic but slightly more complex Dashboard through to full-power dynamic web-apps using things like node-red-contrib-uibuilder.
The very simplest approach is to use an http-in and an http-out node to define a web page. Then to add your file reader after the http-in then the CSV node (which turns the CSV data into JSON). Then you could use node-red-contrib-tableify to turn your JSON into an HTML table. Finally use the template node to insert the table into the html that the http-out node sends back to the browser.
http-in -> file read -> csv -> tablify -> template -> http-out
Once you've mastered that, you could go on either to smarten up the template or swap to using Dashboard or even uibuilder depending on your needs.
I have to create a web page first, right?
You define the URL in the http-in node. When the -in is connected to the -out, you have a "page". Albeit with no content. To create content you can use the template node. In fact, pushing the csv data through the tablify node and into the template would give you enough of a page to see the data. The templatate itself need only be:
<pre>{{payload}}</pre>
Though, of course, you can also wrap that with other HTML elements as needed. But that alone should be enough to render something useful.
How can I trigger the http-in?
You simply reference the URL from your browser. So if you set the http-in node to use URL /fred and you used a browser on the same device that is running Node-RED, you would use the URL http://localhost:1880/fred in your browser.
How should I design the web page to be able to put the information from the csv file into it by the http-out node?
The tablify node does that for you.
String together what I've outlined and you should see something that will let you go further.
I suggest just using http-in, template and http-out nodes to start so that you can see how they work together. Then feed in your data without the csv or tablify nodes, then add the csv and finally the tablify. That way you can see how things work.
I was using Behave and Selenium to test on something that use a large amount of data. Data tables were becoming too big and making the Gherkin documentation unreadable.
I would like to move most of the data from data tables to external file such as JSON. But I couldn't find any examples on websites.
I cannot offer an example at the moment, but I would create the JSON file as needed and give reference to the JSON file in Given or Background , then capture the value in the respective decorated method.