-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.json
61 lines (52 loc) · 3.1 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
---
---
{
"conformsTo": "https://project-open-data.cio.gov/v1.1/schema",
"subject": [{% for subject in site.subjects %}{% capture temp %}
{% assign schema = subject.schema | default: site.schema %}
{% assign subject_fields = site.data.schemas[schema].subject_fields %}
{% assign resource_fields = site.data.schemas[schema].resource_fields %}
{% assign f_title = subject_fields | where: "datajson", "title" | first %}
{% assign title = subject[f_title[field_name]] %}
{% assign f_publisher_name = subject_fields | where: "datajson", "publisher.name" | first %}
{% assign publisher_name = subject[f_publisherName[field_name]] %}
{% assign f_license = subject_fields | where: "datajson", "license" | first %}
{% assign license = subject[f_license[field_name]] %}
{% assign f_description = subject_fields | where: "datajson", "description" | first %}
{% assign description = subject[f_description[field_name]] %}
{% assign f_category = subject_fields | where: "datajson", "category" | first %}
{% assign category = subject[f_category[field_name]] %}
{% assign f_contact_point_fn = subject_fields | where: "datajson", "contactPoint.fn" | first %}
{% assign contact_point_fn = subject[f_contact_point_fn[field_name]] %}
{% assign f_contact_point_has_email = subject_fields | where: "datajson", "contactPoint.hasEmail" | first %}
{% assign contact_point_has_email = subject[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 %}
{
"title": {{ title | jsonify }}{% if publisher_name %},
"publisher": {
"name": {{ publisher_name | jsonify }}
}{% endif %}{% if description %},
"description": {{ description | jsonify }}{% endif %}{% if category %},
"category": {{ category | jsonify }}{% endif %}{% if contact_point_fn or contact_point_has_email %},
"contactPoint": {
"fn": {{ contact_point_fn | jsonify }}{% if contact_point_has_email %},
"hasEmail": {{ contact_point_has_email | jsonify }}{% endif %}
}{% endif %}{% if license != '' %},
"license": "{{ license }}"
{% endif %}{% if subject.resources %},
"distribution": [{% for distribution in subject.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 %}
{
"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 %}
]
}