From 5496e1ea71cab0f9c6d6cb852edb7cab1f0995ab Mon Sep 17 00:00:00 2001 From: Sebastian Mihalache <sebi.mihalache@gmail.com> Date: Mon, 5 Nov 2018 15:38:14 +0200 Subject: [PATCH] feat(mts-package): add setReviewers function --- .../src/getJsonTemplate.js | 74 ++++ .../src/templateSetters.js | 45 +++ .../tests/sampleWithReviewers.json | 338 +++++++++++++++++- .../tests/sampleWithReviewers.xml | 11 +- 4 files changed, 460 insertions(+), 8 deletions(-) diff --git a/packages/component-mts-package/src/getJsonTemplate.js b/packages/component-mts-package/src/getJsonTemplate.js index 48e6619fe..2450cea1b 100644 --- a/packages/component-mts-package/src/getJsonTemplate.js +++ b/packages/component-mts-package/src/getJsonTemplate.js @@ -149,6 +149,80 @@ module.exports = { questions: { question: [], }, + 'rev-group': { + rev: [ + { + _attributes: { + 'rev-type': 'reviewer', + }, + name: { + surname: { + _text: 'Last Name', + }, + 'given-names': { + _text: 'First Name', + }, + prefix: { + _text: 'Dr', + }, + }, + email: { + _text: 'faraday@hindawi.com', + }, + xref: { + _attributes: { + 'ref-type': 'aff', + rid: 'aff1', + }, + }, + date: [ + { + _attributes: { + 'date-type': 'assignment', + }, + day: { + _text: '24', + }, + month: { + _text: '10', + }, + year: { + _text: '2018', + }, + }, + { + _attributes: { + 'date-type': 'submission', + }, + day: { + _text: '24', + }, + month: { + _text: '10', + }, + year: { + _text: '2018', + }, + }, + ], + comment: { + _attributes: { + 'comment-type': 'comment', + }, + _text: + 'This article is really great! well written and does not need any update. Please publish it as such', + }, + }, + ], + aff: { + _attributes: { + id: 'aff1', + }, + 'addr-line': { + _text: 'University of Fort Hare, Alice 5700, South Africa', + }, + }, + }, }, }, }), diff --git a/packages/component-mts-package/src/templateSetters.js b/packages/component-mts-package/src/templateSetters.js index 3755099c0..06a21fb58 100644 --- a/packages/component-mts-package/src/templateSetters.js +++ b/packages/component-mts-package/src/templateSetters.js @@ -227,6 +227,51 @@ module.exports = { return jsonTemplate }, createFileName: ({ id = Date.now(), prefix }) => `${prefix}${id}`, + setReviewers: (reviewers = [], jsonTemplate) => { + const contrib = reviewers.map((rev, i) => ({ + _attributes: { + 'rev-type': 'reviewer', + }, + name: { + surname: { + _text: rev.lastName, + }, + 'given-names': { + _text: rev.firstName, + }, + prefix: { + _text: rev.title || 'Dr.', + }, + }, + email: { + _text: rev.email, + }, + xref: { + _attributes: { + 'ref-type': 'aff', + rid: `aff${i + 1}`, + }, + }, + })) + const aff = reviewers.map((rev, i) => ({ + _attributes: { + id: `aff${i + 1}`, + }, + country: rev.country || 'UK', + 'addr-line': { + _text: rev.affiliation || '', + }, + })) + + set( + jsonTemplate, + 'article.front.article-meta.contrib-group.contrib', + contrib, + ) + set(jsonTemplate, 'article.front.article-meta.contrib-group.aff', aff) + + return jsonTemplate + }, } const parseHtml = (content = '', options) => { diff --git a/packages/component-mts-package/tests/sampleWithReviewers.json b/packages/component-mts-package/tests/sampleWithReviewers.json index aa38859f0..6611a9304 100644 --- a/packages/component-mts-package/tests/sampleWithReviewers.json +++ b/packages/component-mts-package/tests/sampleWithReviewers.json @@ -1 +1,337 @@ -{"_declaration":{"_attributes":{"version":"1.0","encoding":"utf-8"}},"_doctype":"article SYSTEM \"JATS-archivearticle1-mathml3.dtd\"","article":{"_attributes":{"dtd-version":"1.1d1","article-type":"Research Article"},"front":{"journal-meta":{"journal-id":[{"_attributes":{"journal-id-type":"publisher"},"_text":"BCA"},{"_attributes":{"journal-id-type":"email"},"_text":"bca.support@hindawi.com"}],"journal-title-group":{"journal-title":{"_text":"Bioinorganic Chemistry and Applications"}},"issn":[{"_attributes":{"pub-type":"ppub"},"_text":"2474-7394"},{"_attributes":{"pub-type":"epub"}}]},"article-meta":{"article-id":[{"_attributes":{"pub-id-type":"publisher-id"},"_text":"BCA-5402665"},{"_attributes":{"pub-id-type":"manuscript"},"_text":"BCA-5402665"}],"article-categories":{"subj-group":{"_attributes":{"subj-group-type":"Article Type"},"subject":{"_text":"Review Article"}}},"title-group":{"article-title":{"_text":"Advances in iron compounds as biological agents"}},"contrib-group":{"contrib":{"_attributes":{"contrib-type":"author","corresp":"Yes"},"role":{"_attributes":{"content-type":"1"}},"name":{"surname":{"_text":"Ayodele"},"given-names":{"_text":"Odularu"},"prefix":{"_text":"dr"}},"email":{"_text":"201106223@ufh.ac.za"},"xref":{"_attributes":{"ref-type":"aff","rid":"aff1"}}},"aff":{"_attributes":{"id":"aff1"},"country":{"_text":"ZA"},"addr-line":{"_text":"University of Fort Hare, Alice 5700, South Africa"}}},"history":{"date":{"_attributes":{"date-type":"received"},"day":{"_text":"24"},"month":{"_text":"10"},"year":{"_text":"2018"}}},"abstract":{"_text":"Abstract\nThis mini review gives a report of the progresses in the use of iron compounds as biological agents. Review entails coordination of ligands in form of pharmaceutical drugs, reagents used directly as supplied, synthesized organic compounds and natural products from plants to iron(II) or iron(III) ions to yield compounds which were applied as antibacterial, iron natural product, antioxidant and anticancer agents. In addition, in the aspect of material chemistry, holistic application of iron nanoparticles was assessed in relation to health. Iron nanoparticles are best approaches to apply as biological agents when compared to bulk materials because of its affordable, biocompatibity, biodegradability, simple approach to synthesis, ease of modification and non-toxic nature.\n\nKeywords: history of iron; chemistry of iron, uses of iron compounds, iron nanoparticles; biological screening techniques\n"},"funding-group":{}},"rev-group":{"rev":[{"_attributes":{"rev-type":"reviewer"},"name":{"surname":{"_text":"Mohammed"},"given-names":{"_text":"Rizk"},"prefix":{"_text":"dr"}},"email":{"_text":"mohammed.rizk@hindawi.com"},"xref":{"_attributes":{"ref-type":"aff","rid":"aff1"}},"date":[{"_attributes":{"date-type":"assignment"},"day":{"_text":"24"},"month":{"_text":"10"},"year":{"_text":"2018"}},{"_attributes":{"date-type":"submission"},"day":{"_text":"24"},"month":{"_text":"10"},"year":{"_text":"2018"}}],"comment":{"_attributes":{"comment-type":""},"_text":"\n This article is really great! well written and does not need any update. Please publish it as such\n "}},{"_attributes":{"rev-type":"editor"},"name":{"surname":{"_text":"Matt"},"given-names":{"_text":"Green"},"prefix":{"_text":"dr"}},"email":{"_text":"matt.green@hindawi.com"},"xref":{"_attributes":{"ref-type":"aff","rid":"aff1"}},"date":[{"_attributes":{"date-type":"assignment"},"day":{"_text":"24"},"month":{"_text":"10"},"year":{"_text":"2018"}},{"_attributes":{"date-type":"submission"},"day":{"_text":"24"},"month":{"_text":"10"},"year":{"_text":"2018"}}],"comment":[{"_attributes":{"comment-type":"comment"},"_text":"\n Public comment for the author.\n "},{"_attributes":{"comment-type":"Confidential"},"_text":"\n Internal staff comment.\n "}]}],"aff":{"_attributes":{"id":"aff1"},"country":{"_text":"ZA"},"addr-line":{"_text":"University of Fort Hare, Alice 5700, South Africa"}}},"files":{"file":{"item_type":{"_text":"manuscripts"},"item_description":{"_text":"23 2018.docx"},"item_name":{"_text":"23 2018.docx"}}},"questions":{"question":[{"_attributes":{"type":"COI"},"answer":{"_text":"No"},"statement":{}},{"_attributes":{"type":"DA"},"answer":{"_text":"No"},"statement":{"_text":"The authors for this paper did not provide a data availability statement"}},{"_attributes":{"type":"Fund"},"answer":{"_text":"Yes"},"statement":{}}]}}}} \ No newline at end of file +{ + "_declaration": { + "_attributes": { + "version": "1.0", + "encoding": "utf-8" + } + }, + "_doctype": "article SYSTEM \"JATS-archivearticle1-mathml3.dtd\"", + "article": { + "_attributes": { + "dtd-version": "1.1d1", + "article-type": "Research Article" + }, + "front": { + "journal-meta": { + "journal-id": [ + { + "_attributes": { + "journal-id-type": "publisher" + }, + "_text": "BCA" + }, + { + "_attributes": { + "journal-id-type": "email" + }, + "_text": "bca.support@hindawi.com" + } + ], + "journal-title-group": { + "journal-title": { + "_text": "Bioinorganic Chemistry and Applications" + } + }, + "issn": [ + { + "_attributes": { + "pub-type": "ppub" + }, + "_text": "2474-7394" + }, + { + "_attributes": { + "pub-type": "epub" + } + } + ] + }, + "article-meta": { + "article-id": [ + { + "_attributes": { + "pub-id-type": "publisher-id" + }, + "_text": "BCA-5402665" + }, + { + "_attributes": { + "pub-id-type": "manuscript" + }, + "_text": "BCA-5402665" + } + ], + "article-categories": { + "subj-group": { + "_attributes": { + "subj-group-type": "Article Type" + }, + "subject": { + "_text": "Review Article" + } + } + }, + "title-group": { + "article-title": { + "_text": "Advances in iron compounds as biological agents" + } + }, + "contrib-group": { + "contrib": { + "_attributes": { + "contrib-type": "author", + "corresp": "Yes" + }, + "role": { + "_attributes": { + "content-type": "1" + } + }, + "name": { + "surname": { + "_text": "Ayodele" + }, + "given-names": { + "_text": "Odularu" + }, + "prefix": { + "_text": "dr" + } + }, + "email": { + "_text": "201106223@ufh.ac.za" + }, + "xref": { + "_attributes": { + "ref-type": "aff", + "rid": "aff1" + } + } + }, + "aff": { + "_attributes": { + "id": "aff1" + }, + "country": { + "_text": "ZA" + }, + "addr-line": { + "_text": "University of Fort Hare, Alice 5700, South Africa" + } + } + }, + "history": { + "date": { + "_attributes": { + "date-type": "received" + }, + "day": { + "_text": "24" + }, + "month": { + "_text": "10" + }, + "year": { + "_text": "2018" + } + } + }, + "abstract": { + "_text": "Abstract\nThis mini review gives a report of the progresses in the use of iron compounds as biological agents. Review entails coordination of ligands in form of pharmaceutical drugs, reagents used directly as supplied, synthesized organic compounds and natural products from plants to iron(II) or iron(III) ions to yield compounds which were applied as antibacterial, iron natural product, antioxidant and anticancer agents. In addition, in the aspect of material chemistry, holistic application of iron nanoparticles was assessed in relation to health. Iron nanoparticles are best approaches to apply as biological agents when compared to bulk materials because of its affordable, biocompatibity, biodegradability, simple approach to synthesis, ease of modification and non-toxic nature.\n\nKeywords: history of iron; chemistry of iron, uses of iron compounds, iron nanoparticles; biological screening techniques\n" + }, + "funding-group": {} + }, + "rev-group": { + "rev": [ + { + "_attributes": { + "rev-type": "reviewer" + }, + "name": { + "surname": { + "_text": "Mohammed" + }, + "given-names": { + "_text": "Rizk" + }, + "prefix": { + "_text": "dr" + } + }, + "email": { + "_text": "mohammed.rizk@hindawi.com" + }, + "xref": { + "_attributes": { + "ref-type": "aff", + "rid": "aff1" + } + }, + "date": [ + { + "_attributes": { + "date-type": "assignment" + }, + "day": { + "_text": "24" + }, + "month": { + "_text": "10" + }, + "year": { + "_text": "2018" + } + }, + { + "_attributes": { + "date-type": "submission" + }, + "day": { + "_text": "24" + }, + "month": { + "_text": "10" + }, + "year": { + "_text": "2018" + } + } + ], + "comment": { + "_attributes": { + "comment-type": "" + }, + "_text": "\n This article is really great! well written and does not need any update. Please publish it as such\n " + } + }, + { + "_attributes": { + "rev-type": "editor" + }, + "name": { + "surname": { + "_text": "Matt" + }, + "given-names": { + "_text": "Green" + }, + "prefix": { + "_text": "dr" + } + }, + "email": { + "_text": "matt.green@hindawi.com" + }, + "xref": { + "_attributes": { + "ref-type": "aff", + "rid": "aff1" + } + }, + "date": [ + { + "_attributes": { + "date-type": "assignment" + }, + "day": { + "_text": "24" + }, + "month": { + "_text": "10" + }, + "year": { + "_text": "2018" + } + }, + { + "_attributes": { + "date-type": "submission" + }, + "day": { + "_text": "24" + }, + "month": { + "_text": "10" + }, + "year": { + "_text": "2018" + } + } + ], + "comment": [ + { + "_attributes": { + "comment-type": "comment" + }, + "_text": "\n Public comment for the author.\n " + }, + { + "_attributes": { + "comment-type": "Confidential" + }, + "_text": "\n Internal staff comment.\n " + } + ] + } + ], + "aff": { + "_attributes": { + "id": "aff1" + }, + "country": { + "_text": "ZA" + }, + "addr-line": { + "_text": "University of Fort Hare, Alice 5700, South Africa" + } + } + }, + "files": { + "file": { + "item_type": { + "_text": "manuscripts" + }, + "item_description": { + "_text": "23 2018.docx" + }, + "item_name": { + "_text": "23 2018.docx" + } + } + }, + "questions": { + "question": [ + { + "_attributes": { + "type": "COI" + }, + "answer": { + "_text": "No" + }, + "statement": {} + }, + { + "_attributes": { + "type": "DA" + }, + "answer": { + "_text": "No" + }, + "statement": { + "_text": "The asuthors for this paper did not provide a data availability statement" + } + }, + { + "_attributes": { + "type": "Fund" + }, + "answer": { + "_text": "Yes" + }, + "statement": {} + } + ] + } + } + } +} \ No newline at end of file diff --git a/packages/component-mts-package/tests/sampleWithReviewers.xml b/packages/component-mts-package/tests/sampleWithReviewers.xml index 2288c299c..9a7c38c5d 100644 --- a/packages/component-mts-package/tests/sampleWithReviewers.xml +++ b/packages/component-mts-package/tests/sampleWithReviewers.xml @@ -45,15 +45,12 @@ <year>2018</year> </date> </history> - <abstract>Abstract -This mini review gives a report of the progresses in the use of iron compounds as biological agents. Review entails coordination of ligands in form of pharmaceutical drugs, reagents used directly as supplied, synthesized organic compounds and natural products from plants to iron(II) or iron(III) ions to yield compounds which were applied as antibacterial, iron natural product, antioxidant and anticancer agents. In addition, in the aspect of material chemistry, holistic application of iron nanoparticles was assessed in relation to health. Iron nanoparticles are best approaches to apply as biological agents when compared to bulk materials because of its affordable, biocompatibity, biodegradability, simple approach to synthesis, ease of modification and non-toxic nature. - -Keywords: history of iron; chemistry of iron, uses of iron compounds, iron nanoparticles; biological screening techniques -</abstract> + <abstract> + Abstract This mini review gives a report of the progresses in the use of iron compounds as biological agents. Review entails coordination of ligands in form of pharmaceutical drugs, reagents used directly as supplied, synthesized organic compounds and natural products from plants to iron(II) or iron(III) ions to yield compounds which were applied as antibacterial, iron natural product, antioxidant and anticancer agents. In addition, in the aspect of material chemistry, holistic application of iron nanoparticles was assessed in relation to health. Iron nanoparticles are best approaches to apply as biological agents when compared to bulk materials because of its affordable, biocompatibity, biodegradability, simple approach to synthesis, ease of modification and non-toxic nature. Keywords: history of iron; chemistry of iron, uses of iron compounds, iron nanoparticles; biological screening techniques + </abstract> <funding-group></funding-group> </article-meta> - - <rev-group> + <rev-group> <rev rev-type="reviewer"> <name> -- GitLab