From 0b51e18c6b453dad84df67e9ef985894c9d02a36 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Sat, 27 Jul 2019 14:50:43 -0400 Subject: [PATCH 1/2] all months in schemas can be integers or strings --- regolith/schemas.py | 69 ++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 20 deletions(-) diff --git a/regolith/schemas.py b/regolith/schemas.py index 611434aad..4dc775bc2 100644 --- a/regolith/schemas.py +++ b/regolith/schemas.py @@ -746,7 +746,7 @@ "first_author_last_name": "Wingit", "freewrite": "this comment didn't fit anywhere above", "journal": "Nature", - "month": "02", + "month": 2, "recommendation": "reject", "reviewer": "sbillinge", "status": "submitted", @@ -901,7 +901,7 @@ "month": { "description": "Publication month", "required": True, - "type": "string", + "anyof_type": ["string", "integer"], }, "original": { "description": "URL of original post, if this is a repost", @@ -1036,7 +1036,7 @@ "begin_month": { "description": "start month of the grant", "required": True, - "type": "string", + "anyof_type": ["string", "integer"], }, "begin_year": { "description": "start year of the grant", @@ -1064,7 +1064,7 @@ "end_month": { "description": "end month of the grant", "required": False, - "type": "string", + "anyof_type": ["string", "integer"], }, "end_year": { "description": "end year of the grant", @@ -1323,7 +1323,9 @@ "schema": { "type": "dict", "schema": { - "begin_month": {"required": False, "type": "string"}, + "begin_month": {"required": False, + "anyof_type": ["string", "integer"], + }, "begin_year": {"required": True, "type": "integer"}, "degree": {"required": True, "type": "string"}, "department": { @@ -1337,7 +1339,9 @@ "description": "this employment is/was in" "a group in groups coll", }, - "end_month": {"required": False, "type": "string"}, + "end_month": {"required": False, + "anyof_type": ["string", "integer"], + }, # Could be ongoing with undefined end "end_year": {"required": False, "type": "integer"}, "gpa": {"required": False, "type": ("float", "string")}, @@ -1360,9 +1364,13 @@ "schema": { "type": "dict", "schema": { - "begin_month": {"required": False, "type": "string"}, + "begin_month": {"required": False, + "anyof_type": ["string", "integer"], + }, "begin_year": {"required": True, "type": "integer"}, - "end_month": {"required": False, "type": "string"}, + "end_month": {"required": False, + "anyof_type": ["string", "integer"], + }, "end_year": {"required": False, "type": "integer"}, "group": { "required": False, @@ -1389,7 +1397,9 @@ "schema": { "currency": {"required": False, "type": "string"}, "duration": {"required": False, "type": "string"}, - "month": {"required": False, "type": "string"}, + "month": {"required": False, + "anyof_type": ["string", "integer"], + }, "name": {"required": True, "type": "string"}, "value": {"required": True, "type": ("float", "integer")}, "year": {"required": True, "type": "integer"}, @@ -1414,7 +1424,9 @@ "type": "dict", "schema": { "description": {"required": False, "type": "string"}, - "month": {"required": False, "type": "string"}, + "month": {"required": False, + "anyof_type": ["string", "integer"], + }, "name": {"required": True, "type": "string"}, "year": {"required": True, "type": "integer"}, }, @@ -1433,10 +1445,14 @@ "schema": { "type": "dict", "schema": { - "begin_month": {"required": False, "type": "string"}, + "begin_month": {"required": False, + "anyof_type": ["string", "integer"], + }, "begin_year": {"required": True, "type": "integer"}, "description": {"required": False, "type": "string"}, - "end_month": {"required": False, "type": "string"}, + "end_month": {"required": False, + "anyof_type": ["string", "integer"], + }, "end_year": {"required": False, "type": "integer"}, "organization": {"required": True, "type": "string"}, "position": {"required": True, "type": "string"}, @@ -1471,7 +1487,9 @@ "schema": { "description": {"required": False, "type": "string"}, "duration": {"required": False, "type": "string"}, - "month": {"required": False, "type": "string"}, + "month": {"required": False, + "anyof_type": ["string", "integer"], + }, "name": {"required": True, "type": "string"}, "year": {"required": False, "type": "integer"}, "begin_year": {"required": False, "type": "integer"}, @@ -1503,10 +1521,13 @@ "schema": { "course": {"required": True, "type": "string"}, "description": {"required": False, "type": "string"}, - "end_month": {"required": False, "type": "string"}, + "end_month": {"required": False, + "anyof_type": ["string", "integer"]}, "end_year": {"required": False, "type": "integer"}, "materials": {"required": False, "type": "string"}, - "month": {"required": False, "type": "string"}, + "month": {"required": False, + "anyof_type": ["string", "integer"], + }, "organization": {"required": True, "type": "string"}, "position": {"required": True, "type": "string"}, "syllabus": {"required": False, "type": "string"}, @@ -1549,7 +1570,9 @@ "required": True, "type": "integer", }, - "begin_month": {"required": True, "type": "integer"}, + "begin_month": {"required": True, + "anyof_type": ["string", "integer"], + }, "begin_day": {"required": False, "type": "integer"}, "department": { "description": "department of the institution where the" @@ -1564,7 +1587,9 @@ "required": False, "type": "integer", }, - "end_month": {"required": False, "type": "integer"}, + "end_month": {"required": False, + "anyof_type": ["string", "integer"], + }, "end_day": {"required": False, "type": "integer"}, "institution": { "description": "institution where the" @@ -1676,9 +1701,13 @@ "schema": { "type": "dict", "schema": { - "begin_month": {"required": False, "type": "string"}, + "begin_month": {"required": False, "anyof_type": ["string", "integer"], + "anyof_type": ["string", "integer"], + }, "begin_year": {"required": True, "type": "integer"}, - "end_month": {"required": False, "type": "string"}, + "end_month": {"required": False, "anyof_type": ["string", "integer"], + "anyof_type": ["string", "integer"], + }, "end_year": {"required": False, "type": "integer"}, "name": {"required": True, "type": "string"}, "position": {"required": True, "type": "string"}, @@ -2070,7 +2099,7 @@ "month": { "description": "month when the review is being written", "required": True, - "type": "string", + "anyof_type": ["string", "integer"], }, "recommendation": { "description": "Your publication recommendation", From 8a86486bff255f260cdaeb4f7ff9dfe47778edcf Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Sat, 27 Jul 2019 16:07:07 -0400 Subject: [PATCH 2/2] adding few new items to people schema --- news/clean_people_schema.rst | 18 +++++++++++++++++ regolith/schemas.py | 38 ++++++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 news/clean_people_schema.rst diff --git a/news/clean_people_schema.rst b/news/clean_people_schema.rst new file mode 100644 index 000000000..31ec1d2be --- /dev/null +++ b/news/clean_people_schema.rst @@ -0,0 +1,18 @@ +**Added:** None + +* Google profile URL to people schema +* Research Focus Areas to people schema +* status to employment which will be selected from a list for sorting on the + website + +**Changed:** + +* All months can now be integers or strings in the schemas + +**Deprecated:** None + +**Removed:** None + +**Fixed:** None + +**Security:** None diff --git a/regolith/schemas.py b/regolith/schemas.py index 4dc775bc2..8dc88105e 100644 --- a/regolith/schemas.py +++ b/regolith/schemas.py @@ -375,6 +375,7 @@ "end_year": 2015, "location": "Madison, WI", "organization": "CNERG, The University of " "Wisconsin-Madison", + "department": "Physics", "other": [ "Cyclus: An agent-based, discrete time nuclear fuel " "cycle simulator.", @@ -404,6 +405,7 @@ "Website: http://flash.uchicago.edu/site/", ], "position": "Research Scientist, Postdoctoral Scholar", + "status": "PI" }, ], "funding": [ @@ -415,6 +417,7 @@ {"name": "NIF User's Group Travel Award", "value": 1150, "year": 2013}, ], + "google_scholar_url": "https://scholar.google.com/citations?user=dRm8f", "home_address": { "street": "123 Wallabe Ln", "city": "The big apple", @@ -437,6 +440,10 @@ "name": "Anthony Scopatz", "orcid_id": "0000-0002-9432-4248", "position": "professor", + "research_focus_areas": [ + {"begin_year": 2010, "description": "software applied to nuclear " + "engineering and life" } + ], "skills": [ {"category": "Programming Languages", "level": "expert", "name": "Python"}, @@ -1368,6 +1375,7 @@ "anyof_type": ["string", "integer"], }, "begin_year": {"required": True, "type": "integer"}, + "department": {"required": False, "type": "string"}, "end_month": {"required": False, "anyof_type": ["string", "integer"], }, @@ -1382,6 +1390,8 @@ "organization": {"required": True, "type": "string"}, "other": {"required": False, "type": "list"}, "position": {"required": True, "type": "string"}, + # TODO this should be select from in the long run + "status": {"required": False, "type": "string"}, }, }, "type": "list", @@ -1407,6 +1417,9 @@ }, "type": "list", }, + "google_scholar_url": {"required": False, "type": "string", + "description": "URL of your Google Scholar " + "rofile"}, "home_address": { "description": "The person's home address", "type": "dict", @@ -1478,6 +1491,20 @@ "type": "string", "eallowed": list(SORTED_POSITION), }, + "research_focus_areas": { + "description": "summary of research projects that are ongoing. Used" + "in Annual appraisal for example", + "required": False, + "schema": { + "type": "dict", + "schema": { + "begin_year": {"required": False, "type": "integer"}, + "end_year": {"required": False, "type": "integer"}, + "description": {"required": False, "type": "string"} + }, + }, + "type": "list" + }, # TODO: need to handle year vs. begin_year stuff "service": { "description": "Service that this group member has provided", @@ -1487,8 +1514,11 @@ "schema": { "description": {"required": False, "type": "string"}, "duration": {"required": False, "type": "string"}, - "month": {"required": False, - "anyof_type": ["string", "integer"], + "month": {"description": "Use month and year if the service" + "doesn't extend more than one year." + "Otherwise use begin_year and end_year", + "required": False, + "anyof_type": ["string", "integer"] }, "name": {"required": True, "type": "string"}, "year": {"required": False, "type": "integer"}, @@ -1701,11 +1731,11 @@ "schema": { "type": "dict", "schema": { - "begin_month": {"required": False, "anyof_type": ["string", "integer"], + "begin_month": {"required": False, "anyof_type": ["string", "integer"], }, "begin_year": {"required": True, "type": "integer"}, - "end_month": {"required": False, "anyof_type": ["string", "integer"], + "end_month": {"required": False, "anyof_type": ["string", "integer"], }, "end_year": {"required": False, "type": "integer"},