Coverage for portality / models / v2 / shared_structs.py: 100%

3 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-05-05 00:09 +0100

1JOURNAL_BIBJSON = { 

2 "objects" : [ 

3 "bibjson" 

4 ], 

5 "structs" : { 

6 "bibjson" : { 

7 "fields" : { 

8 "alternative_title" : {"coerce" : "unicode"}, 

9 "boai" : {"coerce" : "bool"}, 

10 "eissn" : {"coerce" : "issn", "set__allow_coerce_failure" : True}, 

11 "pissn" : {"coerce" : "issn", "set__allow_coerce_failure" : True}, 

12 "discontinued_date" : {"coerce" : "bigenddate"}, 

13 "publication_time_weeks" : {"coerce" : "integer"}, 

14 "title" : {"coerce" : "unicode"}, 

15 "oa_start" : {"coerce" : "integer"} 

16 }, 

17 "lists" : { 

18 "is_replaced_by" : {"coerce" : "issn", "contains" : "field", "set__allow_coerce_failure" : True}, 

19 "keywords" : {"contains" : "field", "coerce" : "unicode_lower"}, 

20 "language" : {"contains" : "field", "coerce" : "isolang_2letter_lax"}, 

21 "license" : {"contains" : "object"}, 

22 "replaces" : {"contains" : "field", "coerce" : "issn", "set__allow_coerce_failure" : True}, 

23 "subject" : {"contains" : "object"}, 

24 "labels": {"contains": "field", "coerce": "unicode", "allowed_values": ["s2o", "mirror", "ojc"]}, 

25 }, 

26 "objects" : [ 

27 "apc", 

28 "article", 

29 "copyright", 

30 "deposit_policy", 

31 "editorial", 

32 "institution", 

33 "other_charges", 

34 "pid_scheme", 

35 "plagiarism", 

36 "preservation", 

37 "publisher", 

38 "ref", 

39 "waiver" 

40 ], 

41 "structs" : { 

42 "apc" : { 

43 "fields" : { 

44 "has_apc" : {"coerce" : "bool"}, 

45 "url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

46 }, 

47 "lists" : { 

48 "max" : {"contains" : "object"} 

49 }, 

50 "structs" : { 

51 "max" : { 

52 "fields" : { 

53 "currency" : {"coerce" : "currency_code_lax"}, 

54 "price" : {"coerce" : "integer"} 

55 } 

56 } 

57 } 

58 }, 

59 "article" : { 

60 "fields" : { 

61 "license_display_example_url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

62 }, 

63 "lists" : { 

64 "license_display" : {"contains" : "field", "coerce" : "unicode", "allowed_values" : ["Embed", "Display", "No"]}, 

65 } 

66 }, 

67 "copyright" : { 

68 "fields" : { 

69 "author_retains" : {"coerce" : "bool"}, 

70 "url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

71 } 

72 }, 

73 "deposit_policy" : { 

74 "fields" : { 

75 "has_policy" : {"coerce" : "bool"}, 

76 "is_registered" : {"coerce" : "bool"}, # FIXME: this is no longer used, but remains to aid development where databases already contain this field 

77 "url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

78 }, 

79 "lists" : { 

80 "service" : {"contains" : "field", "coerce" : "unicode"} 

81 } 

82 }, 

83 "editorial" : { 

84 "fields" : { 

85 "review_url" : {"coerce" : "url", "set__allow_coerce_failure" : True}, 

86 "board_url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

87 }, 

88 "lists" : { 

89 "review_process" : {"contains" : "field", "coerce" : "unicode"} 

90 } 

91 }, 

92 "institution" : { 

93 "fields" : { 

94 "name" : {"coerce" : "unicode"}, 

95 "country" : {"coerce" : "country_code", "set__allow_coerce_failure" : True} 

96 } 

97 }, 

98 "license" : { 

99 "fields" : { 

100 "type" : {"coerce" : "unicode"}, 

101 "BY" : {"coerce" : "bool"}, 

102 "NC" : {"coerce" : "bool"}, 

103 "ND" : {"coerce" : "bool"}, 

104 "SA" : {"coerce" : "bool"}, 

105 "url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

106 } 

107 }, 

108 "other_charges" : { 

109 "fields" :{ 

110 "has_other_charges" : {"coerce" : "bool"}, 

111 "url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

112 } 

113 }, 

114 "pid_scheme" : { 

115 "fields" : { 

116 "has_pid_scheme" : {"coerce" : "bool"}, 

117 }, 

118 "lists" : { 

119 "scheme" : {"coerce" : "unicode", "contains" : "field"} 

120 } 

121 }, 

122 "plagiarism" : { 

123 "fields" : { 

124 "detection" : {"coerce" : "bool"}, 

125 "url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

126 } 

127 }, 

128 "preservation": { 

129 "fields": { 

130 "has_preservation": {"coerce": "bool"}, 

131 "url": {"coerce" : "url", "set__allow_coerce_failure" : True} 

132 }, 

133 "lists": { 

134 "national_library": {"contains" : "field", "coerce": "unicode"}, 

135 "service": {"coerce": "unicode", "contains": "field"}, 

136 } 

137 }, 

138 "publisher" : { 

139 "fields" : { 

140 "name" : {"coerce" : "unicode"}, 

141 "country" : {"coerce" : "country_code", "set__allow_coerce_failure" : True} 

142 } 

143 }, 

144 "ref" : { 

145 "fields" : { 

146 "oa_statement" : {"coerce" : "url", "set__allow_coerce_failure" : True}, 

147 "journal" : {"coerce" : "url", "set__allow_coerce_failure" : True}, 

148 "aims_scope" : {"coerce" : "url", "set__allow_coerce_failure" : True}, 

149 "author_instructions" : {"coerce" : "url", "set__allow_coerce_failure" : True}, 

150 "license_terms" : {"coerce" : "url", "set__allow_coerce_failure" : True}, 

151 } 

152 }, 

153 "subject" : { 

154 "fields" : { 

155 "code" : {"coerce" : "unicode"}, 

156 "scheme" : {"coerce" : "unicode"}, 

157 "term" : {"coerce" : "unicode"} 

158 } 

159 }, 

160 "waiver" : { 

161 "fields" : { 

162 "has_waiver" : {"coerce" : "bool"}, 

163 "url" : {"coerce" : "url", "set__allow_coerce_failure" : True} 

164 } 

165 } 

166 } 

167 } 

168 } 

169} 

170 

171SHARED_JOURNAL_LIKE = { 

172 "fields" : { 

173 "id" : {"coerce" : "unicode"}, 

174 "created_date" : {"coerce" : "utcdatetime"}, 

175 "last_updated" : {"coerce" : "utcdatetime"}, 

176 "last_manual_update" : {"coerce" : "utcdatetime"}, 

177 "es_type": {"coerce": "unicode"} 

178 }, 

179 "objects" : [ 

180 "admin", 

181 "index" 

182 ], 

183 "structs" : { 

184 "admin" : { 

185 "fields" : { 

186 "owner" : {"coerce" : "unicode"}, 

187 "editor_group" : {"coerce" : "unicode"}, 

188 "editor" : {"coerce" : "unicode"}, 

189 "date_applied": {"coerce": "utcdatetime"}, 

190 }, 

191 "lists" : { 

192 "notes" : {"contains" : "object"} 

193 }, 

194 "objects" : [ 

195 "contact" 

196 ], 

197 "structs" : { 

198 "contact" : { 

199 "fields" : { 

200 "email" : {"coerce" : "unicode"}, 

201 "name" : {"coerce" : "unicode"} 

202 } 

203 }, 

204 "notes" : { 

205 "fields" : { 

206 "id" : {"coerce" : "unicode"}, 

207 "note" : {"coerce" : "unicode"}, 

208 "date" : {"coerce" : "utcdatetime"}, 

209 "author_id" : {"coerce" : "unicode"} # account_id of the note's author 

210 }, 

211 "objects": [ 

212 "flag" 

213 ], 

214 "structs": { 

215 "flag": { 

216 "fields": { 

217 "assigned_to": {"coerce" : "unicode"}, # account_id of the note's assignee 

218 "deadline": {"coerce" : "bigenddate"} 

219 } 

220 } 

221 } 

222 }, 

223 } 

224 }, 

225 "index" : { 

226 "fields" : { 

227 "country" : {"coerce" : "unicode"}, 

228 "has_apc" : {"coerce" : "unicode"}, 

229 "is_flagged" : {"coerce" : "bool"}, 

230 "most_urgent_flag_deadline": {"coerce" : "bigenddate"}, 

231 "unpunctitle" : {"coerce" : "unicode"}, 

232 "asciiunpunctitle" : {"coerce" : "unicode"}, 

233 "continued" : {"coerce" : "unicode"}, 

234 "has_editor_group" : {"coerce" : "unicode"}, 

235 "has_editor" : {"coerce" : "unicode"} 

236 }, 

237 "lists" : { 

238 "issn" : {"contains" : "field", "coerce" : "unicode"}, 

239 "title" : {"contains" : "field", "coerce" : "unicode"}, 

240 "subject" : {"contains" : "field", "coerce" : "unicode"}, 

241 "schema_subject" : {"contains" : "field", "coerce" : "unicode"}, 

242 "classification" : {"contains" : "field", "coerce" : "unicode"}, 

243 "language" : {"contains" : "field", "coerce" : "unicode"}, 

244 "license" : {"contains" : "field", "coerce" : "unicode"}, 

245 "classification_paths" : {"contains" : "field", "coerce" : "unicode"}, 

246 "schema_code" : {"contains" : "field", "coerce" : "unicode"}, 

247 "schema_codes_tree" : {"contains" : "field", "coerce" : "unicode"}, 

248 "flag_assignees" : {"contains" : "field", "coerce" : "unicode"} 

249 } 

250 } 

251 } 

252} 

253 

254ARTICLE_STRUCT = { 

255 "fields" : { 

256 "created_date": {"coerce": "utcdatetime"}, 

257 "es_type": {"coerce": "unicode"}, 

258 "id": {"coerce": "unicode"}, 

259 "last_updated": {"coerce": "utcdatetime"}, 

260 }, 

261 "objects": [ 

262 "admin", "index" 

263 ], 

264 "structs": { 

265 "admin": { 

266 "fields": { 

267 "in_doaj": {"coerce": "bool"}, 

268 "publisher_record_id": {"coerce": "unicode"}, 

269 "seal": {"coerce": "bool"}, 

270 "upload_id": {"coerce": "unicode"} 

271 } 

272 }, 

273 "index": { 

274 "fields": { 

275 "asciiunpunctitle" : {"coerce" : "unicode"}, 

276 "classification" : {"coerce" : "unicode"}, 

277 "classification_paths": {"coerce" : "unicode"}, 

278 "country" : {"coerce" : "unicode"}, 

279 "date" : {"coerce" : "utcdatetime"}, 

280 "date_toc_fv_month": {"coerce" : "utcdatetime"}, 

281 "doi": {"coerce" : "unicode"}, 

282 "fulltext": {"coerce" : "unicode"}, 

283 "has_seal" : {"coerce" : "unicode"}, 

284 "issn": {"coerce" : "unicode"}, 

285 "language": {"coerce" : "unicode"}, 

286 "publisher": {"coerce" : "unicode"}, 

287 "schema_code": {"coerce" : "unicode"}, 

288 "schema_codes_tree": {"coerce" : "unicode"}, 

289 "schema_subject": {"coerce" : "unicode"}, 

290 "subject": {"coerce" : "unicode"}, 

291 "unpunctitle": {"coerce" : "unicode"} 

292 } 

293 } 

294 } 

295}