TheScienceMuseum / collectionsonline

Science Museum Group Collection Online
https://collection.sciencemuseumgroup.org.uk
MIT License
45 stars 3 forks source link

Wrong field being pulled though onto People pages #1241

Open jamieu opened 5 years ago

jamieu commented 5 years ago

We seem to be pulling though the notes field (on the name) from the People records rather than the notes field on descriptions. This is likely due to the function that finds nested attributes. https://collection.sciencemuseum.org.uk/people/cp38764/ada-lovelace https://collection.sciencemuseum.org.uk/api/people/cp38764/ada-lovelace

NOTE: we are hoping to have swapped the description.type['notes'] and description.type['biography'] fields in the backend systems and index by mid-March 2019. If this work has been completed in time we should display the description.type['biography']on the page and if that field is empty then the `description.type['brief biography']' field.

      "note": [
        {
          "primary": true,
          "value": "1833 - met Charles Babbage.  1843 - translated a paper by General L. F. Menabrea, describing Babbage's main attempt to implement the notion of the projected analytical engine.  1835 - married William King, eighth Baron King of Ockham, who became the Earl of Lovelace in 1838."
        }
      ],
SimonLab commented 5 years ago

@jamieu do you know if the swap has been done (ie change biography/note):

NOTE: we are hoping to have swapped the description.type['notes'] and description.type['biography'] fields in the backend systems and index by mid-March 2019. If this work has been completed in time we should display the description.type['biography']on the page and if that field is empty then the `description.type['brief biography']' field.

If yes should I display the biography (or brief biography if biography doesn't exists) and discard notes?

jamieu commented 5 years ago

Not yet, so just keep what we have (notes = biography & short biog = short biog)

On Tue, 12 Mar 2019 at 11:08, Simon notifications@github.com wrote:

@jamieu https://github.com/jamieu do you know if the swap has been done (ie change biography/note):

NOTE: we are hoping to have swapped the description.type['notes'] and description.type['biography'] fields in the backend systems and index by mid-March 2019. If this work has been completed in time we should display the description.type['biography']on the page and if that field is empty then the `description.type['brief biography']' field.

If yes should I display the biography (or brief biography if biography doesn't exists) and discard notes?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TheScienceMuseum/collectionsonline/issues/1241#issuecomment-471956743, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFk5WG_aBL4OsxCuKUtqTFp4xvVFTp1ks5vV4q_gaJpZM4bUjYk .

SimonLab commented 5 years ago

We are in fact currently returning the biography value for the person description.

This will create a json object with all the attributes for the person and especially data.attributes.description:

[ { primary: true,
    type: 'biography',
    value:
     '1833 - met Charles Babbage.  1843 - translated a paper by General L. F. Menabrea, describing Babbage\'s main attempt to implement the notion of the projected analytical engine.  1835 - married William King, eighth Baron King of Ockham, who became the Earl of Lovelace in 1838.' },
  { type: 'brief biography',
    value: '1815-1852, mathematician; computer pioneer, British' },
  { type: 'note',
    value:
     'Betty Alexandra Toole, ‘Byron, (Augusta) Ada [married name (Augusta) Ada King, countess of Lovelace] (1815–1852)’, Oxford Dictionary of National Biography, Oxford University Press, Sept 2004; online edn, Jan 2007 [http://www.oxforddnb.com/view/article/37253] (Augusta) Ada Byron (1815–1852): doi:10.1093/ref:odnb/37253' } ]

and data.attributes.note:

[ { primary: true,
    value:
     '1833 - met Charles Babbage.  1843 - translated a paper by General L. F. Menabrea, describing Babbage\'s main attempt to implement the notion of the projected analytical engine.  1835 - married William King, eighth Baron King of Ockham, who became the Earl of Lovelace in 1838.' } ]

This function allow us to define which field is prioritise to create the description from: https://github.com/TheScienceMuseum/collectionsonline/blob/202e34795aa9db7b90df0cb764af3dca947a7543/lib/helpers/json-to-html-data/get-description.js#L27-L30 In this case we can see that the field note is prioritised. So we first need to reorder these to make the the description field the priority. Then the loop: https://github.com/TheScienceMuseum/collectionsonline/blob/202e34795aa9db7b90df0cb764af3dca947a7543/lib/helpers/json-to-html-data/get-description.js#L44-L51

we'll attempt to find the primary value which in our case is biography.