New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic JSON schema #103
Comments
Hello @ceckoslab |
Hello @korzol I like the idea for having a schema builder as a standalone part. I am curious if during this task we will have software design changes. Are you planning to add new methods and do changes in Metrics, Filters and Layout classes? If yes, then could you share some details. Also did you play with Unit Test for the new class SchemaOrchestrator? Have a nice day. |
I'd like not to change anything currently existing. For now. If there will be any changes required I will do it and let you know, so we can discuss it. Thanks |
Hello @ceckoslab |
Hello @korzol , The defaults will be:
|
Hello @ceckoslab Here is a piece of code we have currently in use:
As you can see period and filter can exists simultaneously. Probably it's just wrong copy/paste. Kindly clarify P.S. Meantime I use the following for default/global filter
|
Hello @korzol I looked at the PR: https://github.com/basicrum/backoffice/pull/115/files I suggest 2 things:
If the link doesn't work please create your own diagram here https://www.diagrams.net/ and share it later. After we finish with the diagram we check thing number 2.
This:
becomes:
|
Hello @ceckoslab public function getDataFlavor($renderType): string
{
$dataFlavor = '';
if ( $renderType == 'time_series' )
{
$dataFlavor = '"data_flavor": {
"type": "object",
"properties": {
"percentile": {
"enum": [50],
"type": "integer"
}
}
}';
}
elseif ( $renderType == 'plane' )
{
$dataFlavor = '"data_flavor": {
"type": "object",
"properties": {
"histogram": {
"type": "object",
"properties": {
"bucket": {
"enum": [200],
"type": integer
}
}
}
}
}';
}
elseif ( $renderType == 'distribution' )
{
$dataFlavor = '"data_flavor": {
"type": "object",
"properties": {
"count": {
"type": "boolean"
}
}
}';
}
return $dataFlavor;
}
public function getDataMetrics($renderType): string
{
$segmentMetricsPart = '
"technical_metrics": {
"type": "object",
"properties": {
';
foreach ($this->technicalMetricsClassMap as $key => $class)
{
$entry = new $class;
$segmentMetricsPart .= '
"'.$key.'": {
"type": "object",
"properties": {
'.$this->getDataFlavor($renderType).'
}
}';
}
$segmentMetricsPart .= "
}
}
";
return $segmentMetricsPart;
} Right now want to implement similar thing into BusinessMetrics/Collaborator.php Also I think it would be a good idea to deploy some php class which can convert php array into JSON schema, if there is any. So for example in getDataFlavor function I can simply give it an array and accept a piece of schema. But still not sure if there already exist any or I have to write one new. Once I done with business metrics I will check |
Hello @ceckoslab |
Hello @korzol I looked at the code and my feeling is that we need to discuss things about the software architecture and which logic stays where. I suggest that we do a peer codding session at some point. If possible this Friday ... perhaps you may take take Monday as a day off. Here are the things that I have specific comments:
It will be better we have arrays but not JSON strings concatenation now because later it will be more harder to refactor and maintain JSON strings.
I urge you to stop implementing new code but to do point 1. and to work on point 3. Feel free to explore the internet about publications for dynamic schemas, you can watch again the Vega Lite video ... feel free to do more research. |
Hello @ceckoslab
|
Also I am not going to implement any new code. I was going to put existing one in order |
Hello @ceckoslab Also global.data_requirements.period's parameters - type, start, end - still have to be added onto diagram |
Hello @ceckoslab |
Hello @ceckoslab Kindly review it and let me know. Meantime going to work on tests |
Hello @ceckoslab Kindly review and let me know your thoughts |
As of diagram from this post.
Kindly clarify |
Hello @korzol
|
Hello @ceckoslab
In the example above I have only one segment - 1. However it is possible to add more segments 2, 3, 4 etc.. accordingly. And in schema I use $ref feature like this:
Now, I am not sure how to make schema works for segments 2, 3, 4 etc..
Let me know, what you think |
Hello @korzol I am answering on:
Could you explore option 2? I think that it will be good because the number of segments will vary. |
Hello @ceckoslab Ran tests locally and it went fine. Travis as well reported tests went fine Kindly review and let me know |
I also tested if we can use array instead of object for segments on dashboards diagrams. And they worked well |
* Added info how to access phpmyadmin locally * WIP. Basement for dynamic schema implementation * Bootstrap version bump. Current version doesn't support modal-xl modal dialog class * Bootstrap version bump. Current version doesn't support modal-xl modal dialog class * Widget creation modal window redesign * WIP. Outstanding changes * Latest updates to dynamic json schema generator * Concatenation to array * Move code out of collaborators * phpunit tests for dynamic schema * Remove outstanding unneeded function * Remove DiagramBaseJson.php in favor of default_json.js * Fix: number of days in schema * Filters Schema plugins under src/BasicRum/DiagramSchema/ * Preselected diagram type in JSON editor * Dynamic diagram tests. Switch from json to arrays comparison * Fix: AbstractFilters * Add: oneOf to technical and business metrics * Update dynamic diagram tests reflecting latest diagram changes * Fix: echo schema * Migrate segments from object to array * Migrate segments from object to array #2 * New getDataFlavor function and general cleanup * Clean unneeded function * Following the best practices to output Json from controller * Now technical metrics depend on render_type * Changes in tests reflecting latest changes in diagram * Slightly widget controller cleanup * Revert occasionally submitted file * Remove outdated bootstrap Co-authored-by: ceckoslab <ceckoslab@gmail.com>
We are about to finish the initial ticket for static JSON #81 schema and now is the right moment to continue working on this topic and implement dynamic JSON schema.
I think that we can start looking at this class that returns us all needed Metrics, Filters and Decorators: src/BasicRum/CollaboratorsAggregator.php
Let's outline how we could implement this:
The text was updated successfully, but these errors were encountered: