mitodl / ocw-data-parser

A parsing script for MIT OpenCourseWare course data
0 stars 0 forks source link

maintain order of Instructors #160

Closed pdpinch closed 2 years ago

pdpinch commented 2 years ago

The order of instructors in exported Plone JSON is expressed in the metadata_contributor_list dictionary, not in instructors dictionary.

For example, in 20.219 the order of instructors on the legacy site is

image

In the legacy RAW JSON , the instructors dictionary is:

    "instructors": [
        {
            "middle_initial": "", 
            "first_name": "Ceri", 
            "last_name": "Riley", 
            "uid": "cb52bc418bb66acd6b0de858cf0a4a2a", 
            "title": "", 
            "mit_id": "", 
            "department": "", 
            "salutation": "", 
            "directory_title": "", 
            "suffix": ""
        }, 
        {
            "middle_initial": "", 
            "first_name": "Elizabeth", 
            "last_name": "Choe", 
            "uid": "ee19fdd67fa664522c5f20b94e55e663", 
            "title": "", 
            "mit_id": "", 
            "department": "", 
            "salutation": "", 
            "directory_title": "", 
            "suffix": ""
        }, 
        {
            "middle_initial": "", 
            "first_name": "Joshua", 
            "last_name": "Gunn", 
            "uid": "85a7672c5bf3a57a3f61f968dfc3048b", 
            "title": "", 
            "mit_id": "", 
            "department": "", 
            "salutation": "", 
            "directory_title": "", 
            "suffix": ""
        }, 
        {
            "middle_initial": "", 
            "first_name": "Jaime", 
            "last_name": "Goldstein", 
            "uid": "3302ee9f609d0af887c8c7361063e68c", 
            "title": "", 
            "mit_id": "", 
            "department": "", 
            "salutation": "", 
            "directory_title": "", 
            "suffix": ""
        }, 
        {
            "middle_initial": "", 
            "first_name": "Natalie", 
            "last_name": "Kuldell", 
            "uid": "df2efa401f67b75caffa05c7d5fb547c", 
            "title": "Kuldell, Natalie", 
            "mit_id": "", 
            "department": "", 
            "salutation": "Dr.", 
            "directory_title": "", 
            "suffix": ""
        }, 
        {
            "middle_initial": "", 
            "first_name": "George", 
            "last_name": "Zaidan", 
            "uid": "c8c96e7a64a840109e0507c85f7abca6", 
            "title": "", 
            "mit_id": "", 
            "department": "", 
            "salutation": "", 
            "directory_title": "", 
            "suffix": ""
        }, 
        {
            "middle_initial": "", 
            "first_name": "Chris", 
            "last_name": "Boebel", 
            "uid": "9b61537f24c2041b763e343e40055ebf", 
            "title": "", 
            "mit_id": "", 
            "department": "", 
            "salutation": "", 
            "directory_title": "", 
            "suffix": ""
        }
    ], 

and the metadata_contributor_list is:

    "metadata_contributor_list": [
        {
            "md_contributor_uid": "ee19fdd67fa664522c5f20b94e55e663", 
            "md_contributor_entity": "Choe, Elizabeth", 
            "md_contributor_role": "Instructor", 
            "md_contributor_special_title": "", 
            "md_contributor_hide": "N"
        }, 
        {
            "md_contributor_uid": "", 
            "md_contributor_entity": "Todd Rautenberg", 
            "md_contributor_role": "Creator", 
            "md_contributor_special_title": "", 
            "md_contributor_hide": ""
        }, 
        {
            "md_contributor_uid": "dummy-contributor", 
            "md_contributor_entity": "", 
            "md_contributor_role": "Creator", 
            "md_contributor_special_title": "", 
            "md_contributor_hide": ""
        }, 
        {
            "md_contributor_uid": "3302ee9f609d0af887c8c7361063e68c", 
            "md_contributor_entity": "Goldstein, Jaime", 
            "md_contributor_role": "Instructor", 
            "md_contributor_special_title": "", 
            "md_contributor_hide": "N"
        }, 
        {
            "md_contributor_uid": "9b61537f24c2041b763e343e40055ebf", 
            "md_contributor_entity": "Boebel, Chris", 
            "md_contributor_role": "Instructor", 
            "md_contributor_special_title": "(Guest Lecturer)", 
            "md_contributor_hide": "N"
        }, 
        {
            "md_contributor_uid": "c8c96e7a64a840109e0507c85f7abca6", 
            "md_contributor_entity": "Zaidan, George", 
            "md_contributor_role": "Instructor", 
            "md_contributor_special_title": "(Guest Lecturer)", 
            "md_contributor_hide": "N"
        }, 
        {
            "md_contributor_uid": "85a7672c5bf3a57a3f61f968dfc3048b", 
            "md_contributor_entity": "Gunn, Joshua", 
            "md_contributor_role": "Instructor", 
            "md_contributor_special_title": "(Guest Lecturer)", 
            "md_contributor_hide": "N"
        }, 
        {
            "md_contributor_uid": "cb52bc418bb66acd6b0de858cf0a4a2a", 
            "md_contributor_entity": "Riley, Ceri", 
            "md_contributor_role": "Instructor", 
            "md_contributor_special_title": "(Teaching Assistant)", 
            "md_contributor_hide": "N"
        }, 
        {
            "md_contributor_uid": "df2efa401f67b75caffa05c7d5fb547c", 
            "md_contributor_entity": "Kuldell, Natalie", 
            "md_contributor_role": "Instructor", 
            "md_contributor_special_title": "(Guest Lecturer)", 
            "md_contributor_hide": "N"
        }
    ], 

Note that the metadata_contributor_list includes nodes that are not instructors. They should not be added to the list of Instructors.

acceptance criteria

Related issues

mbertrand commented 2 years ago

@pdpinch is this right:

pdpinch commented 2 years ago

Yes. I think that's a good plan for balancing preserving data (by including the metadata_contributor_list) and also convenience (updating the order in instructors).