2. Example Data Flashcards
1
Q
How do you open the code window?
A
click on the < / > icon at the top of the Developer Portal:
2
Q
How do you create example data?
A
- Go to example_data.json
- Use the format:
[{
“a”: 5,
“b”: 3,
“c”: 8
}]
3
Q
What is a value node and how is it stored?
A
Value nodes store an individual data item, such as data item “a” in the example.
They are defined in the example data as key value pairs, where the key (i.e. “a”) is the name of the variable and the value (i.e. 5) is the value you wish to assign to it.
4
Q
What conventions are used for example data?
A
- The example data will be used to generate the first iteration of your data schema so you must ensure your data types match ensure your data types match:
- Numbers can be defined as integers (whole round numbers) or floats (numbers with decimal places). Assigning the value 15 will produce an integer in your data schema, whilst 15.0 will be detected as a float.
- When defining numbers, do not include thousand separators as the formatting of numbers occurs later, i.e. 15000.0, not 15,000.
- Define percentages as 0.05 instead of 5%.
- If blank in the example model. It can defined as an empty string, “”.
- Variables declared as a Boolean, can only have one of two possible values: true or false, these values do not need to be encompassed in speech marks.
- Only use lower-case when defining variables and replace spaces with underscores.
- The data schema is case-sensitive
- Dates are entered in the format “YYY-MM-DD”
5
Q
What are hx core items? How are they declared?
A
- Fields marked as ‘hx core’ items or ‘header fields’ in the spreadsheet.
- hx core items are already predefined. However, the user may wish to set specific values to hx core items for testing such as the inception date and expiry date in their example data.
- This is done by accessing the hx_core structure and specifying values for its children:
[
{…,
“hx_core”: {
“inception_date”: “2019-01-01”,
“expiry_date”: “2019-12-31”
}
}
]
6
Q
What are structure nodes?
A
- Structure nodes group and organize value nodes together, for example:
[
{…,
“territory”: {
“value”: “UK”,
“adjustment”: 0.0,
“comment”: “”
}
}
] - territory is the structure node and the children are value, adjustment, comment
7
Q
What are list nodes?
A
- List nodes are used to define a repeating structure which contain an ordered collection of other nodes.
- Each row should be defined inside its own set of curly brackets, and should be separated from the previous row by a comma.
- Totals are defined outside of the list as a totals structure. For example:
[
{…,
“layers”: [
{
“name”: “Primary 1m”,
“limit”: 1000000.0,
“excess”: 0.0,
},
{
“name”: “4x1”,
“limit”: 4000000.0,
“excess”: 1000000.0
},
{
“name”: “5x5”,
“limit”: 5000000.0,
“excess”: 5000000.0,
}
],
{…,
“layer_totals”: {
“calculated_premium”: 0.0,
“charged_premium”: 1300000.0,
“ulr”: 0.0
}
}
]
8
Q
How do you know if you haven’t saved your program? How do you save it?
A
- if there is a white cirle by the name in the workspace (left hand column)
- ctrl + s
9
Q
How do you generate the data schema?
A
- Enter the debug section of the IDE by clicking on the debug icon. Or press ctrl + shift + D
- From the dropdown select “Generate Data Schema”
- Click the green play button
- Once this script has run, a new file will appear in your data schema folder
- This file has translated your example data into the syntax required for the data schema.
- Delete the old data schema file (data_schema.py) by right clicking on it and selecting delete, then confirm by clicking “OK”. Do not delete or edit data_schema_static.py as it is a system generated file.
- In the data_schema folder, right click on your new file (_example_data_YYYYMMDD_HHMMSS.py) and rename this data_schema.py.