forked from okestonia/opendata.riik.ee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.json
85 lines (73 loc) · 4.16 KB
/
data.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
---
{
"conformsTo": "https://project-open-data.cio.gov/v1.1/schema",
"@context": "https://project-open-data.cio.gov/v1.1/schema/catalog.jsonld",
"@id": "https://opendata.riik.ee/data.json",
"@type": "dcat:Catalog",
"describedBy": "https://project-open-data.cio.gov/v1.1/schema/catalog.json",
"dataset": [{% for dataset in site.datasets %}{% capture temp %}
{% assign schema = dataset.schema | default: site.schema %}
{% assign dataset_fields = site.data.schemas[schema].dataset_fields %}
{% assign resource_fields = site.data.schemas[schema].resource_fields %}
{% assign f_title = dataset_fields | where: "datajson", "title" | first %}
{% assign title = dataset[f_title[field_name]] %}
{% assign f_organization = dataset_fields | where: "datajson", "publisher" | first %}
{% assign organization = dataset[f_organization[field_name]] %}
{% assign f_date_issued = dataset_fields | where: "datajson", "issued" | first %}
{% assign date_issued = dataset[f_date_issued[field_name]] %}
{% assign f_date_modified = dataset_fields | where: "datajson", "modified" | first %}
{% assign date_modified = dataset[f_date_modified[field_name]] %}
{% assign f_update_freq = dataset_fields | where: "datajson", "frequency" | first %}
{% assign update_freq = dataset[f_update_freq[field_name]] %}
{% assign f_license = dataset_fields | where: "datajson", "license" | first %}
{% assign license = dataset[f_license[field_name]] %}
{% assign f_description = dataset_fields | where: "datajson", "description" | first %}
{% assign description = dataset[f_description[field_name]] %}
{% assign f_category = dataset_fields | where: "datajson", "category" | first %}
{% assign category = dataset[f_category[field_name]] %}
{% assign f_contact_point_fn = dataset_fields | where: "datajson", "contactPoint.fn" | first %}
{% assign contact_point_fn = dataset[f_contact_point_fn[field_name]] %}
{% assign f_contact_point_has_email = dataset_fields | where: "datajson", "contactPoint.hasEmail" | first %}
{% assign contact_point_has_email = dataset[f_contact_point_has_email[field_name]] %}
{% assign f_dist_title = resource_fields | where: "datajson", "distribution.title" | first %}
{% assign f_dist_download_url = resource_fields | where: "datajson", "distribution.downloadURL" | first %}
{% assign f_dist_format = resource_fields | where: "datajson", "distribution.format" | first %}
{% endcapture %}{% if title %}
{
"@type": "dcat:Dataset",
"title": {{ title | jsonify }},{% if organization %}
"publisher": {
"@type": "org:Organization",
"name": {{ organization | jsonify }}
},{% endif %}
"issued": {{ date_issued | jsonify }},
"modified": {{ date_modified | jsonify }},
"accrualPeriodicity": {{ update_freq | jsonify }},
{% if description %}
"description": {{ description | jsonify }},{% endif %}{% if category %}
"category": {{ category | jsonify }},{% endif %}{% if contact_point_fn or contact_point_has_email %}
"contactPoint": {
"@type": "vcard:Contact",
"fn": {{ contact_point_fn | jsonify }},{% if contact_point_has_email %}
"hasEmail": {{ contact_point_has_email | jsonify }}{% endif %}
},{% endif %}
"identifier": "https://opendata.riik.ee{{ site.baseurl }}{{ dataset.url }}",
{% if license != '' %}
"license": "{{ license }}",
{% endif %}{% if dataset.resources %}
"distribution": [{% for distribution in dataset.resources %}
{% capture temp %}
{% assign dist_title = distribution[f_dist_title[field_name]] %}
{% assign dist_download_url = distribution[f_dist_download_url[field_name]] %}
{% assign dist_format = distribution[f_dist_format[field_name]] %}{% endcapture %}
{
"@type":"dcat:Distribution",
"title": {{ dist_title | jsonify }},
"downloadURL": {{ dist_download_url | jsonify }}{% if dist_format %},
"format": {{ dist_format | jsonify }}{% endif %}
}{% unless forloop.last %},{% endunless %}{% endfor %}
]{% endif %}
}{% unless forloop.last %},{% endunless %}{% endif %}{% endfor %}
]
}