Skip to content

Commit

Permalink
schemas: document schema remodeling
Browse files Browse the repository at this point in the history
* changed abstract fields
* remodeled object of identifiers (many fields)
* remodeled object of notes and internal notes
* removed emails
* removed enums
* added extra_data field
  • Loading branch information
kpsherva authored and zzacharo committed Oct 8, 2019
1 parent a99e731 commit 9bd6790
Show file tree
Hide file tree
Showing 16 changed files with 630 additions and 1,310 deletions.
49 changes: 44 additions & 5 deletions invenio_app_ils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,37 @@ class DocumentGenerator(Generator):

DOCUMENT_TYPES = ["BOOK", "STANDARD", "PROCEEDINGS"]
LANGUAGES = [u"en", u"fr", u"it", u"el", u"pl", u"ro", u"sv", u"es"]
AUTHORS = [{"full_name": "Close, Frank"},
{"full_name": "Doe, Jane",
"affiliations": [{"name": "Imperial Coll., London",
"identifiers":
[
{"scheme": "INSPIRE",
"value": "12345"}
]
}
],
"identifiers": [
{"scheme": "CERN", "value": "2108633"}
],
"roles": ["editor"]
},
{"full_name": "Doe, John", "roles": ["author"],
"affiliations": [{"name": "CERN"}]
},
{"full_name": "CERN", "type": "organisation"}
]
CONFERENCE_INFO = {"acronym": "CHEP", "country": "AU",
"dates": "1 - 20 Nov. 2019",
"identifiers": [{"scheme": "CERN",
"value": "CHEP2019"}
],
"place": "Adelaide",
"series": "CHEP",
"title": "Conference on Computing"
" in High Energy Physics",
"year": 2019,
}

def generate(self):
"""Generate."""
Expand All @@ -277,17 +308,25 @@ def generate(self):
{
"pid": str(pid),
"title": lorem.sentence(),
"authors": [{"full_name": "{}".format(lorem.sentence())}],
"abstracts": [{"value": "{}".format(lorem.text())}],
"authors": random.sample(self.AUTHORS, randint(1, 3)),
"abstract": "{}".format(lorem.text()),
"document_type": random.choice(self.DOCUMENT_TYPES),
"_access": {},
"languages": random.sample(self.LANGUAGES, 1),
"languages": random.sample(self.LANGUAGES, randint(1, 3)),
"imprints": [{"publisher": "{}".format(lorem.sentence())}],
"table_of_content": ["{}".format(lorem.sentence())],
"notes": [{"value": "{}".format(lorem.text())}],
"note": "{}".format(lorem.text()),
"tag_pids": random.sample(tag_pids, randint(0, 5)),
"edition": str(pid),
"keywords": lorem.sentence(),
"keywords": {"source": lorem.sentence(),
"value": lorem.sentence()},
"conference_info": self.CONFERENCE_INFO,
"number_of_pages": str(random.randint(0, 300)),
"urls": [{"description": "{}".format(lorem.sentence()),
"value": "{}".format(lorem.sentence()),
}],


}
for pid in range(1, size + 1)
]
Expand Down
39 changes: 22 additions & 17 deletions invenio_app_ils/mappings/v6/documents/document-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
"$schema": {
"type": "keyword"
},
"abstracts": {
"properties": {
"source": {
"type": "text"
},
"value": {
"type": "text"
}
},
"type": "object"
"abstract": {
"type": "text"
},
"authors": {
"properties": {
"affiliations": {
"properties": {
"curated_relation": {
"type": "boolean"
"identifiers": {
"properties": {
"scheme": {
"type": "keyword"
},
"value": {
"type": "keyword"
}
},
"type": "object"
},
"value": {
"name": {
"type": "keyword"
}
},
Expand All @@ -48,9 +48,6 @@
"alternative_names": {
"type": "keyword"
},
"email": {
"type": "keyword"
},
"full_name": {
"type": "text"
},
Expand Down Expand Up @@ -155,7 +152,15 @@
"type": "object"
},
"keywords": {
"type": "text"
"properties": {
"source": {
"type": "text"
},
"value": {
"type": "text"
}
},
"type": "object"
},
"languages": {
"type": "keyword"
Expand Down
39 changes: 22 additions & 17 deletions invenio_app_ils/mappings/v7/documents/document-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
"$schema": {
"type": "keyword"
},
"abstracts": {
"properties": {
"source": {
"type": "text"
},
"value": {
"type": "text"
}
},
"type": "object"
"abstract": {
"type": "text"
},
"authors": {
"properties": {
"affiliations": {
"properties": {
"curated_relation": {
"type": "boolean"
"identifiers": {
"properties": {
"scheme": {
"type": "keyword"
},
"value": {
"type": "keyword"
}
},
"type": "object"
},
"value": {
"name": {
"type": "keyword"
}
},
Expand All @@ -47,9 +47,6 @@
"alternative_names": {
"type": "keyword"
},
"email": {
"type": "keyword"
},
"full_name": {
"type": "text"
},
Expand Down Expand Up @@ -154,7 +151,15 @@
"type": "object"
},
"keywords": {
"type": "text"
"properties": {
"source": {
"type": "text"
},
"value": {
"type": "text"
}
},
"type": "object"
},
"languages": {
"type": "keyword"
Expand Down
Loading

0 comments on commit 9bd6790

Please sign in to comment.