dalia_dif 0.0.15__py3-none-any.whl → 0.0.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dalia_dif/cli.py +7 -2
- dalia_dif/dif13/picklists.py +9 -1
- dalia_dif/dif13/reader.py +24 -4
- dalia_dif/version.py +1 -1
- {dalia_dif-0.0.15.dist-info → dalia_dif-0.0.17.dist-info}/METADATA +1 -1
- {dalia_dif-0.0.15.dist-info → dalia_dif-0.0.17.dist-info}/RECORD +9 -9
- {dalia_dif-0.0.15.dist-info → dalia_dif-0.0.17.dist-info}/WHEEL +1 -1
- {dalia_dif-0.0.15.dist-info → dalia_dif-0.0.17.dist-info}/entry_points.txt +0 -0
- {dalia_dif-0.0.15.dist-info → dalia_dif-0.0.17.dist-info}/licenses/LICENSE +0 -0
dalia_dif/cli.py
CHANGED
|
@@ -17,8 +17,9 @@ def main() -> None:
|
|
|
17
17
|
|
|
18
18
|
@main.command()
|
|
19
19
|
@click.option("--dif-version", type=click.Choice(["1.3"]), default="1.3")
|
|
20
|
+
@click.option("--ignore-missing-description", is_flag=True)
|
|
20
21
|
@click.argument("location")
|
|
21
|
-
def validate(location: str, dif_version: str) -> None:
|
|
22
|
+
def validate(location: str, dif_version: str, ignore_missing_description: bool) -> None:
|
|
22
23
|
"""Validate a local/remote file or local folder of DIF-encoded CSVs."""
|
|
23
24
|
from dalia_dif.dif13 import read_dif13
|
|
24
25
|
|
|
@@ -31,7 +32,11 @@ def validate(location: str, dif_version: str) -> None:
|
|
|
31
32
|
for path in p.glob("*.csv"):
|
|
32
33
|
click.secho(f"\n> {path.relative_to(p)}", fg="green")
|
|
33
34
|
errors: list[str] = []
|
|
34
|
-
read_dif13(
|
|
35
|
+
read_dif13(
|
|
36
|
+
path,
|
|
37
|
+
error_accumulator=errors,
|
|
38
|
+
ignore_missing_description=ignore_missing_description,
|
|
39
|
+
)
|
|
35
40
|
if errors:
|
|
36
41
|
fail = True
|
|
37
42
|
for error in errors:
|
dalia_dif/dif13/picklists.py
CHANGED
|
@@ -42,6 +42,7 @@ MEDIA_TYPES = {
|
|
|
42
42
|
"image": SDO.ImageObject,
|
|
43
43
|
"multipart": modalia.Multipart,
|
|
44
44
|
}
|
|
45
|
+
|
|
45
46
|
PROFICIENCY_LEVELS = {
|
|
46
47
|
"novice": modalia.Novice,
|
|
47
48
|
"advanced beginner": modalia.Beginner,
|
|
@@ -49,6 +50,14 @@ PROFICIENCY_LEVELS = {
|
|
|
49
50
|
"proficient": modalia.Proficient,
|
|
50
51
|
"expert": modalia.Expert,
|
|
51
52
|
}
|
|
53
|
+
PROFICIENCY_TO_ORDER: dict[URIRef, int] = {
|
|
54
|
+
modalia.Novice: 0,
|
|
55
|
+
modalia.Beginner: 1,
|
|
56
|
+
modalia.Competent: 2,
|
|
57
|
+
modalia.Proficient: 3,
|
|
58
|
+
modalia.Expert: 4,
|
|
59
|
+
}
|
|
60
|
+
|
|
52
61
|
RELATED_WORKS_RELATIONS = {
|
|
53
62
|
"isPartOf": modalia.isPartOf,
|
|
54
63
|
"hasPart": SDO.hasPart,
|
|
@@ -62,7 +71,6 @@ RELATED_WORKS_RELATIONS = {
|
|
|
62
71
|
"isTranslationOf": modalia.isTranslationOf,
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
|
|
66
74
|
# Entries that will be ignored during the mapping because they shall be used as media type.
|
|
67
75
|
# Format: URI -> media type to be used instead
|
|
68
76
|
MEDIA_TYPE_EXCEPTIONS = {
|
dalia_dif/dif13/reader.py
CHANGED
|
@@ -101,6 +101,7 @@ def read_dif13(
|
|
|
101
101
|
*,
|
|
102
102
|
error_accumulator: list[str] | None = None,
|
|
103
103
|
converter: curies.Converter | None = None,
|
|
104
|
+
ignore_missing_description: bool = False,
|
|
104
105
|
) -> list[EducationalResourceDIF13]:
|
|
105
106
|
"""Parse DALIA records."""
|
|
106
107
|
if isinstance(path, str) and (path.startswith("http://") or path.startswith("https://")):
|
|
@@ -132,7 +133,12 @@ def read_dif13(
|
|
|
132
133
|
for idx, record in enumerate(reader, start=2)
|
|
133
134
|
if (
|
|
134
135
|
oer := parse_dif13_row(
|
|
135
|
-
file_name,
|
|
136
|
+
file_name,
|
|
137
|
+
idx,
|
|
138
|
+
record,
|
|
139
|
+
error_accumulator=error_accumulator,
|
|
140
|
+
converter=converter,
|
|
141
|
+
ignore_missing_description=ignore_missing_description,
|
|
136
142
|
)
|
|
137
143
|
)
|
|
138
144
|
is not None
|
|
@@ -149,16 +155,20 @@ def read_dif13_into_rdflib(
|
|
|
149
155
|
return graph
|
|
150
156
|
|
|
151
157
|
|
|
152
|
-
def parse_dif13_row(
|
|
153
|
-
file_name: str,
|
|
158
|
+
def parse_dif13_row( # noqa:C901
|
|
159
|
+
file_name: str | Path,
|
|
154
160
|
idx: int,
|
|
155
161
|
row: dict[str, str],
|
|
156
162
|
*,
|
|
157
163
|
future: bool = False,
|
|
158
164
|
error_accumulator: list[str] | None = None,
|
|
159
165
|
converter: curies.Converter | None = None,
|
|
166
|
+
ignore_missing_description: bool = False,
|
|
160
167
|
) -> EducationalResourceDIF13 | None:
|
|
161
168
|
"""Convert a row in a DALIA curation file to a resource, or return none if unable."""
|
|
169
|
+
if isinstance(file_name, Path):
|
|
170
|
+
file_name = file_name.name
|
|
171
|
+
|
|
162
172
|
supporting_communities, recommending_communities = _process_communities(
|
|
163
173
|
file_name, idx, row, error_accumulator=error_accumulator
|
|
164
174
|
)
|
|
@@ -188,6 +198,16 @@ def parse_dif13_row(
|
|
|
188
198
|
else:
|
|
189
199
|
raise ValueError(f"converter was unable to expand CURIE in keyword: {keyword}")
|
|
190
200
|
|
|
201
|
+
description = row.pop("Description").strip()
|
|
202
|
+
if not description:
|
|
203
|
+
_log(
|
|
204
|
+
file_name,
|
|
205
|
+
idx,
|
|
206
|
+
"no description given",
|
|
207
|
+
error_accumulator=None if ignore_missing_description else error_accumulator,
|
|
208
|
+
)
|
|
209
|
+
return None
|
|
210
|
+
|
|
191
211
|
try:
|
|
192
212
|
rv = EducationalResourceDIF13(
|
|
193
213
|
uuid=uuid,
|
|
@@ -198,7 +218,7 @@ def parse_dif13_row(
|
|
|
198
218
|
links=external_uris,
|
|
199
219
|
supporting_communities=supporting_communities,
|
|
200
220
|
recommending_communities=recommending_communities,
|
|
201
|
-
description=
|
|
221
|
+
description=description,
|
|
202
222
|
disciplines=_process_disciplines(
|
|
203
223
|
file_name, idx, row, error_accumulator=error_accumulator
|
|
204
224
|
),
|
dalia_dif/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dalia_dif
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.17
|
|
4
4
|
Summary: Tools for DALIA's data model for open educational resources
|
|
5
5
|
Keywords: snekpack,cookiecutter,open educational resources,educational resources,training
|
|
6
6
|
Author: Charles Tapley Hoyt
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
dalia_dif/.DS_Store,sha256=MtnD5ThzFbk9R7gZVWNniR_qnre6YMJscVWWkkQW8AM,6148
|
|
2
2
|
dalia_dif/__init__.py,sha256=uyO7jo0cu-99M2a87I7XeOH6c9ZPqRH46YgTdfXLOWg,66
|
|
3
3
|
dalia_dif/__main__.py,sha256=dlPNI11KSS49DY4SoTA1l8gQZr6iR9N1JJsySTjicUg,126
|
|
4
|
-
dalia_dif/cli.py,sha256=
|
|
4
|
+
dalia_dif/cli.py,sha256=zIKecW5aCvUrwyeW6k3ZXbb33Jl3X1d-9tZBsRpBLoU,3163
|
|
5
5
|
dalia_dif/dif13/__init__.py,sha256=tMaSW0hhnuO_Mt8CM_d0cTT6j_FSTGFY99crUawWa4w,457
|
|
6
6
|
dalia_dif/dif13/community/__init__.py,sha256=y8RnUSR1-d0oU02ZJA6z1hmDIJlUTJ66Yb51JGcp0JE,1051
|
|
7
7
|
dalia_dif/dif13/community/dalia_communities.csv,sha256=Tcpo310kOtn1zNMKu183GjqcM8XlsubGrLSvbvotJxI,6191
|
|
@@ -14,10 +14,10 @@ dalia_dif/dif13/legacy/authors.py,sha256=u7dye1lW1FifhwCnSS9GsDQPOyBRMyChkWUQFGT
|
|
|
14
14
|
dalia_dif/dif13/legacy/components.py,sha256=xS9VIfawsPl1xNF5jplgj5r6c_4xoPvFlCCZkiyni1c,11908
|
|
15
15
|
dalia_dif/dif13/legacy/learning_resource.py,sha256=N_eCXE10C7ITgcH7mXacMT2VZez89F-gAXOxzJJ65wc,4448
|
|
16
16
|
dalia_dif/dif13/model.py,sha256=GIfzAnT0Blh7Qe-wk3w_lxZld-B4VbfH2ahyaDdpuR4,6935
|
|
17
|
-
dalia_dif/dif13/picklists.py,sha256=
|
|
17
|
+
dalia_dif/dif13/picklists.py,sha256=FapSFANJZ_u432RtGyOq7v8FpKfR4X9C7n3bAAXbrNI,4933
|
|
18
18
|
dalia_dif/dif13/predicates.py,sha256=rrWVPMnMPvMelS4i2hOEWGhL11t-KR8yRrDArhGvYPE,1700
|
|
19
19
|
dalia_dif/dif13/rdf.py,sha256=ZPdGB1hM2zNuxe6gidNwOn0LJB00Zs-mj2fHOYNm_qU,5908
|
|
20
|
-
dalia_dif/dif13/reader.py,sha256=
|
|
20
|
+
dalia_dif/dif13/reader.py,sha256=g7ZtDSrUBhlKNYyvB39auAdWQHndGf6pZGJa3jFpWes,17200
|
|
21
21
|
dalia_dif/dif13/utils.py,sha256=-r5ezhD7AkaJUAsUtZl1sHG_P76fz2Q_ULXgXLyDNII,814
|
|
22
22
|
dalia_dif/namespace/__init__.py,sha256=kJGpIXZzeUdVhM_Pj465XlMkVqMB2Uc9aAZeFKQp5IQ,3105
|
|
23
23
|
dalia_dif/namespace/bibframe_lite_relation.py,sha256=2trFP98s1wCPUfiAjHg-EK09yjWXC6ePLNJIVqgZvd8,255
|
|
@@ -31,9 +31,9 @@ dalia_dif/namespace/modalia.py,sha256=pSL-G9ib0E--Jwrbu9PvMMRjMe2FzzxoSjEv-0ank2
|
|
|
31
31
|
dalia_dif/namespace/rec.py,sha256=c2Ce5IEhnM_BcZJUCXiMQEZ2GLFcC_76hfkKE16-zLc,241
|
|
32
32
|
dalia_dif/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
33
33
|
dalia_dif/utils.py,sha256=AA19Bw0vv8-ODZzDy_VR57WwndRccaQIepVS8tvodDo,761
|
|
34
|
-
dalia_dif/version.py,sha256=
|
|
35
|
-
dalia_dif-0.0.
|
|
36
|
-
dalia_dif-0.0.
|
|
37
|
-
dalia_dif-0.0.
|
|
38
|
-
dalia_dif-0.0.
|
|
39
|
-
dalia_dif-0.0.
|
|
34
|
+
dalia_dif/version.py,sha256=aAPqI66QtdgdBvrGfuSXNCjIUCx6siw8G6_BPaSwT7w,962
|
|
35
|
+
dalia_dif-0.0.17.dist-info/licenses/LICENSE,sha256=S-DsND478R_VQyGmtXbVYW67fRiJj3QfY8UXIJ4zvLI,1076
|
|
36
|
+
dalia_dif-0.0.17.dist-info/WHEEL,sha256=XjEbIc5-wIORjWaafhI6vBtlxDBp7S9KiujWF1EM7Ak,79
|
|
37
|
+
dalia_dif-0.0.17.dist-info/entry_points.txt,sha256=GmBz8JVyUD6m4v2QIxa7gm3sHIVNjTl5KTPP7L3FCGI,50
|
|
38
|
+
dalia_dif-0.0.17.dist-info/METADATA,sha256=JwAwFe9RTi_fMDtlWApattEpFAihCPtSqcG20tF-rKg,17760
|
|
39
|
+
dalia_dif-0.0.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|