Open jamieu opened 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
?
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 .
We are in fact currently returning the biography
value for the person description.
/people/id/slug
(e.g; /people/cp38764/ada-lovelace
) the person.js
handler is called which get the data from Elasticsearch and convert it to a json format with:
https://github.com/TheScienceMuseum/collectionsonline/blob/202e34795aa9db7b90df0cb764af3dca947a7543/routes/person.js#L31This 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 json object is then converted to data that will be used by the html template engine, this is done with the functionJSONToHTML
call here:
https://github.com/TheScienceMuseum/collectionsonline/blob/202e34795aa9db7b90df0cb764af3dca947a7543/routes/route-helpers/response.js#L8
the json to html function is created here with the function in json-to-html-data: https://github.com/TheScienceMuseum/collectionsonline/blob/master/lib/transforms/json-to-html-data.js
Then the getDescription
function is called: https://github.com/TheScienceMuseum/collectionsonline/blob/master/lib/helpers/json-to-html-data/get-description.js.
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
.
We seem to be pulling though the
notes
field (on the name) from the People records rather than thenotes
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-lovelaceNOTE: we are hoping to have swapped the
description.type['notes']
anddescription.type['biography']
fields in the backend systems and index by mid-March 2019. If this work has been completed in time we should display thedescription.type['biography']
on the page and if that field is empty then the `description.type['brief biography']' field.