Skip to content

Commit 1f506cb

Browse files
committed
docs: adapt documentation after infrastructure code split
Adapts documentation for data curators following up the split of the portal's infrastructure code from the content in two repositories. Implements comments from the cernopendata#3590 pull request review. Closes cernopendata#3678.
1 parent d86c6f8 commit 1f506cb

File tree

3 files changed

+134
-75
lines changed

3 files changed

+134
-75
lines changed

CONTRIBUTING.rst

+19-26
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,26 @@ portal developments, you can `watch ongoing discussions
1919
`become part of the team
2020
<https://github.com/orgs/cernopendata/teams>`_.
2121

22-
Code contributions
23-
------------------
22+
Contributions
23+
-------------
2424

2525
We follow typical `GitHub flow
26-
<https://guides.github.com/introduction/flow/index.html>`_.
26+
<https://docs.github.com/en/get-started/using-github/github-flow>`_.
2727

2828
1. Fork this repository into your personal space.
29-
2. Start a new topical branch for any contribution. Name it sensibly,
30-
say ``fix-event-display-icons``.
31-
3. Test your branch on a local site. If everything works as expected,
32-
please `sign your commits
33-
<https://invenio.readthedocs.io/en/latest/technology/git.html#r2-remarks-on-commit-log-messages>`_
34-
to indicate its quality.
35-
4. Create `logically separate commits for logically separate things
36-
<https://invenio.readthedocs.io/en/latest/technology/git.html#r1-remarks-on-commit-history>`_.
37-
Check out our usual `development practices
38-
<https://invenio-github.readthedocs.io/en/latest/contributing.html>`_.
39-
5. Please add any ``(closes #123)`` directives in your commit log
40-
message if your pull request closes an open issue.
41-
6. Issue a pull request. If the branch is not quite ready yet, please
42-
indicate ``WIP`` (=work in progress) in the pull request title.
43-
44-
For more information on how we work with branches, see our `developing
45-
guide <DEVELOPING.rst>`_.
46-
47-
Chatroom
48-
--------
49-
50-
Our chatroom is `on gitter
51-
<https://gitter.im/cernopendata/opendata.cern.ch>`_.
29+
2. Start a new topical branch for any contribution. Name it descriptively, for
30+
example ``fix-cms-2012-collision-energy``.
31+
3. Ideally, test your branch on a local development site to see if everything
32+
works correctly.
33+
4. Open a pull request against this repository. Verify that all the continuous
34+
integration checks are passing. If not, please amend the pull request
35+
accordingly.
36+
37+
For more information on the process, please see our `developing guide
38+
<DEVELOPING.rst>`_.
39+
40+
Support
41+
-------
42+
43+
You can also get in touch via our `Mattermost
44+
<https://mattermost.web.cern.ch/it-dep/channels/opendata>`_ chat room.

DEVELOPING.rst

+101-37
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,130 @@
55
.. contents::
66
:backlinks: none
77

8-
Installation
9-
============
8+
This document describes how you can run a local instance of the CERN Open Data
9+
portal in order to work with the content records and associated documentation.
10+
11+
Prerequisites
12+
=============
13+
14+
You will need to clone two repositories:
1015

11-
This module contains the content of the CERN Open Data instance. It does not contain the code of the portal itself.
12-
For local development, it is recommended to have an installation of the CERN Open Data Portal. For detail instructions
13-
on how to install the portal, please follow `these instructions <https://github.com/cernopendata/cernopendata-portal/blob/main/DEVELOPING.rst>`_.
16+
- `opendata.cern.ch <https://github.com/cernopendata/opendata.cern.ch>`_ which
17+
contains the open data content;
18+
19+
- `cernopendata-portal <https://github.com/cernopendata/cernopendata-portal>`_
20+
which contains the portal infrastructure code.
21+
22+
Please make sure to also install `Docker
23+
<https://docs.docker.com/get-started/get-docker/>`_ and `Docker Compose
24+
<https://docs.docker.com/compose/install/>`_ v2 that is used for local
25+
developments.
1426

1527
Quick start
16-
-------------------
17-
For a quickstart guide, do the following:
28+
===========
29+
30+
In order to create a local CERN Open Data portal instance, please proceed as
31+
follows:
1832

1933
.. code-block:: console
2034
21-
$ # Checkout this repository
22-
$ git clone https://github.com/cernopendata/opendata.cern.ch.git
23-
$ # Checkout the module with the portal
24-
$ git clone https://github.com/cernopendata/cernopendata-portal.git
25-
$ # Move to the directory of the content
35+
$ git clone https://github.com/johndoe/opendata.cern.ch
36+
$ git clone https://github.com/johndoe/cernopendata-portal
2637
$ cd opendata.cern.ch
27-
$ # Make sure that the latest images are available
2838
$ docker compose pull
29-
$ # Start the services
3039
$ docker compose up -d
31-
$ # Give enough time to the containers to start properly. Note that there are some dependencies among them,
32-
$ # and the web container starts by setting up the development environment
33-
$ sleep 120
34-
$ # Create the basic structure
35-
$ docker exec -i -t opendatacernch-web-1 /code/scripts/populate-instance.sh --skip-records --skip-docs
36-
$ docker exec -i -t opendatacernch-web-1 cernopendata fixtures records \
37-
--mode insert-or-replace \
38-
-f /content/data/records/cms-primary-datasets.json
39-
..
40+
$ sleep 120 # give enough time for the containers to start properly
41+
$ docker exec -i -t opendatacernch-web-1 /code/scripts/populate-instance.sh \
42+
--skip-records --skip-docs
43+
44+
This will create a running instance of the CERN Open Data portal with a
45+
relatively empty content. The portal will be accessible locally at
46+
`http://127.0.0.1:500 <http://127.0.0.1:5000>`_.
4047

48+
If you would like to stop and delete your local instance, you can do:
4149

42-
At this point, all the services should be up and running. If you go to a web browser to http://0.0.0.0:5000/, you should
43-
see the web portal, with the vocabularies and some documents about the portal itself.
50+
.. code-block:: console
4451
45-
From this moment on,
52+
$ docker compose down -v
4653
47-
Defining new entries
54+
Working with records
4855
====================
4956

50-
This repository has the following data structure:
57+
If you would like to work with certain data records and test your edits on your
58+
local instance, you can proceed as follows.
59+
60+
Edit the record file, such as CMS 2012 collision dataset records:
61+
62+
.. code-block:: console
5163
52-
* data:
53-
* records: Put here the entries that should be inserted as records
54-
* docs: This folder will be for the documents
55-
* images: And this is for static images that might be needed
56-
* scripts: Directory with shell scripts to help the development
64+
$ vim data/records/cms-primary-datasets.json
65+
66+
Upload the local file into your instance:
67+
68+
.. code-block:: console
69+
70+
$ docker exec -i -t opendatacernch-web-1 cernopendata fixtures records \
71+
--mode insert-or-replace \
72+
-f /content/data/records/cms-primary-datasets.json
73+
74+
You can then check your changes at `http://127.0.0.1:500
75+
<http://127.0.0.1:5000>`_.
76+
77+
Note that you can take advantage of shell scripting if you would like to upload
78+
all experiment records locally, for example for ATLAS:
79+
80+
.. code-block:: console
81+
82+
$ for file in data/records/atlas-*; do \
83+
docker exec -i -t opendatacernch-web-1 cernopendata fixtures records \
84+
--mode insert-or-replace -f $file; \
85+
done
86+
87+
Understanding metadata fields
88+
=============================
89+
90+
When working with data records, there are several fields such as
91+
`collision_energy` that you can use to store the content. The list of all
92+
available record fields, together with their semantic meaning, is described in
93+
the JSON Schema files. You can find the `record schema
94+
<https://github.com/cernopendata/cernopendata-portal/blob/main/cernopendata/jsonschemas/records/record-v1.0.0.json>`_
95+
in the portal infrastructure repository.
96+
97+
If you would like to modify the JSON schema, for example to add a new field,
98+
this would require working with the `cernopendata-portal` sister repository.
99+
Please see its own `documenation
100+
<https://github.com/cernopendata/cernopendata-portal/>`_ about how to add new
101+
metadata fields. We would be happy to assist with the process.
102+
103+
Understanding output templates
104+
==============================
105+
106+
If you would like to change the way how the data records are displayed on the
107+
web, for example to introduce new section displaying newly added field, this is
108+
something that is governed by `Jinja templating language
109+
<https://jinja.palletsprojects.com/en/2.10.x/templates/>`_ in the
110+
`cernopendata-portal` sister repository. Please see its own `documenation
111+
<https://github.com/cernopendata/cernopendata-portal/>`_ about how to amend
112+
look and feel of the record metadata. We would be happy to assist with the
113+
process.
114+
115+
Verifying metadata conformance
116+
==============================
117+
118+
You can use the provided helper script `check_fixtures.py` to check the
119+
conformance of record files to the required minimal standard:
120+
121+
.. code-block:: console
57122
58-
If you want to modify the json schema, mappings or templates, you will find these folders in the
59-
`cernopendata portal <https://github.com/cernopendata/cernopendata-portal/>`_ repository
123+
./scripts/check_fixtures.py
60124
61125
Working with docs/records
62126
-------------------------
63127

64128
The recommended development process is the following:
65129

66-
1. Create the entries under data/(records/docs)
67-
2. Validate that the yaml syntax is correct
130+
1. Create the entries under data/(records/docs) 2. Validate that the yaml
131+
syntax is correct
68132

69133
.. code-block:: console
70134

README.rst

+14-12
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,36 @@
88
.. image:: https://img.shields.io/badge/licence-GPL_2-green.svg?style=flat
99
:target: https://raw.githubusercontent.com/cernopendata/opendata.cern.ch/master/LICENSE
1010

11-
.. image:: https://badges.gitter.im/Join%20Chat.svg
12-
:target: https://gitter.im/cernopendata/opendata.cern.ch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge
13-
1411
About
1512
-----
1613

17-
This is the source code behind CERN Open Data portal. You can access the portal
18-
at `http://opendata.cern.ch/ <http://opendata.cern.ch>`_. The source code uses
19-
`Invenio <https://inveniosoftware.org/>`_ digital repository framework.
14+
This repository is part of for the `CERN Open Data portal
15+
<https://opendata.cern.ch>`_, hosting the source versions of the content,
16+
notably data records and associated documentation pages. The CERN Open Data
17+
portal's infrastructure code is living in the sister `cernopendata-portal
18+
<https://github.com/cernopendata/cernopendata-portal>`_ repository. The CERN
19+
Open Data portal is built upon the `Invenio <https://inveniosoftware.org/>`_
20+
digital repository framework.
2021

2122
Developing
2223
----------
2324

24-
If you'd like to install a demo site locally for personal developments, please
25-
see `developing guide <DEVELOPING.rst>`_ for more information.
25+
If you'd like to install a demo site of the CERN Open Data portal locally for
26+
personal developments, please see the `developing guide <DEVELOPING.rst>`_ for
27+
more information.
2628

2729
Contributing
2830
------------
2931

30-
Bug reports, feature requests and code contributions are encouraged and
31-
welcome! Please see `contributing guide <CONTRIBUTING.rst>`_ for more
32-
information.
32+
Bug reports, feature requests and contributions are encouraged and welcome!
33+
Please see the `contributing guide <CONTRIBUTING.rst>`_ for more information.
3334

3435
Support
3536
-------
3637

3738
You can ask questions at our `Forum <https://opendata-forum.cern.ch/>`_ or get
38-
in touch via our `Chatroom <https://gitter.im/cernopendata/opendata.cern.ch>`_.
39+
in touch via our `Mattermost
40+
<https://mattermost.web.cern.ch/it-dep/channels/opendata>`_ chat room.
3941

4042
Authors
4143
-------

0 commit comments

Comments
 (0)