Skip to content

[ENH] add code and test to help create schemas #26

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

Closed
wants to merge 78 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
e9dcc29
Merge pull request #12 from sanuann/schema-creator
satra Dec 18, 2020
2bbb27d
update examples
sanuann Mar 19, 2021
385eed5
update shacl shape too
sanuann Mar 19, 2021
5a9ee74
Merge branch 'master' into remi_schema_creator
Remi-Gau Jun 5, 2021
139eb23
fix call to base class set default method
Remi-Gau Jun 5, 2021
418eb40
update default schema version
Remi-Gau Jun 5, 2021
ab9ff7f
add possibility to choose extension of filename
Remi-Gau Jun 5, 2021
471c8bd
add some jsonld to test against
Remi-Gau Jun 5, 2021
b4c1c2c
add response options class
Remi-Gau Jun 5, 2021
a41106a
implement response option class
Remi-Gau Jun 5, 2021
53d97e7
implement float and integer and refactor
Remi-Gau Jun 5, 2021
c235e3a
add tests for select and languages
Remi-Gau Jun 5, 2021
1d0c64b
add tests for multiresponse items
Remi-Gau Jun 6, 2021
43395e7
add test for slider and multitext
Remi-Gau Jun 6, 2021
19768c2
simplify add_choice API
Remi-Gau Jun 6, 2021
f5eb4c1
create set_context method
Remi-Gau Jun 6, 2021
df56174
refactor sorting
Remi-Gau Jun 6, 2021
62226fd
add read only item
Remi-Gau Jun 6, 2021
fe7dc95
add test for email, id, date, year and time range
Remi-Gau Jun 6, 2021
4118fbe
refactor
Remi-Gau Jun 6, 2021
1b656a5
add test for state and country
Remi-Gau Jun 6, 2021
13c0de4
refactor using preset response choices
Remi-Gau Jun 6, 2021
d72da8a
add tests for activity creation
Remi-Gau Jun 6, 2021
f633b89
refactor
Remi-Gau Jun 6, 2021
e4b1085
use default context for activity test
Remi-Gau Jun 6, 2021
892e8ee
change item default value
Remi-Gau Jun 6, 2021
0cc8599
add tests for response options
Remi-Gau Jun 6, 2021
77e36e4
add default test for protocols
Remi-Gau Jun 6, 2021
8c14829
use language for preferred label by default
Remi-Gau Jun 6, 2021
cf1b3ce
get variable name for item in activity from their basename
Remi-Gau Jun 6, 2021
b7804cc
add test for protocols
Remi-Gau Jun 6, 2021
5cf4587
add clean up
Remi-Gau Jun 6, 2021
122a5f6
fix copy paste error
Remi-Gau Jun 6, 2021
fb29ac2
Add comments to tests
Remi-Gau Jun 7, 2021
92427b6
comment code
Remi-Gau Jun 7, 2021
3fad95c
Merge pull request #7 from ReproNim/schema-creator
sanuann Jun 7, 2021
1b05a2f
Merge pull request #8 from Remi-Gau/remi_schema_creator
sanuann Jun 7, 2021
580db63
wip classes
sanuann Jun 7, 2021
953f1c9
add more todo to item class
Remi-Gau Jun 7, 2021
e3e3e98
refactor classes to add remi's changes
sanuann Jun 8, 2021
9ccb4b8
Merge branch 'convertors' into schema-creator
sanuann Jun 8, 2021
ff6c950
add text area and refactor
Remi-Gau Dec 2, 2021
9391fc1
add tests for new schema
Remi-Gau Jul 30, 2022
ebf9527
Merge branch 'master' of https://github.com/ReproNim/reproschema-py i…
Remi-Gau Jul 30, 2022
f1fdf65
tmp commit
Remi-Gau Jul 30, 2022
c60ba27
remove attr new and restart refactoring
Remi-Gau Jul 30, 2022
ea68185
start using attr
Remi-Gau Jul 30, 2022
03fe296
refactor
Remi-Gau Jul 31, 2022
01e159e
remove test outputs
Remi-Gau Jul 31, 2022
6594cb0
parametrize tests
Remi-Gau Jul 31, 2022
c711d83
refactor
Remi-Gau Jul 31, 2022
45a7413
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 31, 2022
42cf00f
remove clutter
Remi-Gau Jul 31, 2022
cfe7e60
do not include test in package
Remi-Gau Aug 1, 2022
c963fc7
Merge branch 'master' into remi_schema_creator
satra Aug 1, 2022
faaf104
refactor
Remi-Gau Aug 14, 2022
dd4df02
add test for protocol from reproschema repo
Remi-Gau Aug 14, 2022
5536b6a
refactor
Remi-Gau Aug 15, 2022
6772c20
create new response option class
Remi-Gau Aug 15, 2022
ccb0df8
refactor
Remi-Gau Aug 15, 2022
e43f6ea
Merge remote-tracking branch 'origin/remi_schema_creator' into remi_s…
Remi-Gau Aug 15, 2022
dc2d69f
refactor
Remi-Gau Aug 15, 2022
cab0f74
add additional property class
Remi-Gau Aug 15, 2022
a9838f0
refactor
Remi-Gau Aug 15, 2022
dc1def0
add limit
Remi-Gau Aug 15, 2022
a724eb3
add schedule and randomMAxDelay
Remi-Gau Aug 15, 2022
6365fe1
add messages
Remi-Gau Aug 15, 2022
5c5c8f0
add audio and video
Remi-Gau Aug 15, 2022
743fd34
add additionalNotesObj
Remi-Gau Aug 15, 2022
55bf186
add unitOption
Remi-Gau Aug 15, 2022
7fd2450
read response_options from file
Remi-Gau Aug 15, 2022
746d0e4
refactor
Remi-Gau Aug 15, 2022
1c1b333
undo
Remi-Gau Aug 15, 2022
61310c8
update doc
Remi-Gau Aug 17, 2022
4d50964
adapt for tests
Remi-Gau May 11, 2024
70bd3af
lint
Remi-Gau May 11, 2024
931d586
Merge branch 'eCobidas_valid' into remi_schema_creator
Remi-Gau May 11, 2024
c75504a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 11, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**/tmp
Pipfile

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 24.4.2
hooks:
- id: black

- repo: https://github.com/asottile/reorder_python_imports
rev: "v3.12.0"
hooks:
- id: reorder-python-imports
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"cSpell.words": [
"reproschema"
],
"autoDocstring.docstringFormat": "sphinx",
"esbonio.sphinx.confDir": ""
}
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.DEFAULT_GOAL := help

define BROWSER_PYSCRIPT
import os, webbrowser, sys

from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"

# Put it first so that "make" without argument is like "make help".
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

## DOC
.PHONY: docs

docs: ## generate Sphinx HTML documentation, including API docs
rm -f docs/source/reproschema.rst
rm -f docs/source/modules.rst
sphinx-apidoc -o docs/source reproschema
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/build/html/index.html
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
20 changes: 20 additions & 0 deletions docs/source/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# architecture

<!-- https://mermaid-js.github.io/mermaid/#/ -->

```{mermaid}
classDiagram
SchemaUtils <|-- UI
SchemaBase *-- UI
SchemaBase <|-- Protocol
SchemaBase <|-- Activity
SchemaUtils <|-- Message
SchemaBase <|-- Item
Item *-- ResponseOption
SchemaUtils <|-- ResponseOption
SchemaUtils <|-- AdditionalNoteObj
SchemaUtils <|-- unitOption
SchemaUtils <|-- Choice
SchemaUtils <|-- AdditionalProperty
SchemaUtils <|-- SchemaBase
```
55 changes: 55 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys

sys.path.insert(0, os.path.abspath("../.."))


# -- Project information -----------------------------------------------------

project = "reproschema-py"
copyright = "2022, Repronim developers"
author = "Repronim developers"

# The full version, including alpha/beta/rc tags
release = "0.6.2"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx.ext.autodoc", "myst_parser", "sphinxcontrib.mermaid"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
20 changes: 20 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. reproschema-py documentation master file, created by
sphinx-quickstart on Mon Aug 15 22:56:47 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to reproschema-py's documentation!
==========================================

.. toctree::
:maxdepth: 2
:caption: Contents:

architecture

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
7 changes: 7 additions & 0 deletions docs/source/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
reproschema
===========

.. toctree::
:maxdepth: 4

reproschema
69 changes: 69 additions & 0 deletions docs/source/reproschema.models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
reproschema.models package
==========================

Submodules
----------

reproschema.models.activity module
----------------------------------

.. automodule:: reproschema.models.activity
:members:
:undoc-members:
:show-inheritance:

reproschema.models.base module
------------------------------

.. automodule:: reproschema.models.base
:members:
:undoc-members:
:show-inheritance:

reproschema.models.item module
------------------------------

.. automodule:: reproschema.models.item
:members:
:undoc-members:
:show-inheritance:

reproschema.models.protocol module
----------------------------------

.. automodule:: reproschema.models.protocol
:members:
:undoc-members:
:show-inheritance:

reproschema.models.response\_options module
-------------------------------------------

.. automodule:: reproschema.models.response_options
:members:
:undoc-members:
:show-inheritance:

reproschema.models.ui module
----------------------------

.. automodule:: reproschema.models.ui
:members:
:undoc-members:
:show-inheritance:

reproschema.models.utils module
-------------------------------

.. automodule:: reproschema.models.utils
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: reproschema.models
:members:
:undoc-members:
:show-inheritance:
53 changes: 53 additions & 0 deletions docs/source/reproschema.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
reproschema package
===================

Subpackages
-----------

.. toctree::
:maxdepth: 4

reproschema.models

Submodules
----------

reproschema.cli module
----------------------

.. automodule:: reproschema.cli
:members:
:undoc-members:
:show-inheritance:

reproschema.jsonldutils module
------------------------------

.. automodule:: reproschema.jsonldutils
:members:
:undoc-members:
:show-inheritance:

reproschema.utils module
------------------------

.. automodule:: reproschema.utils
:members:
:undoc-members:
:show-inheritance:

reproschema.validate module
---------------------------

.. automodule:: reproschema.validate
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: reproschema
:members:
:undoc-members:
:show-inheritance:
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.pytest.ini_options]
minversion = "4.4.0"
addopts = "-ra -vv"
3 changes: 0 additions & 3 deletions reproschema/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains the computed version number.

# This file is released into the public domain. Generated by
# versioneer-0.18 (https://github.com/warner/python-versioneer)

"""Git implementation of _version.py."""

import errno
import os
import re
Expand Down
4 changes: 3 additions & 1 deletion reproschema/cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os

import click

from . import get_logger, set_logger_level
from . import __version__
from . import get_logger
from . import set_logger_level

lgr = get_logger()

Expand Down
Loading