Skip to content

Commit 81e3ae6

Browse files
committed
feat(fixtures): enrich fixtures
* Adds organisations, collections, subdivisions, projects, deposits fixtures. * Adds a generic cli to load fixtures. * Adds randomly collections, subdivisions, projects to the document and deposit fixtures. Co-Authored-by: Johnny Mariéthoz <[email protected]>
1 parent f644a44 commit 81e3ae6

File tree

11 files changed

+355
-91
lines changed

11 files changed

+355
-91
lines changed

data/collections/data.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[
2+
{
3+
"description": [
4+
{
5+
"language": "eng",
6+
"value": "A collection to list the **best** fictive research in the institution.\n\n1. Quality\n2. Age\n3. Epistemology"
7+
},
8+
{
9+
"language": "fre",
10+
"value": "Une collection visant \u00e0 r\u00e9pertorier les **meilleures** recherches fictives men\u00e9es au sein de l'institution.\n\n1. Qualit\u00e9\n2. \u00c2ge\n3. \u00c9pist\u00e9mologie"
11+
}
12+
],
13+
"name": [
14+
{ "language": "eng", "value": "Brand new research" },
15+
{ "language": "fre", "value": "Recherches flambant neuves" }
16+
],
17+
"organisation": {
18+
"$ref": "https://sonar.ch/api/organisations/fictivededicated"
19+
},
20+
"files": [
21+
{
22+
"key": "brand_new_research.png",
23+
"path": "./files/brand_new_research.png"
24+
}
25+
]
26+
}
27+
]
195 KB
Loading

data/deposits.json

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
[
2+
{
3+
"logs": [
4+
{
5+
"date": "2025-09-30T13:38:57.921169+00:00",
6+
"user": "[email protected]",
7+
"action": "submit"
8+
}
9+
],
10+
"step": "diffusion",
11+
"user": "[email protected]",
12+
"status": "to_validate",
13+
"$schema": "https://sonar.ch/schemas/deposits/deposit-v1.0.0.json",
14+
"metadata": {
15+
"title": "Methodology in research papers",
16+
"language": "eng",
17+
"subtitle": "an analysis",
18+
"publication": {
19+
"pages": "132-134",
20+
"number": "8",
21+
"volume": "56",
22+
"publishedIn": "Science"
23+
},
24+
"customField1": ["Probable"],
25+
"documentDate": "2018",
26+
"documentType": "coar:c_3e5a",
27+
"identifiedBy": [
28+
{ "type": "uri", "value": "https://scholar.google.com/" }
29+
],
30+
"classification": "65",
31+
"otherLanguageTitle": {
32+
"title": "La m\u00e9thodolgie dans les travaux de recherche",
33+
"language": "fre"
34+
}
35+
},
36+
"diffusion": { "masked": "not_masked", "license": "CC BY-SA" },
37+
"contributors": [
38+
{
39+
"name": "Jack Dyke",
40+
"role": "cre",
41+
"affiliation": "UNIL",
42+
"date_of_birth": "1985"
43+
},
44+
{
45+
"name": "Robert Zenem",
46+
"role": "ctb",
47+
"affiliation": "HEP Valais",
48+
"date_of_birth": "1991"
49+
}
50+
]
51+
},
52+
{
53+
"logs": [
54+
{
55+
"date": "2025-10-02T06:07:21.087327+00:00",
56+
"user": "[email protected]",
57+
"action": "submit"
58+
},
59+
{
60+
"date": "2025-10-02T06:12:24.119853+00:00",
61+
"user": "[email protected]",
62+
"action": "ask_for_changes",
63+
"comment": "Corriger la faute de frappe dans le titre, merci"
64+
},
65+
{
66+
"date": "2025-10-02T06:16:52.634537+00:00",
67+
"user": "[email protected]",
68+
"action": "submit"
69+
},
70+
{
71+
"date": "2025-10-02T06:17:41.003113+00:00",
72+
"user": "[email protected]",
73+
"action": "ask_for_changes",
74+
"comment": "There is still an error in the title"
75+
}
76+
],
77+
"step": "diffusion",
78+
"user": "[email protected]",
79+
"status": "ask_for_changes",
80+
"$schema": "https://sonar.ch/schemas/deposits/deposit-v1.0.0.json",
81+
"metadata": {
82+
"title": "Conferences about information tehcnology",
83+
"language": "eng",
84+
"subtitle": "using Python in libraries",
85+
"documentDate": "2016",
86+
"documentType": "coar:c_18cp"
87+
},
88+
"diffusion": { "masked": "not_masked", "license": "License undefined" },
89+
"contributors": [{ "name": "Marvin Straite", "role": "cre" }]
90+
},
91+
{
92+
"step": "contributors",
93+
"user": "[email protected]",
94+
"status": "in_progress",
95+
"$schema": "https://sonar.ch/schemas/deposits/deposit-v1.0.0.json",
96+
"_bucket": "d96ae40a-6f39-4905-a7a1-0fe8229c55d5",
97+
"metadata": {
98+
"title": "In progress",
99+
"language": "ger",
100+
"documentDate": "2023",
101+
"documentType": "coar:c_816b"
102+
}
103+
},
104+
{
105+
"step": "diffusion",
106+
"user": "[email protected]",
107+
"status": "in_progress",
108+
"$schema": "https://sonar.ch/schemas/deposits/deposit-v1.0.0.json",
109+
"metadata": {
110+
"title": "The sun and its effects on mood",
111+
"language": "fre",
112+
"subjects": [{ "language": "fre", "subjects": ["Psychologie"] }],
113+
"subtitle": "meta-analysis",
114+
"documentDate": "2026",
115+
"documentType": "coar:c_8544"
116+
},
117+
"diffusion": {
118+
"masked": "not_masked",
119+
"license": "CC BY",
120+
"oa_status": "green"
121+
},
122+
"contributors": [
123+
{ "name": "Bobby Kanotedit", "role": "cre", "affiliation": "UNIGE" }
124+
]
125+
}
126+
]

data/projects.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"metadata": {
4+
"name": "Study of paper submissions",
5+
"validation": {
6+
"status": "in_progress",
7+
"action": "save",
8+
9+
},
10+
"description": "We want to submit all sorts of papers",
11+
"startDate": "2025-09-15",
12+
"organisation": {
13+
"$ref": "https://sonar.ch/api/organisations/fictivededicated"
14+
},
15+
16+
}
17+
}
18+
]

data/subdivisions.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"name": [{ "language": "fre", "value": "Facult\u00e9 des lettres" }],
4+
"organisation": {
5+
"$ref": "https://sonar.ch/api/organisations/fictivededicated"
6+
}
7+
},
8+
{
9+
"name": [{ "language": "fre", "value": "Facult\u00e9 des sciences" }],
10+
"organisation": {
11+
"$ref": "https://sonar.ch/api/organisations/fictivededicated"
12+
}
13+
}
14+
]

data/users/data.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@
117117
"phone": "+41627676171",
118118
"organisation": {
119119
"$ref": "https://sonar.ch/api/organisations/fictivededicated"
120-
}
120+
},
121+
"subdivision": {"$ref": "https://sonar.ch/api/subdivisions/1"}
121122
},
122123
{
123124
"first_name": "James",
@@ -132,7 +133,8 @@
132133
"phone": "+41269639084",
133134
"organisation": {
134135
"$ref": "https://sonar.ch/api/organisations/fictivededicated"
135-
}
136+
},
137+
"subdivision": {"$ref": "https://sonar.ch/api/subdivisions/1"}
136138
},
137139
{
138140
"first_name": "Gabriel",
@@ -147,7 +149,8 @@
147149
"phone": "+41914105597",
148150
"organisation": {
149151
"$ref": "https://sonar.ch/api/organisations/fictivededicated"
150-
}
152+
},
153+
"subdivision": {"$ref": "https://sonar.ch/api/subdivisions/2"}
151154
},
152155
{
153156
"first_name": "Michèle",
@@ -162,7 +165,8 @@
162165
"phone": "+41225022590",
163166
"organisation": {
164167
"$ref": "https://sonar.ch/api/organisations/fictivededicated"
165-
}
168+
},
169+
"subdivision": {"$ref": "https://sonar.ch/api/subdivisions/2"}
166170
},
167171
{
168172
"first_name": "Shakira",

scripts/setup

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ invenio flask_wiki index
9494

9595
# Create users and organisations
9696
section "Create organisations" "info"
97-
invenio fixtures organisations import "${fixtures_folder}/organisations/data.json"
97+
invenio fixtures import "${fixtures_folder}/organisations/data.json" org
98+
99+
section "Create subdivisions" "info"
100+
invenio fixtures import "${fixtures_folder}/subdivisions.json" subd
98101

99102
# Create OAI sets for organisations
100103
section "Create organisations OAI sets" "info"
@@ -105,7 +108,16 @@ invenio documents oai create-set fictiveshared "École des hautes études partag
105108
section "Create users" "info"
106109
invenio fixtures users import "${fixtures_folder}/users/data.json"
107110

111+
section "Create collections" "info"
112+
invenio fixtures import "${fixtures_folder}/collections/data.json" coll
113+
114+
section "Create projects" "info"
115+
invenio fixtures import "${fixtures_folder}/projects.json" projects
116+
117+
section "Create deposits" "info"
118+
invenio fixtures import --random-files "${fixtures_folder}/deposits.json" depo
119+
108120
section "Create documents" "info"
109-
invenio fixtures documents import "${fixtures_folder}/documents/data.json"
121+
invenio fixtures import --random-files "${fixtures_folder}/documents/data.json" doc
110122

111123
message "\nInstallation finished successfully" "success"

0 commit comments

Comments
 (0)