Skip to content

Commit 4e5fb0b

Browse files
authored
Merge pull request #297 from tdwg/0.6
Camtrap DP 0.6
2 parents a9c78b3 + 7fd0136 commit 4e5fb0b

37 files changed

+2007
-1102
lines changed

_config.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,22 @@ logo: /assets/theme/images/tdwg-logo-short.svg
1818
markdown: kramdown
1919
plugins:
2020
- jekyll-feed
21+
- jekyll-sitemap
2122
exclude:
2223
- README.md
2324
- Gemfile
2425
- Gemfile.lock
2526
- LICENSE
26-
- example
27-
- tests
27+
- example/*
28+
- tests/*
2829
- "*.json"
30+
31+
# FRONTMATTER DEFAULTS
32+
defaults:
33+
- scope:
34+
path: pages/example
35+
values:
36+
permalink: "/example/:basename/"
37+
layout: example
38+
title: Example dataset
39+
toc: true

_data/_tables.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
- deployments-table-schema
22
- media-table-schema
3-
- observations-table-schema
3+
- media-observations-table-schema
4+
- event-observations-table-schema

_data/deployments.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../example/deployments.csv
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../event-observations-table-schema.json

_data/event-observations.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../example/event-observations.csv
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../media-observations-table-schema.json

_data/media-observations.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../example/media-observations.csv

_data/media.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../example/media.csv

_data/navigation.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,15 @@
66
href: /metadata/
77
- text: Data
88
href: /data/
9+
- text: Example dataset
10+
menu:
11+
- text: Deployment 1
12+
href: /example/00a2c20d-f038-490c-9b3f-7e32abfa0be7/
13+
- text: Deployment 2
14+
href: /example/29b7d356-4bb4-4ec4-b792-2af5cc32efa8/
15+
- text: Deployment 3
16+
href: /example/577b543a-2cf1-4b23-b6d2-cda7e2eac372/
17+
- text: Deployment 4
18+
href: /example/62c200a9-0e03-4495-bcd8-032944f6f5a1/
919
- text: GitHub
1020
href: https://github.com/tdwg/camtrap-dp

_data/observations-table-schema.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

_layouts/example.html

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
layout: default
3+
---
4+
5+
{{ content }}
6+
7+
<p class="small">Source: <a href="{{ site.github.repository_url }}/blob/main/example"><code>example dataset</code></a></p>
8+
9+
{% assign dep_id = page.name | remove: '.md' %}
10+
{% assign dep = site.data.deployments | where: 'deploymentID', dep_id | first %}
11+
{% assign media = site.data.media | where: 'deploymentID', dep_id %}
12+
{% assign media_observations = site.data.media-observations %}
13+
{% assign event_observations = site.data.event-observations %}
14+
15+
<h2 id="{{ dep_id }}">Deployment information</h2>
16+
17+
<dl>
18+
<dt>Location</dt>
19+
<dd>
20+
<code>{{ dep.locationName }}</code>
21+
(<a href="https://www.google.com/maps/search/?api=1&query={{ dep.latitude }},{{ dep.longitude }}&zoom=12"><code>{{ dep.latitude }}, {{ dep.longitude }}</code></a>),
22+
uncertainty: <code>{{ dep.coordinateUncertainty }}</code>m
23+
<dd>
24+
<dt>Duration</dt>
25+
<dd>
26+
<code>{{ dep.start }}</code> / <code>{{ dep.end }}</code>
27+
</dd>
28+
<dt>Camera setup</dt>
29+
<dd>
30+
interval: <code>{{ dep.cameraInterval }}</code>,
31+
height: <code>{{ dep.cameraHeight }}</code>,
32+
tilt: <code>{{ dep.cameraTilt }}</code>,
33+
heading: <code>{{ dep.cameraHeading }}</code>
34+
</dd>
35+
<dt>Bait</dt>
36+
<dd>
37+
<code>{{ dep.baitUse }}</code>
38+
</dd>
39+
</dl>
40+
41+
{% assign event_ids = media | map: 'eventID' | uniq %}
42+
{% for event_id in event_ids %}
43+
{% assign event_media = media | where: 'eventID', event_id %}
44+
{% assign event_media_count = event_media | size %}
45+
<h2 id="{{ event_id }}">Event: {{ event_id }}</h2>
46+
47+
<div id="carousel-{{ event_id }}" class="carousel slide carousel-fade" data-bs-ride="carousel" data-bs-keyboard="false" data-bs-interval="500">
48+
<div class="carousel-inner">
49+
{% for med in event_media %}
50+
{% assign public = med.filePublic | downcase %}
51+
{% if public == "false" %}
52+
{% assign public = false %}
53+
{% else %}
54+
{% assign public = true %}
55+
{% endif %}
56+
<div class="carousel-item{% if forloop.first %} active{% endif %}">
57+
<img class="d-block w-100" src="{% if public %}{{ med.filePath }}{% else %}{{ '/assets/placeholder.svg' | relative_url }}{% endif %}" alt="{{ med.timestamp }}">
58+
<div class="carousel-caption d-none d-md-block">
59+
<p class="fs-1">{{ forloop.index }}</p>
60+
</div>
61+
</div>
62+
{% endfor %}
63+
</div>
64+
<button class="carousel-control-prev" type="button" data-bs-target="#carousel-{{ event_id }}" data-bs-slide="prev">
65+
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
66+
<span class="visually-hidden">Previous</span>
67+
</button>
68+
<button class="carousel-control-next" type="button" data-bs-target="#carousel-{{ event_id }}" data-bs-slide="next">
69+
<span class="carousel-control-next-icon" aria-hidden="true"></span>
70+
<span class="visually-hidden">Next</span>
71+
</button>
72+
</div>
73+
74+
<table class="table table-sm mt-4">
75+
<colgroup>
76+
<col width="6%">
77+
<col width="47%">
78+
<col width="47%">
79+
</colgroup>
80+
<thead>
81+
<tr>
82+
<th>File</th>
83+
<th>Media observations</th>
84+
<th>Event observations</th>
85+
</tr>
86+
</thead>
87+
<tbody>
88+
{% for med in event_media %}
89+
{% assign med_id = med.mediaID %}
90+
<tr>
91+
<td>
92+
{{ forloop.index }}
93+
</td>
94+
<td title="mediaID: {{ med_id }}">
95+
{% assign media_obs = media_observations | where: 'mediaID', med_id %}
96+
{% for obs in media_obs %}
97+
<code>{{ obs.observationType }}</code>
98+
{% if obs.observationType == 'animal' %}
99+
<span class="badge rounded-pill bg-secondary">{{ obs.count }}</span>
100+
<em>{{ obs.scientificName }}</em>
101+
{% if obs.lifeStage and obs.sex %}
102+
({{ obs.lifeStage }}, {{ obs.sex }})
103+
{% elsif obs.lifeStage %}
104+
({{ obs.lifeStage }})
105+
{% elsif obs.sex %}
106+
({{ obs.sex }})
107+
{% endif %}
108+
{% endif %}
109+
{% if obs.classificationMethod == 'machine' %}
110+
<span class="text-muted small">Classified by machine</span>
111+
{% endif %}
112+
<br>
113+
{% endfor %}
114+
</td>
115+
{% if forloop.first %}
116+
<td title="eventID: {{ event_id }}" rowspan="{{ event_media_count }}">
117+
{% assign event_obs = event_observations | where: 'eventID', event_id %}
118+
{% for obs in event_obs %}
119+
<code>{{ obs.observationType }}</code>
120+
{% if obs.observationType == 'animal' %}
121+
<span class="badge rounded-pill bg-secondary">{{ obs.count }}</span>
122+
<em>{{ obs.scientificName }}</em>
123+
{% if obs.lifeStage and obs.sex %}
124+
({{ obs.lifeStage }}, {{ obs.sex }})
125+
{% elsif obs.lifeStage %}
126+
({{ obs.lifeStage }})
127+
{% elsif obs.sex %}
128+
({{ obs.sex }})
129+
{% endif %}
130+
{% endif %}
131+
{% if obs.classificationMethod == 'machine' %}
132+
<span class="text-muted small">Classified by machine</span>
133+
{% endif %}
134+
<br>
135+
{% endfor %}
136+
</td>
137+
{% endif %}
138+
</tr>
139+
{% endfor %}
140+
</tbody>
141+
</table>
142+
{% endfor %}

_layouts/profile.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{% assign properties1 = site.data[profile_file].allOf[1].properties %}
99
{% assign required1 = site.data[profile_file].allOf[1].required %}
1010

11-
<p class="small">Source: <a href="https://github.com/{{ site.github_username }}/blob/main/{{ profile_file }}.json"><code>{{ profile_file }}.json</code></a></p>
11+
<p class="small">Source: <a href="{{ site.github.repository_url }}/blob/main/{{ profile_file }}.json"><code>{{ profile_file }}.json</code></a></p>
1212

1313
{% for p1_raw in properties1 %}
1414
{% assign p1_name = p1_raw[0] %}
@@ -25,9 +25,9 @@ <h2 id="{{ p1_id }}">
2525
{% if p1['skos:exactMatch'] %}
2626
<p class="small text-muted">Same as <a href="{{ p1['skos:exactMatch'] }}">{{ p1['skos:exactMatch'] }}</a></p>
2727
{% elsif p1['skos:narrowMatch'] %}
28-
<p class="small text-muted">Narrower than <a href="{{ p1['skos:narrowMatch'] }}">{{ p1['skos:narrowMatch'] }}</a></p>
28+
<p class="small text-muted">Broader than <a href="{{ p1['skos:narrowMatch'] }}">{{ p1['skos:narrowMatch'] }}</a></p>
2929
{% elsif p1['skos:broadMatch'] %}
30-
<p class="small text-muted">Broader than <a href="{{ p1['skos:broadMatch'] }}">{{ p1['skos:broadMatch'] }}</a></p>
30+
<p class="small text-muted">Narrower than <a href="{{ p1['skos:broadMatch'] }}">{{ p1['skos:broadMatch'] }}</a></p>
3131
{% endif %}
3232

3333
{% if p1.properties %}
@@ -36,6 +36,9 @@ <h2 id="{{ p1_id }}">
3636
{% elsif p1.items.properties %}
3737
{% assign properties2 = p1.items.properties %}
3838
{% assign required2 = p1.items.required %}
39+
{% elsif p1.items.oneOf[0].properties %}
40+
{% assign properties2 = p1.items.oneOf[0].properties %}
41+
{% assign required2 = p1.items.oneOf[0].required %}
3942
{% else %}
4043
{% assign properties2 = false %}
4144
{% endif %}
@@ -83,12 +86,12 @@ <h2 id="{{ p1_id }}">
8386
{% if p2['skos:exactMatch'] %}
8487
<span class="small text-muted">Same as <a href="{{ p2['skos:exactMatch'] }}">{{ p2['skos:exactMatch'] }}</a></span>
8588
{% elsif p2['skos:narrowMatch'] %}
86-
<span class="small text-muted">Narrower than <a href="{{ p2['skos:narrowMatch'] }}">{{ p2['skos:narrowMatch'] }}</a></span>
89+
<span class="small text-muted">Broader than <a href="{{ p2['skos:narrowMatch'] }}">{{ p2['skos:narrowMatch'] }}</a></span>
8790
{% elsif p2['skos:broadMatch'] %}
88-
<span class="small text-muted">Broader than <a href="{{ p2['skos:broadMatch'] }}">{{ p2['skos:broadMatch'] }}</a></span>
91+
<span class="small text-muted">Narrower than <a href="{{ p2['skos:broadMatch'] }}">{{ p2['skos:broadMatch'] }}</a></span>
8992
{% endif %}
9093
</td>
91-
<td>{{ p2.type }}</td>
94+
<td><span class="badge bg-secondary">{{ p2.type }}</span></td>
9295
</tr>
9396
{% endfor %}
9497
</tbody>

_layouts/tables.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
{% for table_schema_file in site.data["_tables"] %}
88
{% assign table_schema = site.data[table_schema_file] %}
9-
{% assign table_schema_id = table_schema.title | downcase | url_encode %}
9+
{% assign table_schema_id = table_schema.title | downcase | replace: ' ', '-' %}
1010

1111
<h2 id="{{ table_schema_id }}">{{ table_schema.title }}</h2>
1212

13-
<p class="small">Source: <a href="https://github.com/{{ site.github_username }}/blob/main/{{ table_schema_file }}.json"><code>{{ table_schema_file }}.json</code></a></p>
13+
<p class="small">Source: <a href="{{ site.github.repository_url }}/blob/main/{{ table_schema_file }}.json"><code>{{ table_schema_file }}.json</code></a></p>
1414

1515
{{ table_schema.description | markdownify }}
1616

@@ -30,8 +30,8 @@ <h2 id="{{ table_schema_id }}">{{ table_schema.title }}</h2>
3030
<tbody>
3131
{% for field in table_schema.fields %}
3232
<tr class="text-break">
33-
<td id="{{ table_schema_id }}.{{ field.name | downcase | url_encode }}">
34-
<a href="#{{ table_schema_id }}.{{ field.name | downcase | url_encode }}"><code>{{ field.name }}</code></a>
33+
<td id="{{ table_schema_id }}.{{ field.name }}">
34+
<a href="#{{ table_schema_id }}.{{ field.name }}"><code>{{ field.name }}</code></a>
3535
{% if field.constraints.required %}*{% endif %}
3636
</td>
3737
<td>
@@ -52,12 +52,12 @@ <h2 id="{{ table_schema_id }}">{{ table_schema.title }}</h2>
5252
{% if field['skos:exactMatch'] %}
5353
<span class="small text-muted">Same as <a href="{{ field['skos:exactMatch'] }}">{{ field['skos:exactMatch'] }}</a></span>
5454
{% elsif field['skos:narrowMatch'] %}
55-
<span class="small text-muted">Narrower than <a href="{{ field['skos:narrowMatch'] }}">{{ field['skos:narrowMatch'] }}</a></span>
55+
<span class="small text-muted">Broader than <a href="{{ field['skos:narrowMatch'] }}">{{ field['skos:narrowMatch'] }}</a></span>
5656
{% elsif field['skos:broadMatch'] %}
57-
<span class="small text-muted">Broader than <a href="{{ field['skos:broadMatch'] }}">{{ field['skos:broadMatch'] }}</a></span>
57+
<span class="small text-muted">Narrower than <a href="{{ field['skos:broadMatch'] }}">{{ field['skos:broadMatch'] }}</a></span>
5858
{% endif %}
5959
</td>
60-
<td>{{ field.type }}</td>
60+
<td><span class="badge bg-secondary">{{ field.type }}</span></td>
6161
</tr>
6262
{% endfor %}
6363
</tbody>

0 commit comments

Comments
 (0)