{"id":20682668,"url":"https://github.com/ficodes/smart-datamodel-views","last_synced_at":"2026-03-07T16:33:55.195Z","repository":{"id":99275346,"uuid":"244863295","full_name":"Ficodes/smart-datamodel-views","owner":"Ficodes","description":null,"archived":false,"fork":false,"pushed_at":"2021-03-25T10:06:10.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-10T20:47:46.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ficodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-04T09:49:19.000Z","updated_at":"2021-03-25T10:06:13.000Z","dependencies_parsed_at":"2023-03-16T02:31:53.847Z","dependency_job_id":null,"html_url":"https://github.com/Ficodes/smart-datamodel-views","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ficodes/smart-datamodel-views","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ficodes%2Fsmart-datamodel-views","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ficodes%2Fsmart-datamodel-views/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ficodes%2Fsmart-datamodel-views/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ficodes%2Fsmart-datamodel-views/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ficodes","download_url":"https://codeload.github.com/Ficodes/smart-datamodel-views/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ficodes%2Fsmart-datamodel-views/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30221511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T14:02:48.375Z","status":"ssl_error","status_checked_at":"2026-03-07T14:02:43.192Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T22:14:18.013Z","updated_at":"2026-03-07T16:33:55.176Z","avatar_url":"https://github.com/Ficodes.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart Datamodel Views\n\nJson rules and html templates for the consumption of generic NGSI datamodel 2 PoI operator.\n\nHtml templates are based on [nunjucks](https://mozilla.github.io/nunjucks/).\n\nJson rules are based on [json-rules-engine](https://github.com/CacheControl/json-rules-engine/blob/master/src/engine-default-operators.js)\n\n**Json rules examples**:\n\n**To check if property exists explanation for icon**:\n\n```json\n\"icon\": {\n    \"default\": {\n                \"fill\": \"rgba(121, 188, 106, 0.3)\",\n                \"stroke\": \"rgb(99, 112, 30)\"\n    },\n    \"rules\": [\n        {\n            \"event\": {\n                \"type\": \"existProp\",\n                \"params\": {\n                    \"success\": \"https://cdn0.iconfinder.com/data/icons/4web-3/139/location-64.png\"\n            },\n\n            \"name\": \"availableSpotNumber\",\n            \"priority\": 10,\n            \"conditions\": {\n                \"all\": [\n                    {\n                        \"fact\": \"existProp\",\n                        \"operator\": \"equal\",\n                        \"params\": {\n                            \"property\": \"availableSpotNumber\"\n                        },\n                        \"value\": false\n                    }\n                ]\n            }\n        }\n    ]\n}\n```\nThe default property is the result returned in the event that none of the rules is met.\nIf the object does not contain the property \"availableSpotNumber\", stop all other conditions and return success value.\nThe name and the \"conditions.all.params.property\" must be have the same value.\n\n**Example to define template property:**\n```json\n{\n  \"infoWindow\": \"{%OffStreetParking.html%}\"\n}\n```\n\n**Complete example for offStreetParking:**\n```json\n{\n    \"id\": \"id\",\n    \"icon\": {\n        \"default\": \"https://cdn0.iconfinder.com/data/icons/4web-3/139/location-64.png\",\n        \"rules\": [\n            {\n                \"event\": {\n                    \"type\": \"existProp\",\n                    \"params\": {\n                        \"success\": \"https://cdn0.iconfinder.com/data/icons/4web-3/139/location-64.png\"\n                    }\n                },\n                \"name\": \"availableSpotNumber\",\n                \"priority\": 10,\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"existProp\",\n                            \"operator\": \"equal\",\n                            \"params\": {\n                                \"property\": \"availableSpotNumber\"\n                            },\n                            \"value\": false\n                        }\n                    ]\n                }\n            },\n            {\n                \"event\": {\n                    \"type\": \"\",\n                    \"params\": {\n                        \"success\": \"https://cdn0.iconfinder.com/data/icons/4web-3/139/location-64.png\"\n                    }\n                },\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"availableSpotNumber\",\n                            \"operator\": \"lessThanInclusive\",\n                            \"value\": 5\n                        }\n                    ]\n                }\n            },\n            {\n                \"event\": {\n                    \"type\": \"\",\n                    \"params\": {\n                        \"success\": \"https://cdn0.iconfinder.com/data/icons/4web-3/139/location-64.png\"\n                    }\n                },\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"availableSpotNumber\",\n                            \"operator\": \"lessThanInclusive\",\n                            \"value\": 10\n                        }\n                    ]\n                }\n            },\n            {\n                \"event\": {\n                    \"type\": \"\",\n                    \"params\": {\n                        \"success\": \"https://cdn0.iconfinder.com/data/icons/4web-3/139/location-64.png\"\n                    }\n                },\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"availableSpotNumber\",\n                            \"operator\": \"lessThanInclusive\",\n                            \"value\": 20\n                        }\n                    ]\n                }\n            },\n            {\n                \"event\": {\n                    \"type\": \"\",\n                    \"params\": {\n                        \"success\": \"https://cdn0.iconfinder.com/data/icons/4web-3/139/location-64.png\"\n                    }\n                },\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"availableSpotNumber\",\n                            \"operator\": \"lessThanInclusive\",\n                            \"value\": 40\n                        }\n                    ]\n                }\n            }\n        ]\n    },\n    \"tooltip\": \"id\",\n    \"data\": \"$\",\n    \"title\": [\n        \"name\",\n        \"id\"\n    ],\n    \"infoWindow\": \"{%OffStreetParking.html%}\",\n    \"currentLocation\": \"currentLocation\",\n    \"location\": \"location\",\n    \"style\": {\n        \"default\": {\n            \"fill\": \"rgba(121, 188, 106, 0.3)\",\n            \"stroke\": \"rgb(99, 112, 30)\"\n        },\n        \"rules\": [\n            {\n                \"event\": {\n                    \"type\": \"existProp\",\n                    \"params\": {\n                        \"success\": {\n                            \"fill\": \"rgba(51, 51, 51, 0.1)\",\n                            \"stroke\": \"#333333\"\n                        }\n                    }\n                },\n                \"name\": \"availableSpotNumber\",\n                \"priority\": 10,\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"existProp\",\n                            \"operator\": \"equal\",\n                            \"params\": {\n                                \"property\": \"availableSpotNumber\"\n                            },\n                            \"value\": false\n                        }\n                    ]\n                }\n            },\n            {\n                \"event\": {\n                    \"type\": \"\",\n                    \"params\": {\n                        \"success\": {\n                            \"fill\": \"rgba(150, 0, 24, 0.3)\",\n                            \"stroke\": \"rgba(150, 0, 24, 0.9)\"\n                        }\n                    }\n                },\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"availableSpotNumber\",\n                            \"operator\": \"lessThanInclusive\",\n                            \"value\": 5\n                        }\n                    ]\n                }\n            },\n            {\n                \"event\": {\n                    \"type\": \"\",\n                    \"params\": {\n                        \"success\": {\n                            \"fill\": \"rgba(242, 147, 5, 0.3)\",\n                            \"stroke\": \"rgba(242, 147, 5, 0.9)\"\n                        }\n                    }\n                },\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"availableSpotNumber\",\n                            \"operator\": \"lessThanInclusive\",\n                            \"value\": 10\n                        }\n                    ]\n                }\n            },\n            {\n                \"event\": {\n                    \"type\": \"\",\n                    \"params\": {\n                        \"success\": {\n                            \"fill\": \"rgba(238, 194, 11, 0.3)\",\n                            \"stroke\": \"rgba(238, 194, 11, 0.9)\"\n                        }\n                    }\n                },\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"availableSpotNumber\",\n                            \"operator\": \"lessThanInclusive\",\n                            \"value\": 20\n                        }\n                    ]\n                }\n            },\n            {\n                \"event\": {\n                    \"type\": \"\",\n                    \"params\": {\n                        \"success\": {\n                            \"fill\": \"rgba(121, 188, 106, 0.3)\",\n                            \"stroke\": \"rgb(99, 112, 30)\"\n                        }\n                    }\n                },\n                \"conditions\": {\n                    \"all\": [\n                        {\n                            \"fact\": \"availableSpotNumber\",\n                            \"operator\": \"lessThanInclusive\",\n                            \"value\": 40\n                        }\n                    ]\n                }\n            }\n        ]\n    }\n}\n```\nIn \"\"data\": \"$\",\" $ refers to the entire object using the [jsonpath](https://github.com/json-path/JsonPath) lib.\n\n```json\n\"title\": [\n       \"name\",\n       \"id\"\n   ],\n```\nTitle will catch the value of the first property found\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fficodes%2Fsmart-datamodel-views","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fficodes%2Fsmart-datamodel-views","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fficodes%2Fsmart-datamodel-views/lists"}