Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the Citation Documentation field in Scheme and Organization #11

Draft
wants to merge 3 commits into
base: live
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,9 @@ components:
description:
type: string
description: "A few sentences describing the nature of the standard and for what it is meant to be used. If any of the information in the remainder of the record needs be clarified, perhaps because the reality is more nuanced than the coarse semantics provide for, then an explanation can be given here."
citation_docs:
type: string
description: "A few sentences describing how to cite datasets or digital objects described by this standard."
keywords:
type: array
description: "Keywords indicating the disciplinary scope of the scheme. Provide as few terms as possible to describe the subject areas in which the scheme is most used and useful. In some cases, it may be better to use a broader term even if not all of the available narrower terms apply."
Expand Down Expand Up @@ -1800,6 +1803,9 @@ components:
description:
type: string
description: "A sentence or several describing the organization and its relevance to research data and metadata."
citation_docs:
type: string
description: "A few sentences describing the organization citation policy, useful for archives, digital repositories or standards body organizations"
types:
type: array
items:
Expand Down
4 changes: 4 additions & 0 deletions rdamsc/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,7 @@ class Scheme(Record):
schema = {
"title": {"type": "text", "useful": True},
"description": {"type": "html", "useful": True},
"citation_docs": {"type": "html", "useful": True},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"useful" might be the wrong word here; perhaps I should have used "requisite". I didn't want to use "required" since none of the fields are technically required.

"useful" is short for the statement "The record cannot be considered useful without a value for this field."
"optional" is short for the statement "The record can be considered complete even without a value for this field."

I think "optional" is probably the right flag to use.

"keywords": {"type": "thesaurus", "useful": True},
"dataTypes": {"type": "datatypes"},
"locations": {"type": "locations", "useful": True},
Expand Down Expand Up @@ -2527,6 +2528,7 @@ class Group(Record):
schema = {
"name": {"type": "text", "useful": True},
"description": {"type": "html"},
"citation_docs": {"type": "html", "useful": True },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "optional" is probably the right flag to use, rather than "useful".

"types": {"type": "types"},
"locations": {"type": "locations"},
"identifiers": {"type": "identifiers", "useful": True},
Expand Down Expand Up @@ -3321,6 +3323,7 @@ class SampleForm(Form):
class SchemeForm(FlaskForm):
title = StringField("Name of metadata scheme")
description = TextHTMLField("Description")
citation_docs = TextHTMLField("Citation Documentation")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be sentence case, i.e. "Citation documentation".

keywords = FieldList(
StringField("Subject area", validators=[Optional()]),
"Subject areas",
Expand Down Expand Up @@ -3477,6 +3480,7 @@ class CrosswalkVersionForm(FlaskForm):
class GroupForm(FlaskForm):
name = StringField("Name of organization")
description = TextHTMLField("Description")
citation_docs = TextHTMLField("Citation Documentation")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be sentence case, i.e. "Citation documentation".

types = SelectMultipleField("Type of organization")
locations = FieldList(FormField(LocationForm), "Relevant links", min_entries=1)
identifiers = FieldList(
Expand Down
4 changes: 4 additions & 0 deletions rdamsc/templates/display-organization.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ <h2>Links and documentation</h2>
</ul>
</div>
{% endif %}
{% if 'citation_docs' in record %}
<h2>Citation Documentation</h2>
<div class="citation_docs">{{ record['citation_docs']|safe }}</div>
{% endif %}
{% if related_schemes %}
<div class="schemes">
<h2>Related metadata standards</h2>
Expand Down
4 changes: 4 additions & 0 deletions rdamsc/templates/display-scheme.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ <h2>Documentation</h2>
</ul>
</div>
{% endif %}
{% if 'citation_docs' in record %}
<h2>Citation Documentation</h2>
<div class="citation_docs">{{ record['citation_docs']|safe }}</div>
{% endif %}
{% if 'maintainers' in relations or 'funders' in relations %}
<div class="organizations">
<h2>Responsible organizations</h2>
Expand Down
9 changes: 9 additions & 0 deletions rdamsc/templates/edit-organization.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
standards.</li>
</ul>
</div>
<div class="form-group{{ state(form.citation_docs) }}">
{{ form.citation_docs.label(class="form-label") }}
{{ form.citation_docs(class="form-control") }}
{{ errors(form.citation_docs) }}
<ul class="form-text text-muted">
<li>Insert references about citations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guidance here should be the same as the guidance given in openapi.yaml (or nearly so).

</li>
</ul>
</div>
<div class="form-group{{ state(form.types) }}">
{{ form.types.label(class="form-label") }}
{{ form.types(class="form-control w-auto mw-100") }}
Expand Down
9 changes: 9 additions & 0 deletions rdamsc/templates/edit-scheme.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
(e.g. XML) or could be expressed in various ways (e.g. RDF).</li>
</ul>
</div>
<div class="form-group{{ state(form.citation_docs) }}">
{{ form.citation_docs.label(class="form-label") }}
{{ form.citation_docs(class="form-control") }}
{{ errors(form.citation_docs) }}
<ul class="form-text text-muted">
<li>Insert references about citations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guidance here should be the same as the guidance given in openapi.yaml (or nearly so).

</li>
</ul>
</div>
<div class="form-group">
{{ form.keywords.label(class="form-label") }}
<datalist id="keyword-list">
Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self, app):
"title": "Test scheme 1",
"slug": "test-scheme-1",
"description": "Description without tags.",
"citation_docs": "Citations practices without tags.",
"keywords": [
"http://rdamsc.bath.ac.uk/thesaurus/subdomain235",
"http://vocabularies.unesco.org/thesaurus/concept4011"],
Expand All @@ -75,6 +76,8 @@ def __init__(self, app):
"slug": "test-scheme-2",
"description": "<p>Paragraph 1.</p>"
"<p><a href=\"https://m.us/\">Paragraph</a> 2.</p>",
"citation_docs": "<p>Paragraph 1.</p>"
"<p><a href=\"https://c.us/\">Paragraph</a> 2.</p>",
"keywords": [
"http://rdamsc.bath.ac.uk/thesaurus/subdomain235",
"http://vocabularies.unesco.org/thesaurus/concept4011"],
Expand Down Expand Up @@ -220,6 +223,7 @@ def __init__(self, app):
self.g1 = {
"name": "Organization 1",
"slug": "organization-1",
"citation_docs": "<p>Paragraph 1.</p><p>Paragraph 2.</p>",
"description": "<p>Paragraph 1.</p><p>Paragraph 2.</p>",
"types": ["standards body"],
"locations": [
Expand Down