Json file uploaded is not showing in the grid - formsflow.ai

I have a sample PDF file and tried uploading it by converting it to JSON. It shows the upload is progressing. But I couldn't see my form. I have checked my JSON and is valid. Please help.
Below is my sample json
{
"forms": [{
"title": "sample pdf upload",
"display": "form",
"type": "form",
"name": "sample pdf upload",
"path": "sample pdf upload",
"tags": [
"common"
],
"pages": [{
"pageNo": 1,
"trimBoxOriginX": 0.0,
"trimBoxOriginY": 0.0,
"trimBoxWidth": 595.2755737304688,
"trimBoxHeight": 841.8897705078125,
"txtRns": [{
"leftX": 208.4706,
"bottomY": 67.3442,
"rightX": 405.8626,
"topY": 52.3362,
"baseLineY": 63.9842,
"fontId": 1,
"text": "Sample Fillable PDF Form"
},
{
"leftX": 51.52,
"bottomY": 87.0426,
"rightX": 565.0849,
"topY": 75.7866,
"baseLineY": 84.5226,
"fontId": 2,
"text": "Fillable PDF forms can be customised to your needs. They allow form recipients to fill out "
},
{
"leftX": 51.5177,
"bottomY": 100.4482,
"rightX": 459.0569,
"topY": 89.1922,
"baseLineY": 97.9282,
"fontId": 2,
"text": "information on screen like a web page form, then print, save or email the results."
},
{
"leftX": 57.189,
"bottomY": 149.4049,
"rightX": 136.557,
"topY": 138.1489,
"baseLineY": 146.8849,
"fontId": 3,
"text": "Fillable Fields"
},
{
"leftX": 57.189,
"bottomY": 169.2474,
"rightX": 89.193,
"topY": 157.9914,
"baseLineY": 166.7274,
"fontId": 2,
"text": "Name"
},
{
"leftX": 395.9291,
"bottomY": 169.2474,
"rightX": 424.6091,
"topY": 157.9914,
"baseLineY": 166.7274,
"fontId": 2,
"text": "Date "
},
{
"leftX": 425.838,
"bottomY": 169.4618,
"rightX": 432.51,
"topY": 157.4618,
"baseLineY": 166.5317,
"fontId": 4,
"text": "1"
},
{
"leftX": 463.838,
"bottomY": 169.5808,
"rightX": 483.182,
"topY": 157.5808,
"baseLineY": 166.6507,
"fontId": 4,
"text": "Jan"
},
{
"leftX": 509.904,
"bottomY": 169.5618,
"rightX": 536.5923,
"topY": 157.5618,
"baseLineY": 166.6317,
"fontId": 4,
"text": "2012"
},
{
"leftX": 57.189,
"bottomY": 186.2552,
"rightX": 101.205,
"topY": 174.9992,
"baseLineY": 183.7352,
"fontId": 2,
"text": "Address"
},
{
"leftX": 57.189,
"bottomY": 285.6365,
"rightX": 317.0465,
"topY": 274.3805,
"baseLineY": 283.1165,
"fontId": 3,
"text": "Tick Boxes (multiple options can be selected)"
},
{
"leftX": 57.189,
"bottomY": 305.479,
"rightX": 241.257,
"topY": 294.223,
"baseLineY": 302.959,
"fontId": 2,
"text": "What are your favourite activities? "
},
{
"leftX": 57.189,
"bottomY": 318.8849,
"rightX": 118.557,
"topY": 307.6289,
"baseLineY": 316.3649,
"fontId": 2,
"text": " Reading "
},
{
"leftX": 57.189,
"bottomY": 332.2908,
"rightX": 116.0851,
"topY": 321.0348,
"baseLineY": 329.7708,
"fontId": 2,
"text": " Walking "
},
{
"leftX": 57.1887,
"bottomY": 345.6966,
"rightX": 105.2007,
"topY": 334.4406,
"baseLineY": 343.1766,
"fontId": 2,
"text": " Music "
},
{
"leftX": 57.1887,
"bottomY": 359.1026,
"rightX": 107.2167,
"topY": 347.8466,
"baseLineY": 356.5826,
"fontId": 2,
"text": " Other: "
},
{
"leftX": 57.189,
"bottomY": 454.2137,
"rightX": 332.565,
"topY": 442.9577,
"baseLineY": 451.6937,
"fontId": 3,
"text": "Radio Buttons (only one option can be selected)"
},
{
"leftX": 57.189,
"bottomY": 474.0563,
"rightX": 223.245,
"topY": 462.8003,
"baseLineY": 471.5363,
"fontId": 2,
"text": "What is your favourite activity? "
},
{
"leftX": 57.189,
"bottomY": 487.4619,
"rightX": 118.557,
"topY": 476.2059,
"baseLineY": 484.9419,
"fontId": 2,
"text": " Reading "
},
{
"leftX": 57.189,
"bottomY": 500.8675,
"rightX": 116.0851,
"topY": 489.6115,
"baseLineY": 498.3475,
"fontId": 2,
"text": " Walking "
},
{
"leftX": 57.1887,
"bottomY": 514.2734,
"rightX": 105.2007,
"topY": 503.0174,
"baseLineY": 511.7534,
"fontId": 2,
"text": " Music "
},
{
"leftX": 57.1887,
"bottomY": 527.6793,
"rightX": 107.2167,
"topY": 516.4233,
"baseLineY": 525.1593,
"fontId": 2,
"text": " Other: "
},
{
"leftX": 57.189,
"bottomY": 622.7907,
"rightX": 257.865,
"topY": 611.5347,
"baseLineY": 620.2707,
"fontId": 3,
"text": "Buttons (to prompt certain actions)"
},
{
"leftX": 57.189,
"bottomY": 642.6332,
"rightX": 386.0129,
"topY": 631.3772,
"baseLineY": 640.1132,
"fontId": 2,
"text": "These buttons can be printable or visible only when onscreen."
},
{
"leftX": 67.2136,
"bottomY": 701.4379,
"rightX": 91.8856,
"topY": 689.4379,
"baseLineY": 698.5078,
"fontId": 4,
"text": "Print"
},
{
"leftX": 146.296,
"bottomY": 701.4379,
"rightX": 173.6441,
"topY": 689.4379,
"baseLineY": 698.5078,
"fontId": 4,
"text": "Save"
},
{
"leftX": 429.8151,
"bottomY": 808.3642,
"rightX": 562.5142,
"topY": 797.1082,
"baseLineY": 805.8442,
"fontId": 2,
"text": "www.worldofprinting.com"
}
],
"txtChars": null
}],
"fontSpecs": [{
"id": 1,
"fontFamily": "ArialMT,Bold",
"fontSize": 16.0,
"italic": false,
"bold": true,
"color": "#171615"
},
{
"id": 2,
"fontFamily": "ArialMT",
"fontSize": 12.0,
"italic": false,
"bold": false,
"color": "#171615"
},
{
"id": 3,
"fontFamily": "ArialMT,Bold",
"fontSize": 12.0,
"italic": false,
"bold": true,
"color": "#171615"
},
{
"id": 4,
"fontFamily": "Arial",
"fontSize": 12.0,
"italic": false,
"bold": false,
"color": "#000000"
}
]
}]
}

The Sample form Json syntax seems Wrong for the opensource formsflow.ai. The Open source form.io Package Doesn't support Pdf forms. Also, the upload Sample Json Should Include the "components" key which is missing in the above Form Definition.

Related

How to query the jsonb path of the given nested json data which shows expense details with name of customer

[
{
"WHO": "Joe",
"WEEK": [
{
"NUMBER": 3,
"EXPENSE": [
{
"WHAT": "Beer",
"AMOUNT": 18.00
},
{
"WHAT": "Food",
"AMOUNT": 12.00
},
{
"WHAT": "Food",
"AMOUNT": 19.00
},
{
"WHAT": "Car",
"AMOUNT": 20.00
}
]
},
{
"NUMBER": 4,
"EXPENSE": [
{
"WHAT": "Beer",
"AMOUNT": 19.00
},
{
"WHAT": "Beer",
"AMOUNT": 16.00
},
{
"WHAT": "Food",
"AMOUNT": 17.00
},
{
"WHAT": "Food",
"AMOUNT": 17.00
},
{
"WHAT": "Beer",
"AMOUNT": 14.00
}
]
},
{
"NUMBER": 5,
"EXPENSE": [
{
"WHAT": "Beer",
"AMOUNT": 14.00
},
{
"WHAT": "Food",
"AMOUNT": 12.00
}
]
}
]
},
{
"WHO": "Beth",
"WEEK": [
{
"NUMBER": 3,
"EXPENSE": [
{
"WHAT": "Beer",
"AMOUNT": 16.00
}
]
},
{
"NUMBER": 4,
"EXPENSE": [
{
"WHAT": "Food",
"AMOUNT": 17.00
},
{
"WHAT": "Beer",
"AMOUNT": 15.00
}
]
},
{
"NUMBER": 5,
"EXPENSE": [
{
"WHAT": "Food",
"AMOUNT": 12.00
},
{
"WHAT": "Beer",
"AMOUNT": 20.00
}
]
}
]
},
{
"WHO": "Janet",
"WEEK": [
{
"NUMBER": 3,
"EXPENSE": [
{
"WHAT": "Car",
"AMOUNT": 19.00
},
{
"WHAT": "Food",
"AMOUNT": 18.00
},
{
"WHAT": "Beer",
"AMOUNT": 18.00
}
]
},
{
"NUMBER": 4,
"EXPENSE": [
{
"WHAT": "Car",
"AMOUNT": 17.00
}
]
},
{
"NUMBER": 5,
"EXPENSE": [
{
"WHAT": "Beer",
"AMOUNT": 14.00
},
{
"WHAT": "Car",
"AMOUNT": 12.00
},
{
"WHAT": "Beer",
"AMOUNT": 19.00
},
{
"WHAT": "Food",
"AMOUNT": 12.00
}
]
}
]
}
]

mongodb update where argument exists

db.filmes.insertMany(
[
{
"num": 1,
"title": "movie1",
"category": "Horror",
"review": 5,
"cast": {
"director": "R1",
"artist": "A1"
},
"exibition": [
"Lisboa",
"Porto",
"Braga"
]
},
{
"num": 2,
"title": "movie2",
"category": "Action",
"review": 3,
"cast": {
"director": "R2",
"artist": "A2"
},
"exibition": [
"Lisboa",
"Porto"
]
},
{
"num": 3,
"title": "movie3",
"category": "Animation",
"review": 3,
"cast": {
"director": "R2",
"artist": "A2"
},
"exibition": [
"Lisboa",
"Porto",
"Viseu"
]
},
{
"num": 4,
"title": "movie4",
"category": "Animation",
"review": 6,
"cast": {
"director": "R1",
"artist": "A4"
},
"exibition": [
"Lisboa",
"Porto",
"Braga"
]
},
{
"num": 5,
"title": "movie5",
"category": "Horror",
"review": 5,
"cast": {
"director": "R3",
"artist": "A3"
},
"exibition": [
"Lisboa",
"Porto"
]
}
]);
I need to update all the reviews to 10 where artist "A3" appears?
I already tried :
db.movies.updateMany({cast:{artist:"A3"}},{$set:{review:10}})
db.movies.update({artist:"A3"},{$ste:{review:10}});
and other that I cant remember,
there's is a way to do it ?

Mongo query to group and calculate average with group by

I have a mongo collection mytopic with the following structure:
id : ObjectId
host: String
analytics: Object
topic_count : Array
name: String
mentions: Int
duration: Float
percentage: Float
I want to group by analytics.topic_count.name and return the average of duration for each user.
My expected output is :
Topic1: User1: <Average of duration for Topic1>
User2: <float>
User3: <float>
User4: <float>
User5: <float>
Topic2 User1: <float>
User2: <float>
User3: <float>
User4: <float>
User5: <float>
is it possible to get this kind of output. I am new to mongo and totally lost on this query. Any help is appreciated.
Thanks
Here is a partial export of my db collection:
[{
"_id": {
"$oid": "5edfd7a9c7152c8e6c708482"
},
"host": "user1",
"analytics": {
"topic_count": [
{
"name": "Topic1",
"mentions": 12,
"duration": 160.94,
"percentage": 5.76
},
{
"name": "Topic4",
"mentions": 9,
"duration": 108.14,
"percentage": 3.87
},
{
"name": "Topic3",
"mentions": 3,
"duration": 48.52,
"percentage": 1.74
},
{
"name": "Topic2",
"mentions": 8,
"duration": 95.5,
"percentage": 3.42
},
{
"name": "Topic5",
"mentions": 2,
"duration": 2.43,
"percentage": 0.09
},
{
"name": "Topic6",
"mentions": 4,
"duration": 55.75,
"percentage": 1.99
},
{
"name": "Topic7",
"mentions": 4,
"duration": 53.33,
"percentage": 1.91
},
{
"name": "Topic8",
"mentions": 4,
"duration": 45.37,
"percentage": 1.62
}
]
}
},{
"_id": {
"$oid": "5edfd7a9c7152c8e6c708483"
},
"host": "user1",
"analytics": {
"topic_count": [
{
"name": "Topic1",
"mentions": 14,
"duration": 209.85,
"percentage": 7.13
},
{
"name": "Topic4",
"mentions": 9,
"duration": 97.27,
"percentage": 3.31
},
{
"name": "Topic3",
"mentions": 3,
"duration": 37.13,
"percentage": 1.26
},
{
"name": "Topic2",
"mentions": 4,
"duration": 52.46,
"percentage": 1.78
},
{
"name": "Topic5",
"mentions": 2,
"duration": 3.13,
"percentage": 0.11
},
{
"name": "Topic6",
"mentions": 4,
"duration": 34,
"percentage": 1.16
},
{
"name": "Topic7",
"mentions": 4,
"duration": 79.9,
"percentage": 2.72
},
{
"name": "Topic8",
"mentions": 4,
"duration": 87.45,
"percentage": 2.97
}
]
}
},{
"_id": {
"$oid": "5edfd7a9c7152c8e6c708484"
},
"host": "user1",
"analytics": {
"topic_count": [
{
"name": "Topic1",
"mentions": 12,
"duration": 165.19,
"percentage": 5.91
},
{
"name": "Topic4",
"mentions": 9,
"duration": 112.15,
"percentage": 4.01
},
{
"name": "Topic3",
"mentions": 3,
"duration": 29.28,
"percentage": 1.05
},
{
"name": "Topic2",
"mentions": 4,
"duration": 46.74,
"percentage": 1.67
},
{
"name": "Topic5",
"mentions": 3,
"duration": 2.7,
"percentage": 0.1
},
{
"name": "Topic6",
"mentions": 4,
"duration": 17.59,
"percentage": 0.63
},
{
"name": "Topic7",
"mentions": 4,
"duration": 62.34,
"percentage": 2.23
},
{
"name": "Topic8",
"mentions": 4,
"duration": 57.62,
"percentage": 2.06
}
]
}
},{
"_id": {
"$oid": "5edfd7a9c7152c8e6c708485"
},
"host": "user1",
"analytics": {
"topic_count": [
{
"name": "Topic1",
"mentions": 12,
"duration": 226.65,
"percentage": 6.04
},
{
"name": "Topic4",
"mentions": 9,
"duration": 139.59,
"percentage": 3.72
},
{
"name": "Topic3",
"mentions": 3,
"duration": 44.85,
"percentage": 1.2
},
{
"name": "Topic2",
"mentions": 4,
"duration": 69.18,
"percentage": 1.84
},
{
"name": "Topic5",
"mentions": 2,
"duration": 18.07,
"percentage": 0.48
},
{
"name": "Topic6",
"mentions": 4,
"duration": 63.9,
"percentage": 1.7
},
{
"name": "Topic7",
"mentions": 4,
"duration": 57.19,
"percentage": 1.52
},
{
"name": "Topic8",
"mentions": 4,
"duration": 60.42,
"percentage": 1.61
}
]
}
},{
"_id": {
"$oid": "5edfd7a9c7152c8e6c708486"
},
"host": "user1",
"analytics": {
"topic_count": [
{
"name": "Topic1",
"mentions": 12,
"duration": 181.99,
"percentage": 6.31
},
{
"name": "Topic4",
"mentions": 9,
"duration": 102.66,
"percentage": 3.56
},
{
"name": "Topic3",
"mentions": 3,
"duration": 33.21,
"percentage": 1.15
},
{
"name": "Topic2",
"mentions": 4,
"duration": 55.31,
"percentage": 1.92
},
{
"name": "Topic5",
"mentions": 5,
"duration": 9.24,
"percentage": 0.32
},
{
"name": "Topic6",
"mentions": 4,
"duration": 35.82,
"percentage": 1.24
},
{
"name": "Topic7",
"mentions": 4,
"duration": 72.24,
"percentage": 2.51
},
{
"name": "Topic8",
"mentions": 4,
"duration": 30.3,
"percentage": 1.05
}
]
}
}]
Are you looking for something like this ?
db.collection.aggregate([
{
"$unwind": "$analytics.topic_count"
},
{
"$group": {
"_id": {
topic: "$analytics.topic_count.name",
host: "$host"
},
"duration": {
"$avg": "$analytics.topic_count.duration"
}
}
},
{
"$group": {
"_id": "$_id.topic",
"durations": {
"$addToSet": {
"$mergeObjects": [
{
"host": "$_id.host"
},
{
"duration": "$duration"
}
]
}
}
}
}
])
Here is working Mongo Playground

Need stacked column chart with multiple series

I have been stretching my head to get stacked column chart with multiple series. using google chart or highchart whatever is suitable.
I need to achieve the thing like below image:
Thanks a lot in advance.
One library that you can use to make this type of stacked column chart with multiple series is ZingChart.
Here's a fiddle of your chart with the ZingChart library:
var myConfig = {
"type": "bar",
"labels": [{
"background-color": "green",
"x": "65%",
"y": "23px",
"height": "15px"
}, {
"text": "Win",
"font-size": "20px",
"x": "68%",
"y": "15px"
}, {
"background-color": "red",
"x": "82%",
"y": "23px",
"height": "15px"
}, {
"text": "Loss",
"font-size": "20px",
"x": "85%",
"y": "15px"
}],
"stacked": true,
"stack-type": "normal",
"background-color": "#FFFFFF",
"title": {
"text": "Win Loss Report ",
"font-family": "arial",
"x": "40px",
"y": "5px",
"align": "left",
"bold": false,
"font-size": "16px",
"font-color": "#000000",
"background-color": "none"
},
"plot": {
"-bar-width": "25px",
"hover-state": {
"visible": false
}
},
"scale-x": {
"values": [
"JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
"JUL",
"AUG",
"SEP"
],
"line-color": "#7E7E7E",
"tick": {
"visible": false
},
"guide": {
"visible": false
},
"item": {
"font-family": "arial",
"font-color": "#8B8B8B"
}
},
"scale-y": {
"values": "0:70000:10000",
"short": true,
"line-color": "#7E7E7E",
"tick": {
"visible": false
},
"guide": {
"line-style": "solid"
},
"item": {
"font-family": "arial",
"font-color": "#8B8B8B"
}
},
"series": [{
"values": [
15000,
12000,
42000,
13000,
19500,
9750,
11500,
36500,
11750
],
"stack": 1,
"background-color": "red"
}, {
"values": [
13000,
8000,
5000,
20000,
17000,
10000,
34000,
6000,
5500
],
"stack": 1,
"background-color": "green"
}, {
"values": [
13000,
8000,
5000,
20000,
17000,
10000,
34000,
6000,
5500
],
"stack": 2,
"background-color": "red"
}, {
"values": [
15000,
12000,
42000,
13000,
19500,
9750,
11500,
36500,
11750
],
"stack": 2,
"background-color": "green"
}, {
"values": [
8000,
3000,
9000,
25000,
12000,
18000,
37000,
9900,
8800
],
"stack": 3,
"background-color": "red"
}, {
"values": [
11000,
10000,
32000,
10000,
10500,
8250,
9500,
30500,
9750
],
"stack": 3,
"background-color": "green"
}, {
"values": [
23000,
9000,
6000,
30000,
27000,
10000,
44000,
7000,
6500
],
"stack": 4,
"background-color": "red"
}, {
"values": [
12000,
22000,
52000,
33000,
29500,
8750,
12500,
38500,
21750
],
"stack": 4,
"background-color": "green"
}],
"tooltip": {
"visible": false
}
};
zingchart.render({
id: 'myChart',
data: myConfig,
height: 400,
width: 600
});
<head>
<script src="https://cdn.zingchart.com/zingchart.min.js"></script>
</head>
<body>
<div id='myChart'></div>
</body>
Basically, you would set up a stacked bar chart, and then add more sets of values. In each set of values, you would assign a stack number. Here are the docs for more detail: http://www.zingchart.com/docs/chart-types/bar/#bar__props_stacked_additional

vega horizontal bar charts

The vega documentation/tutorials suggest that setting up a horizontal bar chart is easy, but I can't figure it out for the life of me. How would I go about changing a vertical bar chart, such as http://vega.github.io/vega-editor/index.html?spec=bar, to a horizontal one?
Like this
{
"width": 200,
"height": 210,
"padding": "auto",
"data": [
{
"name": "raw",
"values": [
{"x": "A","y": 28},
{"x": "B","y": 55},
{"x": "C","y": 43},
{"x": "D","y": 91},
{"x": "E","y": 81},
{"x": "F","y": 53},
{"x": "G","y": 19},
{"x": "H","y": 87},
{"x": "I","y": 52}
],
"format": {"parse": {"y": "number"}},
"transform": [{"type": "filter","test": "(d.data.y!==null)"}]
}
],
"scales": [],
"marks": [
{
"_name": "cell",
"type": "group",
"properties": {
"enter": {"width": {"value": 200},"height": {"value": 210}}
},
"scales": [
{
"name": "x",
"type": "linear",
"domain": {"data": "raw","field": "data.y"},
"range": [0,200],
"zero": true,
"reverse": false,
"round": true,
"nice": true
},
{
"name": "y",
"type": "ordinal",
"domain": {"data": "raw","field": "data.x"},
"sort": true,
"range": [0,210],
"bandWidth": 21,
"round": true,
"nice": true,
"points": true,
"padding": 1
}
],
"axes": [
{
"type": "x",
"scale": "x",
"properties": {
"grid": {
"stroke": {"value": "#000000"},
"opacity": {"value": 0.08}
}
},
"layer": "back",
"format": "",
"ticks": 5,
"titleOffset": 38,
"grid": true,
"title": "y"
},
{
"type": "y",
"scale": "y",
"properties": {
"labels": {"text": {"template": "{{data | truncate:25}}"}},
"grid": {
"stroke": {"value": "#000000"},
"opacity": {"value": 0.08}
}
},
"layer": "back",
"titleOffset": 28,
"grid": true,
"title": "x"
}
],
"marks": [
{
"type": "rect",
"from": {"data": "raw"},
"properties": {
"enter": {
"x": {"scale": "x","field": "data.y"},
"x2": {"value": 0},
"yc": {"scale": "y","field": "data.x"},
"height": {"value": 21,"offset": -1},
"fill": {"value": "#4682b4"}
},
"update": {
"x": {"scale": "x","field": "data.y"},
"x2": {"value": 0},
"yc": {"scale": "y","field": "data.x"},
"height": {"value": 21,"offset": -1},
"fill": {"value": "#4682b4"}
}
}
}
],
"legends": []
}
]
}
I generated this chart from
{
"data": {
"values": [
{"x":"A", "y":28}, {"x":"B", "y":55}, {"x":"C", "y":43},
{"x":"D", "y":91}, {"x":"E", "y":81}, {"x":"F", "y":53},
{"x":"G", "y":19}, {"x":"H", "y":87}, {"x":"I", "y":52}
]
},
"marktype": "bar",
"encoding": {
"y": {"type": "O","name": "x"},
"x": {"type": "Q","name": "y"}
}
}
with vega-lite (https://vega.github.io/vega-lite/).