Skip to content

Commit f406a2e

Browse files
author
Ed (ODSC)
committed
cove_bods: Add support for BODS 0.4 data
1 parent 8b595eb commit f406a2e

File tree

14 files changed

+922
-168
lines changed

14 files changed

+922
-168
lines changed

.github/workflows/branch-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup python
2020
uses: actions/setup-python@v2
2121
with:
22-
python-version: 3.7
22+
python-version: 3.11
2323
architecture: x64
2424
- run: pip install dokkusd
2525
- uses: oNaiPs/secrets-to-env-action@v1

.github/workflows/branch-destroy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup python
1717
uses: actions/setup-python@v2
1818
with:
19-
python-version: 3.7
19+
python-version: 3.11
2020
architecture: x64
2121
- run: pip install dokkusd
2222
- run: python -m dokkusd.cli destroy --appname ${{ vars.DOKKU_APP_NAME_PREFIX }}-${{ github.event.ref }}

.github/workflows/live-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup python
2121
uses: actions/setup-python@v2
2222
with:
23-
python-version: 3.7
23+
python-version: 3.11
2424
architecture: x64
2525
- run: pip install dokkusd
2626
- uses: oNaiPs/secrets-to-env-action@v1

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# openownership-cove-bods-alpha
1+
# Open Ownership BODS Cove
2+
3+
Checks data complies with the Beneficial Ownership Data Standard (BODS) versions 0.1-0.4,
4+
and displays any errors. Also converts uploaded data between JSON and XLSX formats.
5+
Based on: https://github.com/OpenDataServices/cove
26

37
## Dev installation
48

cove_bods/process.py

Lines changed: 166 additions & 71 deletions
Large diffs are not rendered by default.

cove_bods/templates/cove_bods/additional_checks_table.html

Lines changed: 616 additions & 60 deletions
Large diffs are not rendered by default.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{% load i18n %}
2+
3+
<!-- <p>{{ additional_fields }}</p> -->
4+
5+
<table class="table">
6+
<thead>
7+
<tr>
8+
<th class="">{% trans 'Field Name' %}</th>
9+
<th class="">{% trans 'Field Path' %}</th>
10+
<th class="">{% trans 'Usage Count' %}</th>
11+
<th class="">{% trans 'First 3 Values' %}</th>
12+
<th class="">{% trans 'Child Fields' %}</th>
13+
</tr>
14+
</thead>
15+
<tbody>
16+
{% for full_path, info in additional_fields.items %}
17+
{% if info.root_additional_field %}
18+
<tr>
19+
<td>
20+
{{ info.field_name }}
21+
</td>
22+
<td>
23+
{{ full_path }}
24+
</td>
25+
<td>
26+
{{ info.count }}
27+
</td>
28+
<td>
29+
<ul class="list-unstyled">
30+
{% for example in info.examples|slice:":3" %}
31+
<li>
32+
{{ example }}
33+
</li>
34+
{% endfor %}
35+
</ul>
36+
</td>
37+
<td>
38+
{% if info.additional_field_descendance %}
39+
{{info.additional_field_descendance|length}}
40+
<a data-toggle="modal" data-target="#additional-field-{{full_path|slugify}}">{% trans "(See child fields)" %}</a>
41+
{% endif %}
42+
</td>
43+
</tr>
44+
{% endif %}
45+
{% endfor %}
46+
</tbody>
47+
</table>
48+
49+
{% for parent_full_path, parent_info in additional_fields.items %}
50+
{% if parent_info.root_additional_field and parent_info.additional_field_descendance %}
51+
<div class="modal fade" id="additional-field-{{parent_full_path|slugify}}" tabindex="-1" role="dialog">
52+
<div class="modal-dialog modal-lg" role="document">
53+
<div class="modal-content">
54+
<div class="modal-header">
55+
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
56+
<h4>{% blocktrans %}Child fields of {{parent_full_path}}{% endblocktrans %} </h4>
57+
58+
</div>
59+
<div class="modal-body">
60+
<table class="table">
61+
<thead>
62+
<tr>
63+
<th> {% trans 'Field' %}</th>
64+
<th> {% trans 'Path to Field' %}</th>
65+
<!-- <th> {% trans 'Usage Count' %}</th> -->
66+
<th> {% trans 'Value' %}</th>
67+
</tr>
68+
</thead>
69+
<tbody>
70+
{% for full_path, info in parent_info.additional_field_descendance.items %}
71+
<tr>
72+
<td>{{info.field_name}}</td>
73+
<td>{{info.path}}</td>
74+
<!-- <td>{{info.count}}</td> -->
75+
<!-- <td>
76+
{% for example in info.examples %}
77+
{{example}} <br />
78+
{% endfor %}
79+
</td> -->
80+
<td>
81+
{{ info.examples|first }}
82+
</td>
83+
</tr>
84+
{% endfor %}
85+
</tbody>
86+
</table>
87+
</div>
88+
</div>
89+
</div>
90+
</div>
91+
{% endif %}
92+
{% endfor %}
93+

cove_bods/templates/cove_bods/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="page-header">
2222
<div class="row border-bottom">
2323
<div class="col-xs-10">
24-
<a href="http://standard.openownership.org/">
24+
<a href="{% url 'index' %}">
2525
<h1>Beneficial Ownership Data Standard (BODS)</h1>
2626
</a>
2727
</div>

cove_bods/templates/cove_bods/explore.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ <h4 class="panel-title">
142142

143143
<div class="row">
144144

145-
{% if additional_fields_count %}
145+
{% if additional_fields_count or any_additional_fields_exist %}
146146

147147
<a name="additional-fields" class="anchor"></a>
148148
<div class="panel panel-danger">
@@ -152,7 +152,7 @@ <h4 class="panel-title">
152152
</h4>
153153
</div>
154154
<div id="additionalFieldsTable" class="collapse in panel-body">
155-
{% include "additional_fields_table.html" %}
155+
{% include "cove_bods/additional_fields_table.html" %}
156156
</div>
157157
</div>
158158
{% else %}
@@ -259,7 +259,11 @@ <h4>{% trans 'Person Statements' %}</h4>
259259
{% endif %}
260260
{% endfor %}
261261

262+
{% if record_schema_used %}
263+
<h4>{% trans 'Relationship Statements' %}</h4>
264+
{% else %}
262265
<h4>{% trans 'Ownership or Control Statements' %}</h4>
266+
{% endif %}
263267

264268
<p>{% trans 'Total Statements' %}: {{ statistics.count_ownership_or_control_statement }}</p>
265269

cove_bods/templates/cove_bods/validation_table.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,23 @@
2626
{% elif errors.0.validator == "pattern" %}
2727
<strong><code>{{ errors.0.path_ending }}</code> does not match the regex <code>{{ errors.0.validator_value }}</code></strong>
2828
{% elif errors.0.validator == "format" and errors.0.validator_value == "date" %}
29-
<strong>Date is not in the correct format. The correct format is YYYY-MM-DD.</strong>
29+
<strong><code>{{ errors.0.path_ending }}</code> is not a valid date. The correct format is YYYY-MM-DD.</strong>
3030
{% elif errors.0.validator == "format" and errors.0.validator_value == "date-time" %}
31-
<strong>Date is not in the correct format. The correct format is YYYY-MM-DDT00:00:00Z.</strong>
31+
<strong><code>{{ errors.0.path_ending }}</code> is not a valid date-time.</strong>
3232
{% elif errors.0.validator == "format" and errors.0.validator_value == "uri" %}
33-
<strong>Invalid uri found</strong>
33+
<strong><code>{{ errors.0.path_ending }}</code> is not a valid uri.</strong>
3434
{% elif errors.0.validator == "minLength" %}
3535
<strong><code>{{ errors.0.path_ending }}</code> is too short. It should be at least {{ errors.0.validator_value }} characters.</strong>
3636
{% elif errors.0.validator == "maxLength" %}
3737
<strong><code>{{ errors.0.path_ending }}</code> is too long. It should not exceed {{ errors.0.validator_value }} characters.</strong>
3838
{% elif errors.0.validator == "type" and errors.0.validator_value == "number" %}
3939
<strong><code>{{ errors.0.path_ending }}</code> should be a number. Check that the value is not null, and doesn’t contain any characters other than 0-9 and dot (<code>.</code>). Number values should not be in quotes.</strong>
4040
{% elif errors.0.validator == "type" and errors.0.validator_value == "array" %}
41-
<strong><code>{{ errors.0.path_ending }}</code> should be a JSON array. Check that value(s) appear within square brackets, [...]</strong>
41+
{% if errors.0.path_ending == "$" %}
42+
<strong>The dataset should be a JSON array. Check that the object(s) appear within square brackets, [...]</strong>
43+
{% else %}
44+
<strong><code>{{ errors.0.path_ending }}</code> should be a JSON array. Check that value(s) appear within square brackets, [...]</strong>
45+
{% endif %}
4246
{% elif errors.0.validator == "type" and errors.0.validator_value == "string" %}
4347
<strong><code>{{ errors.0.path_ending }}</code> should be a string. Check that the value is not null, and has quotes at the start and end. Escape any quotes in the value with <code>\</code></strong>
4448
{% elif errors.0.validator == "type" and errors.0.validator_value == "boolean" %}
@@ -48,7 +52,11 @@
4852
{% elif errors.0.validator == "dependencies" %}
4953
<strong>{{ errors.0.message }}</strong>
5054
{% elif errors.0.validator == "anyOf" %}
51-
<strong>{{ errors.0.message }}</strong>
55+
<strong><code>{{ errors.0.path_ending }}</code> is not a valid value. Check the description of this field in the schema documentation for details.</strong>
56+
{% elif errors.0.validator == "oneOf" %}
57+
<strong><code>{{ errors.0.path_ending }}</code> is not a valid value. Check the description of this field in the schema documentation for details.</strong>
58+
{% elif errors.0.validator == "const" %}
59+
<strong><code>{{ errors.0.path_ending }}</code> is expected to be <q>{{ errors.0.validator_value }}</q> in this Statement.</strong>
5260
{% else %}
5361
<strong>{{ errors.0.validator }} = {{ errors.0.message }}</strong>
5462
{% endif %}

0 commit comments

Comments
 (0)