NCBI C++ ToolKit
PubmedArticle.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: PubmedArticle.cpp 100709 2023-08-31 20:12:08Z lavr $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'efetch.dtd'.
35  */
36 
37  // standard includes
38 #include <ncbi_pch.hpp>
39 #include <codecvt>
40 #include <numeric>
41 #include <regex>
42 #include <unordered_map>
45 #include <objects/general/Date.hpp>
53 #include <util/unicode.hpp>
54 
55 
56 // generated includes
58 
59 // generated classes
60 
61 BEGIN_eutils_SCOPE // namespace eutils::
62 
66 
67 // destructor
69 {
70 }
71 
72 
74 
75 template <typename StringT>
76 void s_ToLower(StringT& str) {
77  static const auto& s_Facet = get_ctype_facet<typename StringT::value_type>(locale());
78  for (auto& cch : str) {
79  cch = s_Facet.tolower(cch);
80  }
81 }
82 
83 
84 template <typename StringT>
85 void s_ToUpper(StringT& str) {
86  static const auto& s_Facet = get_ctype_facet<typename StringT::value_type>(locale());
87  for (auto& cch : str) {
88  cch = s_Facet.toupper(cch);
89  }
90 }
91 
92 
93 static bool s_StringToInt(const string& str, int& i)
94 {
95  static const auto& s_Facet = get_ctype_facet<char>();
96  i = 0;
97  if (!all_of(str.begin(), str.end(), [](char cch) -> bool { return s_Facet.is(ctype_base::digit, cch); }))
98  return false;
99  size_t count;
100  i = stoi(str, &count, 10);
101  if (count != str.size())
102  return false;
103  return true;
104 }
105 
106 
107 static int s_TranslateMonth(const string& month_str)
108 {
109  typedef initializer_list<pair<int, const char*>> int_string_map;
110  static const int_string_map s_MonthTable = {
111  { 1, "Jan" }, { 1, "January" },
112  { 2, "Feb" }, { 2, "February" },
113  { 3, "Mar" }, { 3, "March" },
114  { 4, "Apr" }, { 4, "April" },
115  { 5, "May" }, { 5, "May" },
116  { 6, "Jun" }, { 6, "June" },
117  { 7, "Jul" }, { 7, "July" },
118  { 8, "Aug" }, { 8, "August" },
119  { 9, "Sep" }, { 9, "September" },
120  { 10, "Oct" }, { 10, "October" },
121  { 11, "Nov" }, { 11, "November" },
122  { 12, "Dec" }, { 12, "December" }
123  };
124 
125  if (month_str.empty()) return 0;
126  int ret = 0;
127  if (s_StringToInt(month_str, ret)) return ret;
128  auto p = find_if(s_MonthTable.begin(), s_MonthTable.end(),
129  [&month_str](const pair<int, const char*>& x) -> bool { return NStr::EqualNocase(month_str, x.second); });
130  return p == s_MonthTable.end() ? 0 : p->first;
131 }
132 
133 
134 template <class container_type, class check_type, class proc_type>
135 void s_ForeachToken(container_type& container, check_type f, proc_type proc)
136 {
137  auto first = begin(container);
138  while (first != end(container))
139  {
140  if (f(*first))
141  {
142  auto p = find_if_not(first + 1, end(container), f);
143  first = proc(first, p);
144  }
145  else
146  first = find_if(first + 1, end(container), f);
147  }
148 }
149 
150 
151 static string utf8_to_string(const string& str)
152 {
153  string utf8;
154  try {
156  }
157  catch (CStringException) {
158  utf8 = str;
159  }
160  return utf8::UTF8ToAsciiString(utf8.c_str(), nullptr, nullptr, nullptr);
161 }
162 
163 
164 template<class TE>
165 string s_Utf8TextListToString(const list<CRef<TE>>& text_list)
166 {
167  return utf8_to_string(s_TextListToString(text_list));
168 }
169 
170 
171 static string s_GetInitialsFromForeName(string fore_name)
172 {
173  s_ToUpper(fore_name);
174  vector<string> tokens;
175  s_ForeachToken(fore_name, [](char x)->bool { return !isspace(x); },
176  [&tokens](string::iterator p, string::iterator q) -> string::iterator {
177  string s(p, q);
178  if (!s.empty() && s != "D'" && s != "DE" && s != "DER" && s != "LA" && s != "IBN")
179  tokens.push_back(s);
180  return q;
181  });
182  if (tokens.size() >= 2) {
183  // PM-4068
184  // return tokens[0].substr(0,1) + tokens[1].substr(0,1);
185  return accumulate(tokens.begin(), tokens.end(), string(),
186  [](const string& x, const string& y) { return x + y.substr(0, 1); });
187  }
188  else if (tokens.size() == 1) {
189  auto p = find(tokens.front().begin(), tokens.front().end(), '-');
190  if (p != tokens.front().end() && p + 1 != tokens.front().end())
191  return tokens.front().substr(0, 1) + string(1, p[1]);
192  else
193  return tokens.front().substr(0, 1);
194  }
195  return "";
196 }
197 
198 
200  int _year = 0;
201  int _month = 0;
202  int _day = 0;
203 };
204 
205 
206 static pubmed_date_t s_GetPubmedDate(const CPubDate& pub_date)
207 {
208  pubmed_date_t pubmed_date;
209  static const auto& s_Facet = get_ctype_facet<char>();
210  try {
211  if (pub_date.IsYM()) {
212  auto& ym = pub_date.GetYM();
213  pubmed_date._year = NStr::StringToNumeric<int>(ym.GetYear().Get());
214  if (ym.IsSetMS()) {
215  if (ym.GetMS().IsMD()) {
216  auto& md = ym.GetMS().GetMD();
217  pubmed_date._month = s_TranslateMonth(md.GetMonth());
218  if (pubmed_date._month >= 1 && pubmed_date._month <= 12 && md.IsSetDay()) {
219  pubmed_date._day = NStr::StringToNumeric<int>(md.GetDay().Get());
220  }
221  }
222  else if (ym.GetMS().IsSeason()) {
223  auto& season = ym.GetMS().GetSeason().Get();
224  auto pos = season.find('-');
225  if (pos != NPOS) {
226  pubmed_date._month = s_TranslateMonth(season.substr(0, pos));
227  }
228  else {
229  if (NStr::EqualNocase(season, "Winter")) {
230  pubmed_date._month = 12; // Dec
231  }
232  else if (NStr::EqualNocase(season, "Spring")) {
233  pubmed_date._month = 3; // Mar
234  }
235  else if (NStr::EqualNocase(season, "Summer")) {
236  pubmed_date._month = 6; // Jun
237  }
238  else if (NStr::EqualNocase(season, "Autumn")) {
239  pubmed_date._month = 9; // Jul
240  }
241  }
242  }
243  }
244  }
245  else if (pub_date.IsMedlineDate()) {
246  string medline_date = pub_date.GetMedlineDate();
247  s_ForeachToken(medline_date, [](char cch) -> bool { return s_Facet.is(ctype_base::alnum, cch); },
248  [&pubmed_date](string::iterator p, string::iterator q) -> string::iterator {
249  string str(p, q);
250  int num = 0;
251  if (s_StringToInt(str, num)) {
252  if (pubmed_date._year == 0 && num >= 1800 && num <= 2100)
253  pubmed_date._year = num;
254  else if (pubmed_date._month == 0 && num >= 1 && num <= 12)
255  pubmed_date._month = num;
256  else if (pubmed_date._month != 0 && pubmed_date._day == 0 && num >= 1 && num <= 31)
257  pubmed_date._day = num;
258  }
259  else if (pubmed_date._month == 0) {
260  pubmed_date._month = s_TranslateMonth(str);
261  }
262  return q;
263  });
264  }
265  }
266  catch (...) {
267  }
268  return pubmed_date;
269 }
270 
271 
273 {
274  CRef<CDate> date(new CDate());
275  try {
276  // Try integer values
277  CDate_std& std_date = date->SetStd();
278  std_date.SetYear(NStr::StringToNumeric<CDate_std::TYear>(adate.GetYear().Get()));
279  std_date.SetMonth(NStr::StringToNumeric<CDate_std::TMonth>(adate.GetMonth().Get()));
280  std_date.SetDay(NStr::StringToNumeric<CDate_std::TDay>(adate.GetDay().Get()));
281  }
282  catch (...) {
283  // Use string values
284  string str_date = adate.GetYear();
285  if (!adate.GetMonth().Get().empty()) str_date += " " + adate.GetMonth();
286  if (!adate.GetDay().Get().empty()) str_date += " " + adate.GetDay();
287  date->SetStr(str_date);
288  }
289  return date;
290 }
291 
292 
293 static CRef<CTitle> s_GetJournalTitle(const CPubmedArticle& pubmed_article)
294 {
295  const CMedlineCitation& medlineCitation = pubmed_article.GetMedlineCitation();
296  const CJournal& journal = medlineCitation.GetArticle().GetJournal();
297  CRef<CTitle> title(new CTitle());
298 
299  if (journal.IsSetISOAbbreviation()) {
300  CRef<CTitle::C_E> iso(new CTitle::C_E());
301  iso->SetIso_jta(journal.GetISOAbbreviation());
302  title->Set().push_back(iso);
303  }
304 
305  CRef<CTitle::C_E> mljta(new CTitle::C_E());
306  mljta->SetMl_jta(medlineCitation.GetMedlineJournalInfo().GetMedlineTA());
307  title->Set().push_back(mljta);
308 
309  if (journal.IsSetISSN()) {
310  CRef<CTitle::C_E> issn(new CTitle::C_E());
311  issn->SetIssn(journal.GetISSN());
312  title->Set().push_back(issn);
313  }
314 
315  if (journal.IsSetTitle()) {
316  CRef<CTitle::C_E> name(new CTitle::C_E());
317  name->SetName(journal.GetTitle());
318  title->Set().push_back(name);
319  }
320 
321  return title;
322 }
323 
324 
326  CRef<CImprint>& imprint,
327  const CCommentsCorrectionsList& comments_corrections,
329  const string& ref_type)
330 {
331  for (auto ref : comments_corrections.GetCommentsCorrections()) {
332  string attr_ref_type = CCommentsCorrections::C_Attlist::GetTypeInfo_enum_EAttlist_RefType()->
333  FindName(ref->GetAttlist().GetRefType(), false);
334  if (attr_ref_type == ref_type) {
335  CRef<CCitRetract> citretract(new CCitRetract);
336  string temp = utf8_to_string(ref->GetRefSource());
337  if (ref->IsSetNote()) temp += ". " + utf8_to_string(ref->GetNote());
338  if (ref->IsSetPMID()) temp += ". PMID: " + ref->GetPMID();
339  citretract->SetType(type);
340  citretract->SetExp(temp);
341  imprint->SetRetract(*citretract);
342  return true;
343  }
344  }
345  return false;
346 }
347 
348 
349 static int s_GetPublicationStatusId(const string& publication_status)
350 {
351  static const unordered_map<string, int> s_PubStatusId {
352  { "received", ePubStatus_received },
353  { "accepted", ePubStatus_accepted },
354  { "epublish", ePubStatus_epublish },
355  { "ppublish", ePubStatus_ppublish },
356  { "revised", ePubStatus_revised },
357  { "pmc", ePubStatus_pmc },
358  { "pmcr", ePubStatus_pmcr },
359  { "pubmed", ePubStatus_pubmed },
360  { "pubmedr", ePubStatus_pubmedr },
361  { "aheadofprint", ePubStatus_aheadofprint },
362  { "premedline", ePubStatus_premedline },
363  { "medline", ePubStatus_medline },
364  };
365  auto p = s_PubStatusId.find(publication_status);
366  return p == s_PubStatusId.end() ? ePubStatus_other : p->second;
367 }
368 
369 
370 static CRef<CImprint> s_GetImprint(const CPubmedArticle& pubmed_article)
371 {
372  CRef<CImprint> imprint(new CImprint());
373 
374  const CMedlineCitation& medline_citation = pubmed_article.GetMedlineCitation();
375  const CPubmedData& pubmed_data = pubmed_article.GetPubmedData();
376  const CArticle& article = medline_citation.GetArticle();
377  const CJournal& journal = article.GetJournal();
378  const CJournalIssue& jissue = journal.GetJournalIssue();
379 
380  // Pub date
381  string pub_model = CArticle::C_Attlist::GetTypeInfo_enum_EAttlist_PubModel()->
382  FindName(article.GetAttlist().GetPubModel(), false);
383  if (pub_model == "Electronic-Print" || pub_model == "Electronic-eCollection") {
384  for (auto d : article.GetArticleDate()) {
385  if (d->GetAttlist().IsSetDateType() && d->GetAttlist().GetDateType() == CArticleDate::C_Attlist::eAttlist_DateType_Electronic) {
386  imprint->SetDate(*s_GetDateFromArticleDate(*d));
387  break;
388  }
389  }
390  }
391  else {
392  imprint->SetDate(*s_GetDateFromPubDate(jissue.GetPubDate()));
393  }
394 
395  string volume = jissue.IsSetVolume() ? jissue.GetVolume().Get() : "";
396  if (!volume.empty()) imprint->SetVolume(volume);
397 
398  string issue = jissue.IsSetIssue() ? jissue.GetIssue().Get() : "";
399  if (!issue.empty()) imprint->SetIssue(issue);
400 
401  string pages = article.GetPE_2().IsPE() ? s_GetPagination(article.GetPE_2().GetPE().GetPagination()) : "";
402  if (!pages.empty()) imprint->SetPages(pages);
403 
404  auto list_language = medline_citation.GetArticle().GetLanguage();
405  string languages;
406  if (!list_language.empty())
407  languages = accumulate(next(list_language.begin()), list_language.end(), list_language.front()->Get(),
408  [](const auto& s, const auto& e) -> string { return s + "," + e->Get(); });
409  imprint->SetLanguage(languages);
410 
411  if (medline_citation.IsSetCommentsCorrectionsList()) {
412  s_SetCommentCorrection(imprint, medline_citation.GetCommentsCorrectionsList(), CCitRetract::eType_retracted, "RetractionIn")
413  || s_SetCommentCorrection(imprint, medline_citation.GetCommentsCorrectionsList(), CCitRetract::eType_in_error, "ErratumIn")
414  || s_SetCommentCorrection(imprint, medline_citation.GetCommentsCorrectionsList(), CCitRetract::eType_erratum, "ErratumFor")
415  || s_SetCommentCorrection(imprint, medline_citation.GetCommentsCorrectionsList(), CCitRetract::eType_notice, "RetractionOf");
416  }
417 
418  // PubStatus
420 
421  // History
422  if (pubmed_data.IsSetHistory())
423  {
425  for (auto pub_date : pubmed_data.GetHistory().GetPubMedPubDate()) {
426  CRef<CPubStatusDate> pub_stat_date(new CPubStatusDate());
427  string pub_status = CPubMedPubDate::C_Attlist::GetTypeInfo_enum_EAttlist_PubStatus()->
428  FindName(pub_date->GetAttlist().GetPubStatus(), false);
429  pub_stat_date->SetPubstatus(s_GetPublicationStatusId(pub_status));
430  pub_stat_date->SetDate(*s_GetDateFromPubMedPubDate(*pub_date));
431  date_set->Set().push_back(pub_stat_date);
432  }
433  imprint->SetHistory(*date_set);
434  }
435 
436  return imprint;
437 }
438 
439 
441 {
442  CRef<CCit_jour> cit_journal(new CCit_jour());
443  cit_journal->SetTitle(*s_GetJournalTitle(pubmed_article));
444  cit_journal->SetImp(*s_GetImprint(pubmed_article));
445  return cit_journal;
446 }
447 
448 
449 inline bool s_IsValidYN(const CAuthor& auth)
450 {
451  return auth.GetAttlist().IsSetValidYN() &&
453 }
454 
455 
457 {
458  CRef<CAuth_list> author_list;
459  if (!article.IsSetAuthorList()) return author_list;
460  auto& list_author = article.GetAuthorList().GetAuthor();
461  bool has_authors = any_of(list_author.begin(), list_author.end(),
462  [](const CRef<CAuthor>& auth)->bool { return s_IsValidYN(*auth); });
463  if (has_authors) {
464  bool std_format = any_of(list_author.begin(), list_author.end(), [](const CRef<CAuthor>& auth)->bool {
465  return s_IsValidYN(*auth) && (auth->GetLC().IsCollectiveName() ||
466  (auth->IsSetAffiliationInfo() && !auth->GetAffiliationInfo().empty())); });
467  author_list.Reset(new CAuth_list());
469  for (auto author : list_author) {
470  if (s_IsValidYN(*author)) {
471  if (std_format) {
472  CRef<CPerson_id> person(new CPerson_id());
473  if (author->GetLC().IsCollectiveName()) {
474  person->SetConsortium(s_Utf8TextListToString(author->GetLC().GetCollectiveName().Get()));
475  }
476  else {
477  person->SetMl(utf8_to_string(s_GetAuthorMedlineName(*author)));
478  }
479  CRef<objects::CAuthor> auth(new objects::CAuthor());
480  auth->SetName(*person);
481  auto& list_affiliation_info = author->GetAffiliationInfo();
482  if (!list_affiliation_info.empty()) {
483  list<string> affiliations;
484  for (auto affiliation_info : list_affiliation_info) {
485  string affiliation = s_Utf8TextListToString(affiliation_info->GetAffiliation().Get());
486  if (!affiliation.empty()) affiliations.emplace_back(std::move(affiliation));
487  }
488  if (!affiliations.empty()) {
489  CRef<CAffil> affil(new CAffil());
490  affil->SetStr(accumulate(next(affiliations.begin()), affiliations.end(), affiliations.front(),
491  [](const string& s1, const string& s2)->string { return s1 + "; " + s2; }));
492  auth->SetAffil(*affil);
493  }
494  }
495  auth_names->SetStd().push_back(auth);
496  }
497  else {
498  auth_names->SetMl().push_back(utf8_to_string(s_GetAuthorMedlineName(*author)));
499  }
500  }
501  }
502  if (!article.GetAuthorList().GetAttlist().IsSetCompleteYN() ||
504  if (std_format) {
505  CRef<CPerson_id> person(new CPerson_id());
506  person->SetMl("et al");
507  CRef<objects::CAuthor> auth(new objects::CAuthor());
508  auth->SetName(*person);
509  auth_names->SetStd().push_back(auth);
510  }
511  else {
512  auth_names->SetMl().push_back("et al");
513  }
514  }
515  author_list->SetNames(*auth_names);
516  }
517  return author_list;
518 }
519 
520 
521 static objects::CArticleId::E_Choice s_GetArticleIdTypeId(const CArticleId& article_id)
522 {
523  static const unordered_map<CArticleId::C_Attlist::EAttlist_IdType, objects::CArticleId::E_Choice> s_ArticleIdTypeId = {
524  { CArticleId::C_Attlist::eAttlist_IdType_pubmed, objects::CArticleId::e_Pubmed },
525  { CArticleId::C_Attlist::eAttlist_IdType_medline, objects::CArticleId::e_Medline },
526  { CArticleId::C_Attlist::eAttlist_IdType_doi, objects::CArticleId::e_Doi },
527  { CArticleId::C_Attlist::eAttlist_IdType_pii, objects::CArticleId::e_Pii },
528  { CArticleId::C_Attlist::eAttlist_IdType_pmcid, objects::CArticleId::e_Pmcid },
529  { CArticleId::C_Attlist::eAttlist_IdType_pmcpid, objects::CArticleId::e_Pmcpid },
530  { CArticleId::C_Attlist::eAttlist_IdType_pmpid, objects::CArticleId::e_Pmpid },
531  };
532  if (!article_id.GetAttlist().IsSetIdType()) return objects::CArticleId::e_not_set;
533  auto id_type = article_id.GetAttlist().GetIdType();
534  auto p = s_ArticleIdTypeId.find(id_type);
535  return p != s_ArticleIdTypeId.end() ? p->second : objects::CArticleId::e_Other;
536 }
537 
538 
539 static CRef<CCit_art> s_GetCitation(const CPubmedArticle& pubmed_article)
540 {
541  auto& medline_citation = pubmed_article.GetMedlineCitation();
542  CRef<CCit_art> cit_article(new CCit_art());
543  CRef<CTitle> title = s_GetTitle(medline_citation.GetArticle());
544  if (title) cit_article->SetTitle(*title);
545  auto author_list = s_GetAuthorList(medline_citation.GetArticle());
546  if (author_list) cit_article->SetAuthors(*author_list);
548  from->SetJournal(*s_GetJournalCitation(pubmed_article));
549  cit_article->SetFrom(*from);
550  cit_article->SetIds(*s_GetArticleIdSet(
551  pubmed_article.GetPubmedData().GetArticleIdList(),
552  &pubmed_article.GetMedlineCitation().GetArticle()));
553  return cit_article;
554 }
555 
556 
557 static void s_FillMesh(CMedline_entry::TMesh& mesh, const CMeshHeadingList& mesh_heading_list)
558 {
559  for (auto mesh_heading_it : mesh_heading_list.GetMeshHeading()) {
560  CRef<CMedline_mesh> medline_mesh(new CMedline_mesh());
561  auto& desc_name = mesh_heading_it->GetDescriptorName();
562  if (desc_name.GetAttlist().IsSetMajorTopicYN() &&
563  desc_name.GetAttlist().GetMajorTopicYN() == CDescriptorName::C_Attlist::eAttlist_MajorTopicYN_Y)
564  medline_mesh->SetMp(true);
565  medline_mesh->SetTerm(desc_name.GetDescriptorName());
566  for (auto qualifier_name_it : mesh_heading_it->GetQualifierName()) {
568  if (qualifier_name_it->GetAttlist().IsSetMajorTopicYN() &&
569  qualifier_name_it->GetAttlist().GetMajorTopicYN() == CQualifierName::C_Attlist::eAttlist_MajorTopicYN_Y)
570  qual->SetMp(true);
571  qual->SetSubh(qualifier_name_it->GetQualifierName());
572  medline_mesh->SetQual().push_back(qual);
573  }
574  mesh.push_back(medline_mesh);
575  }
576 }
577 
578 
579 static void s_FillChem(CMedline_entry::TSubstance& chems, const CChemicalList& chemical_list)
580 {
581  for (auto chemical_it : chemical_list.GetChemical()) {
582  CRef<CMedline_rn> chem(new CMedline_rn());
583  chem->SetName(chemical_it->GetNameOfSubstance());
584  // Registry number and type
585  string registry_number = chemical_it->GetRegistryNumber();
586  if (registry_number.empty() || registry_number == "0")
587  chem->SetType(chem->eType_nameonly);
588  else if (registry_number.size() > 2 && toupper(registry_number[0]) == 'E' && toupper(registry_number[1]) == 'C') {
589  chem->SetCit(registry_number.c_str() + 2 + strspn(registry_number.c_str() + 2, " "));
590  chem->SetType(chem->eType_ec);
591  }
592  else {
593  chem->SetCit(registry_number);
594  chem->SetType(chem->eType_cas);
595  }
596  chems.push_back(chem);
597  }
598 }
599 
600 
601 static int s_GetDatabankTypeId(const string& databank_name)
602 {
603  static const unordered_map<string, int> s_DatabankTypeId {
604  { "ddbj", CMedline_si::eType_ddbj },
605  { "carbbank", CMedline_si::eType_carbbank },
606  { "embl", CMedline_si::eType_embl },
607  { "hdb", CMedline_si::eType_hdb },
608  { "genbank", CMedline_si::eType_genbank },
609  { "hgml", CMedline_si::eType_hgml },
610  { "mim", CMedline_si::eType_mim },
611  { "msd", CMedline_si::eType_msd },
612  { "pdb", CMedline_si::eType_pdb },
613  { "pir", CMedline_si::eType_pir },
614  { "prfseqdb", CMedline_si::eType_prfseqdb },
615  { "psd", CMedline_si::eType_psd },
616  { "swissprot", CMedline_si::eType_swissprot },
617  { "gdb", CMedline_si::eType_gdb },
618  };
619  auto p = s_DatabankTypeId.find(databank_name);
620  return p == s_DatabankTypeId.end() ? -1 : p->second;
621 }
622 
623 
624 static void s_FillXref(CMedline_entry::TXref& refs, const CDataBankList& databank_list)
625 {
626  for (auto databank_it : databank_list.GetDataBank()) {
627  string databank_name = databank_it->GetDataBankName();
628  s_ToLower(databank_name);
629  int type_id = s_GetDatabankTypeId(databank_name);
630  if (type_id >= 0) {
631  if (databank_it->IsSetAccessionNumberList()) {
632  for (auto& accession_number_it : databank_it->GetAccessionNumberList().GetAccessionNumber()) {
634  si->SetType((CMedline_si::EType)type_id);
635  si->SetCit(accession_number_it->Get());
636  refs.push_back(si);
637  }
638  }
639  else {
641  si->SetType((CMedline_si::EType)type_id);
642  refs.push_back(si);
643  }
644  }
645  }
646 }
647 
648 
649 static void s_FillGenes(CMedline_entry::TGene& mgenes, const CGeneSymbolList& gene_symbol_list)
650 {
651  for (auto& gene_symbol_it : gene_symbol_list.GetGeneSymbol()) {
652  mgenes.push_back(gene_symbol_it->Get());
653  }
654 }
655 
656 
657 static void s_FillPubtypeList(
658  CMedline_entry::TPub_type& pub_types,
659  const CPublicationTypeList& publication_type_list)
660 {
661  for (auto publication_type_it : publication_type_list.GetPublicationType()) {
662  pub_types.push_back(publication_type_it->GetPublicationType());
663  }
664 }
665 
666 
668  const list<CRef<CPubMedPubDate>>& pubmed_pubdates,
670 {
671  for (auto pub_date : pubmed_pubdates) {
672  if (pub_date->GetAttlist().GetPubStatus() == status) {
673  return pub_date;
674  }
675  }
676  return CRef<CPubMedPubDate>();
677 }
678 
679 
680 static string s_GetAbstractText(const CAbstract& abstr)
681 {
682  string abstract_text;
683  for (auto abstract_text_it : abstr.GetAbstractText())
684  {
685  string label = abstract_text_it->GetAttlist().IsSetLabel() ?
686  abstract_text_it->GetAttlist().GetLabel() + ": " : "";
687  if (!abstract_text.empty()) abstract_text.append(" ");
688  abstract_text.append(label + s_TextListToString(abstract_text_it->GetAbstractText()));
689  }
690  return abstract_text;
691 }
692 
693 
695 {
696  CRef<CMedline_entry> medline_entry(new CMedline_entry());
698  pubmed_article.GetPubmedData().GetHistory().GetPubMedPubDate(),
700  if (!entrez_date) {
701  entrez_date = s_FindPubDateStatus(
702  pubmed_article.GetPubmedData().GetHistory().GetPubMedPubDate(),
704  }
705  if (entrez_date)
706  medline_entry->SetEm(*s_GetDateFromPubMedPubDate(*entrez_date));
707  medline_entry->SetCit(*s_GetCitation(pubmed_article));
708 
709  auto& cit = pubmed_article.GetMedlineCitation();
710  if (cit.GetArticle().IsSetAbstract())
711  medline_entry->SetAbstract(s_CleanupText(s_GetAbstractText(cit.GetArticle().GetAbstract())));
712  if (cit.IsSetMeshHeadingList())
713  s_FillMesh(medline_entry->SetMesh(), cit.GetMeshHeadingList());
714  if (cit.IsSetChemicalList())
715  s_FillChem(medline_entry->SetSubstance(), cit.GetChemicalList());
716  if (cit.GetArticle().IsSetDataBankList())
717  s_FillXref(medline_entry->SetXref(), cit.GetArticle().GetDataBankList());
718  if (cit.GetArticle().IsSetGrantList())
719  s_FillGrants(medline_entry->SetIdnum(), cit.GetArticle().GetGrantList());
720  if (cit.IsSetGeneSymbolList())
721  s_FillGenes(medline_entry->SetGene(), cit.GetGeneSymbolList());
722  medline_entry->SetPmid(CPubMedId(NStr::StringToNumeric<TEntrezId>(cit.GetPMID().GetPMID(), NStr::fConvErr_NoThrow)));
723  s_FillPubtypeList(medline_entry->SetPub_type(), cit.GetArticle().GetPublicationTypeList());
724 
725  CMedlineCitation::C_Attlist::TStatus status = cit.GetAttlist().GetStatus();
727  medline_entry->SetStatus(medline_entry->eStatus_publisher);
731  medline_entry->SetStatus(medline_entry->eStatus_medline);
732  else
733  medline_entry->SetStatus(medline_entry->eStatus_premedline);
734  return medline_entry;
735 };
736 
738 
739 
740 string s_CleanupText(string str)
741 {
743  for (char& cch : str) {
744  if (cch == '\r' || cch == '\n' || cch == '\t')
745  cch = ' ';
746  }
747  return str;
748 }
749 
750 
752 {
753  static const char* s_SeasonTab[] = { "Winter", "Spring", "Summer", "Autumn" };
754  pubmed_date_t pm_pub_date = s_GetPubmedDate(pub_date);
755  CRef<CDate> date(new CDate());
756  CDate_std& date_std = date->SetStd();
757  date_std.SetYear(pm_pub_date._year);
758  if (pm_pub_date._month != 0) {
759  if (pm_pub_date._month < 13) {
760  date_std.SetMonth(pm_pub_date._month);
761  if (pm_pub_date._day != 0)
762  date_std.SetDay(pm_pub_date._day);
763  }
764  else {
765  date_std.SetSeason(s_SeasonTab[pm_pub_date._month - 13]);
766  }
767  }
768  return date;
769 }
770 
771 
773 {
774  CRef<CDate> date(new CDate());
775  try {
776  // Try integer values
777  CDate_std& std_date = date->SetStd();
778  std_date.SetYear(NStr::StringToNumeric<CDate_std::TYear>(pdate.GetYear().Get()));
779  std_date.SetMonth(NStr::StringToNumeric<CDate_std::TMonth>(pdate.GetMonth().Get()));
780  std_date.SetDay(NStr::StringToNumeric<CDate_std::TDay>(pdate.GetDay().Get()));
781  if (pdate.IsSetHM()) {
782  try {
783  // Try integer time, ignore on error
784  auto& hm = pdate.GetHM();
785  std_date.SetHour(NStr::StringToNumeric<CDate_std::THour>(hm.GetHour().Get()));
786  if (hm.IsSetMS()) {
787  auto& ms = hm.GetMS();
788  std_date.SetMinute(NStr::StringToNumeric<CDate_std::TMinute>(ms.GetMinute().Get()));
789  if (ms.IsSetSecond()) {
790  std_date.SetSecond(NStr::StringToNumeric<CDate_std::TSecond>(ms.GetSecond().Get()));
791  }
792  }
793  }
794  catch (...) {}
795  }
796  }
797  catch (...) {
798  // Use string values
799  string str_date = pdate.GetYear();
800  if (!pdate.GetMonth().Get().empty()) str_date += " " + pdate.GetMonth();
801  if (!pdate.GetDay().Get().empty()) str_date += " " + pdate.GetDay();
802  date->SetStr(str_date);
803  }
804  return date;
805 }
806 
807 
808 string s_GetArticleTitleStr(const CArticleTitle& article_title)
809 {
810  return article_title.IsSetArticleTitle() ?
811  s_Utf8TextListToString(article_title.GetArticleTitle()) : "";
812 }
813 
814 
815 string s_GetVernacularTitleStr(const CVernacularTitle& vernacular_title)
816 {
817  return s_Utf8TextListToString(vernacular_title.Get());
818 }
819 
820 
821 CRef<CTitle> s_MakeTitle(const string& title_str, const string& vernacular_title_str)
822 {
823  CRef<CTitle> title;
824  if (!title_str.empty() || !vernacular_title_str.empty()) {
825  title.Reset(new CTitle());
826  if (!title_str.empty()) {
827  CRef<CTitle::C_E> name(new CTitle::C_E());
828  name->SetName(title_str);
829  title->Set().push_back(name);
830  }
831  if (!vernacular_title_str.empty()) {
832  CRef<CTitle::C_E> name(new CTitle::C_E());
833  name->SetTrans(vernacular_title_str);
834  title->Set().push_back(name);
835  }
836  }
837  return title;
838 }
839 
840 
841 string s_GetAuthorMedlineName(const CAuthor& author)
842 {
843  string author_medline_name;
844  if (author.GetLC().IsCollectiveName()) {
845  author_medline_name = s_Utf8TextListToString(author.GetLC().GetCollectiveName().Get());
846  if (!author_medline_name.empty() && author_medline_name.back() != '.')
847  author_medline_name.append(".");
848  }
849  else if (author.GetLC().IsLFIS()) {
850  // Personal name;
851  auto& lfis = author.GetLC().GetLFIS();
852  author_medline_name = utf8_to_string(lfis.GetLastName());
853  // Initials
854  string initials;
855  if (lfis.IsSetInitials())
856  initials = utf8_to_string(lfis.GetInitials());
857  else if (lfis.IsSetForeName())
858  initials = s_GetInitialsFromForeName(utf8_to_string(lfis.GetForeName()));
859  if (!initials.empty())
860  author_medline_name.append(" " + initials);
861  if (lfis.IsSetSuffix())
862  author_medline_name.append(" " + s_Utf8TextListToString(lfis.GetSuffix().Get()));
863  }
864  return author_medline_name;
865 }
866 
867 
868 string s_GetPagination(const CPagination& pagination)
869 {
870  string pages;
871  if (pagination.IsSEM()) {
872  auto& sem = pagination.GetSEM();
873  if (sem.IsSetMedlinePgn()) {
874  pages = sem.GetMedlinePgn();
875  }
876  else {
877  if (sem.IsSetStartPage()) {
878  if (sem.IsSetEndPage()) return sem.GetStartPage() + "-" + sem.GetEndPage();
879  else return sem.GetStartPage();
880  }
881  if (sem.IsSetEndPage()) return "-" + sem.GetEndPage();
882  return "";
883  }
884  }
885 
886  if (pages.empty() && pagination.IsMedlinePgn()) pages = pagination.GetMedlinePgn();
887  if (pages.empty()) return "";
888  pages = utf8_to_string(pages);
889  list<string> parts;
890  s_ForeachToken(pages, [](char cch) -> bool { return cch != ','; },
891  [&parts](string::iterator p, string::iterator q)->string::iterator {
892  string x(p, q);
893  x = regex_replace(x, regex("\\s+"), "");
894  if (!x.empty()) {
895  regex r("^(.*?)-(.*)$");
896  smatch ma;
897  regex_search(x, ma, r);
898  if (ma.empty() || ma.str(1).length() <= ma.str(2).length())
899  parts.push_back(x);
900  else
901  parts.push_back(ma.str(1) + "-" + ma.str(1).substr(0, ma.str(1).length() - ma.str(2).length()) + ma.str(2));
902  }
903  return q;
904  });
905  return parts.empty() ? "" : accumulate(next(parts.begin()), parts.end(), parts.front(),
906  [](const string& s1, const string& s2)->string { return s1 + ',' + s2; });
907 }
908 
909 
910 CRef<CArticleIdSet> s_GetArticleIdSet(const CArticleIdList& article_id_list, const CArticle* article)
911 {
912  CRef<CArticleIdSet> id_set(new CArticleIdSet());
913  for (auto article_id_it : article_id_list.GetArticleId()) {
914  CRef<objects::CArticleId> id(new objects::CArticleId());
915  try {
916  const string& str_id = article_id_it->GetArticleId();
917  switch (s_GetArticleIdTypeId(*article_id_it)) {
918  case objects::CArticleId::e_Pubmed:
919  id->SetPubmed(CPubMedId(NStr::StringToNumeric<TEntrezId>(str_id)));
920  break;
921  case objects::CArticleId::e_Medline:
922  continue;
923  case objects::CArticleId::e_Doi:
924  id->SetDoi(CDOI(str_id));
925  break;
926  case objects::CArticleId::e_Pii:
927  id->SetPii(CPII(str_id));
928  break;
929  case objects::CArticleId::e_Pmcid:
930  id->SetPmcid(CPmcID(NStr::StringToNumeric<TEntrezId>(str_id)));
931  break;
932  case objects::CArticleId::e_Pmcpid:
933  id->SetPmcpid(CPmcPid(str_id));
934  break;
935  case objects::CArticleId::e_Pmpid:
936  id->SetPmpid(CPmPid(str_id));
937  break;
938  case objects::CArticleId::e_Other: {
939  string db = CArticleId::C_Attlist::GetTypeInfo_enum_EAttlist_IdType()->
940  FindName(article_id_it->GetAttlist().GetIdType(), false);
941  CRef<CDbtag> db_tag(new CDbtag());
942  db_tag->SetDb(db);
943  CRef<CObject_id> obj_id(new CObject_id());
944  obj_id->SetStr(str_id);
945  db_tag->SetTag(*obj_id);
946  id->SetOther(*db_tag);
947  break;
948  }
949  default:
950  continue;
951  }
952  id_set->Set().push_back(id);
953  }
954  catch (...) {}
955  }
956  if (article) {
957  // JIRA: PM-966
958  const list<CRef<CELocationID>>* eloc_ids = nullptr;
959  if (article->GetPE_2().IsELocationID()) {
960  eloc_ids = &article->GetPE_2().GetELocationID();
961  }
962  else {
963  if (article->GetPE_2().GetPE().IsSetELocationID()) eloc_ids = &article->GetPE_2().GetPE().GetELocationID();
964  }
965  if (eloc_ids) {
966  for (auto elocation_id_it : *eloc_ids) {
967  string str_eid_type = CELocationID::C_Attlist::GetTypeInfo_enum_EAttlist_EIdType()->
968  FindName(elocation_id_it->GetAttlist().GetEIdType(), false);
969  string type = "ELocationID " + str_eid_type;
970  string value = elocation_id_it->GetELocationID();
971  CRef<objects::CArticleId> id(new objects::CArticleId());
972  CRef<CDbtag> db_tag(new CDbtag());
973  db_tag->SetDb(type);
974  CRef<CObject_id> obj_id(new CObject_id());
975  obj_id->SetStr(value);
976  db_tag->SetTag(*obj_id);
977  id->SetOther(*db_tag);
978  id_set->Set().push_back(id);
979  }
980  }
981  }
982  return id_set;
983 }
984 
985 
986 void s_FillGrants(list<string>& id_nums, const CGrantList& grant_list)
987 {
988  for (auto grant_it : grant_list.GetGrant()) {
989  string id;
990  if (grant_it->IsSetGrantID())
991  id = utf8_to_string(grant_it->GetGrantID());
992  if (grant_it->IsSetAcronym())
993  id += id.empty() ? utf8_to_string(grant_it->GetAcronym()) : "/" + utf8_to_string(grant_it->GetAcronym());
994  if (grant_it->IsSetAgency() && !grant_it->GetAgency().Get().empty())
995  id += id.empty() ? utf8_to_string(grant_it->GetAgency()) : "/" + utf8_to_string(grant_it->GetAgency());
996  string id2 = utf8_to_string(id);
997  if (!id2.empty())
998  id_nums.push_back(id2);
999  }
1000 }
1001 
1002 
1004 {
1005  CRef<CPubmed_entry> pubmed_entry(new CPubmed_entry());
1006 
1007  pubmed_entry->SetPmid(CPubMedId(NStr::StringToNumeric<TEntrezId>(
1008  GetMedlineCitation().GetPMID().GetPMID(), NStr::fConvErr_NoThrow)));
1009  pubmed_entry->SetMedent(*s_GetMedlineEntry(*this));
1010  return pubmed_entry;
1011 }
1012 
1013 
1014 END_eutils_SCOPE // namespace eutils::
1015 
1016 /* Original file checksum: lines: 53, chars: 1696, CRC32: 3b4b74a1 */
#define BEGIN_eutils_SCOPE
Definition: Abstract_.hpp:51
#define END_eutils_SCOPE
Definition: Abstract_.hpp:52
string s_GetVernacularTitleStr(const CVernacularTitle &vernacular_title)
string s_GetArticleTitleStr(const CArticleTitle &article_title)
USING_SCOPE(objects)
static void s_FillPubtypeList(CMedline_entry::TPub_type &pub_types, const CPublicationTypeList &publication_type_list)
static CRef< CImprint > s_GetImprint(const CPubmedArticle &pubmed_article)
static objects::CArticleId::E_Choice s_GetArticleIdTypeId(const CArticleId &article_id)
void s_ForeachToken(container_type &container, check_type f, proc_type proc)
static string utf8_to_string(const string &str)
static int s_GetDatabankTypeId(const string &databank_name)
static bool s_SetCommentCorrection(CRef< CImprint > &imprint, const CCommentsCorrectionsList &comments_corrections, CCitRetract::EType type, const string &ref_type)
static void s_FillGenes(CMedline_entry::TGene &mgenes, const CGeneSymbolList &gene_symbol_list)
static string s_GetInitialsFromForeName(string fore_name)
BEGIN_LOCAL_NAMESPACE
static int s_GetPublicationStatusId(const string &publication_status)
static bool s_StringToInt(const string &str, int &i)
static CRef< CMedline_entry > s_GetMedlineEntry(const CPubmedArticle &pubmed_article)
bool s_IsValidYN(const CAuthor &auth)
static pubmed_date_t s_GetPubmedDate(const CPubDate &pub_date)
void s_FillGrants(list< string > &id_nums, const CGrantList &grant_list)
static int s_TranslateMonth(const string &month_str)
string s_GetAuthorMedlineName(const CAuthor &author)
static void s_FillChem(CMedline_entry::TSubstance &chems, const CChemicalList &chemical_list)
static CRef< CCit_jour > s_GetJournalCitation(const CPubmedArticle &pubmed_article)
END_LOCAL_NAMESPACE
string s_CleanupText(string str)
CRef< CDate > s_GetDateFromPubMedPubDate(const CPubMedPubDate &pdate)
static CRef< CDate > s_GetDateFromArticleDate(const CArticleDate &adate)
static CRef< CCit_art > s_GetCitation(const CPubmedArticle &pubmed_article)
static CRef< CPubMedPubDate > s_FindPubDateStatus(const list< CRef< CPubMedPubDate >> &pubmed_pubdates, CPubMedPubDate::C_Attlist::EAttlist_PubStatus status)
static CRef< CTitle > s_GetJournalTitle(const CPubmedArticle &pubmed_article)
static string s_GetAbstractText(const CAbstract &abstr)
string s_GetPagination(const CPagination &pagination)
CRef< CTitle > s_MakeTitle(const string &title_str, const string &vernacular_title_str)
CRef< CDate > s_GetDateFromPubDate(const CPubDate &pub_date)
CRef< CArticleIdSet > s_GetArticleIdSet(const CArticleIdList &article_id_list, const CArticle *article)
static CRef< CAuth_list > s_GetAuthorList(const CArticle &article)
USING_NCBI_SCOPE
static void s_FillXref(CMedline_entry::TXref &refs, const CDataBankList &databank_list)
string s_Utf8TextListToString(const list< CRef< TE >> &text_list)
static void s_FillMesh(CMedline_entry::TMesh &mesh, const CMeshHeadingList &mesh_heading_list)
void s_ToLower(StringT &str)
BEGIN_eutils_SCOPE NCBI_USING_NAMESPACE_STD
void s_ToUpper(StringT &str)
User-defined methods of the data storage class.
std::string s_TextListToString(const std::list< ncbi::CRef< TE >> &text_list)
ncbi::CRef< ncbi::objects::CTitle > s_GetTitle(const D &doc)
User-defined methods of the data storage class.
CAbstract –.
Definition: Abstract.hpp:64
@Affil.hpp User-defined methods of the data storage class.
Definition: Affil.hpp:56
CArticleDate –.
Definition: ArticleDate.hpp:64
CArticleIdList –.
CArticleIdSet –.
CArticleId –.
Definition: ArticleId.hpp:66
CArticleTitle –.
CArticle –.
Definition: Article.hpp:64
C_Names –.
Definition: Auth_list_.hpp:98
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
CAuthor –.
Definition: Author.hpp:59
CChemicalList –.
CCitRetract –.
Definition: CitRetract.hpp:66
journal or book
Definition: Cit_art_.hpp:98
CCommentsCorrectionsList –.
CDOI –.
Definition: DOI.hpp:66
CDataBankList –.
Definition: Date.hpp:53
Definition: Dbtag.hpp:53
CGeneSymbolList –.
CGrantList –.
Definition: GrantList.hpp:64
CImprint –.
Definition: Imprint.hpp:66
CJournalIssue –.
CJournal –.
Definition: Journal.hpp:64
CMedlineCitation –.
CMedline_mesh –.
CMedline_qual –.
CMedline_rn –.
Definition: Medline_rn.hpp:66
CMedline_si –.
Definition: Medline_si.hpp:66
CMeshHeadingList –.
CPII –.
Definition: PII.hpp:66
CPagination –.
Definition: Pagination.hpp:64
CPmPid –.
Definition: PmPid.hpp:66
Definition: PmcID.hpp:54
CPmcPid –.
Definition: PmcPid.hpp:66
CPubDate –.
Definition: PubDate.hpp:64
CPubMedPubDate –.
CPubStatusDateSet –.
CPubStatusDate –.
CPublicationTypeList –.
ncbi::CRef< ncbi::objects::CPubmed_entry > ToPubmed_entry(void) const
CPubmedData –.
Definition: PubmedData.hpp:64
CPubmed_entry –.
CRef –.
Definition: ncbiobj.hpp:618
CStringException –.
Definition: ncbistr.hpp:4505
C_E –.
Definition: Title_.hpp:96
Definition: Title.hpp:51
CVernacularTitle –.
#define md
Definition: compat-1.3.h:2001
char value[7]
Definition: config.c:431
static const char si[8][64]
Definition: des.c:146
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:56
string
Definition: cgiapp.hpp:687
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define NPOS
Definition: ncbistr.hpp:133
static EEncoding GuessEncoding(const CTempString &src)
Guess the encoding of the C/C++ string.
Definition: ncbistr.cpp:6687
static CStringUTF8 AsUTF8(const CTempString &src, EEncoding encoding, EValidate validate=eNoValidate)
Convert into UTF8 from a C/C++ string.
Definition: ncbistr.hpp:3888
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5352
@ fConvErr_NoThrow
Do not throw an exception on error.
Definition: ncbistr.hpp:285
static const char label[]
void SetPages(const TPages &value)
Assign a value to Pages data member.
Definition: Imprint_.hpp:861
void SetIds(TIds &value)
Assign a value to Ids data member.
Definition: Cit_art_.cpp:258
void SetTitle(TTitle &value)
Assign a value to Title data member.
Definition: Cit_art_.cpp:210
void SetRetract(TRetract &value)
Assign a value to Retract data member.
Definition: Imprint_.cpp:153
void SetIssue(const TIssue &value)
Assign a value to Issue data member.
Definition: Imprint_.hpp:814
void SetFrom(TFrom &value)
Assign a value to From data member.
Definition: Cit_art_.cpp:248
void SetLanguage(const TLanguage &value)
Assign a value to Language data member.
Definition: Imprint_.hpp:1054
void SetType(TType value)
Assign a value to Type data member.
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_art_.cpp:227
TStr & SetStr(void)
Select the variant.
Definition: Affil_.hpp:1200
void SetVolume(const TVolume &value)
Assign a value to Volume data member.
Definition: Imprint_.hpp:767
void SetNames(TNames &value)
Assign a value to Names data member.
Definition: Auth_list_.cpp:149
void SetDate(TDate &value)
Assign a value to Date data member.
Definition: Imprint_.cpp:73
Tdata & Set(void)
Assign a value to data member.
void SetHistory(THistory &value)
Assign a value to History data member.
Definition: Imprint_.cpp:170
void SetPubstatus(TPubstatus value)
Assign a value to Pubstatus data member.
Definition: Imprint_.hpp:1223
Tdata & Set(void)
Assign a value to data member.
EType
retraction of an entry
Definition: CitRetract_.hpp:85
void SetExp(const TExp &value)
Assign a value to Exp data member.
Tdata & Set(void)
Assign a value to data member.
Definition: Title_.hpp:787
@ ePubStatus_pubmed
article citation first appeared in PubMed
Definition: PubStatus_.hpp:73
@ ePubStatus_accepted
accepted for publication
Definition: PubStatus_.hpp:67
@ ePubStatus_ppublish
published in print by publisher
Definition: PubStatus_.hpp:69
@ ePubStatus_premedline
date into PreMedline status
Definition: PubStatus_.hpp:76
@ ePubStatus_revised
article revised by publisher/author
Definition: PubStatus_.hpp:70
@ ePubStatus_received
date manuscript received for review
Definition: PubStatus_.hpp:66
@ ePubStatus_other
Definition: PubStatus_.hpp:78
@ ePubStatus_pubmedr
article citation revision in PubMed
Definition: PubStatus_.hpp:74
@ ePubStatus_aheadofprint
epublish, but will be followed by print
Definition: PubStatus_.hpp:75
@ ePubStatus_medline
date made a MEDLINE record
Definition: PubStatus_.hpp:77
@ ePubStatus_epublish
published electronically by publisher
Definition: PubStatus_.hpp:68
@ ePubStatus_pmc
article first appeared in PubMed Central
Definition: PubStatus_.hpp:71
@ ePubStatus_pmcr
article revision in PubMed Central
Definition: PubStatus_.hpp:72
@ eType_retracted
this citation retracted
Definition: CitRetract_.hpp:86
@ eType_notice
this citation is a retraction notice
Definition: CitRetract_.hpp:87
@ eType_erratum
this is a published erratum
Definition: CitRetract_.hpp:89
@ eType_in_error
an erratum was published about this
Definition: CitRetract_.hpp:88
TMl & SetMl(void)
Select the variant.
Definition: Person_id_.hpp:378
void SetSeason(const TSeason &value)
Assign a value to Season data member.
Definition: Date_std_.hpp:569
void SetYear(TYear value)
Assign a value to Year data member.
Definition: Date_std_.hpp:435
void SetMinute(TMinute value)
Assign a value to Minute data member.
Definition: Date_std_.hpp:670
void SetTag(TTag &value)
Assign a value to Tag data member.
Definition: Dbtag_.cpp:66
void SetHour(THour value)
Assign a value to Hour data member.
Definition: Date_std_.hpp:623
void SetMonth(TMonth value)
Assign a value to Month data member.
Definition: Date_std_.hpp:482
TStd & SetStd(void)
Select the variant.
Definition: Date_.cpp:115
void SetDay(TDay value)
Assign a value to Day data member.
Definition: Date_std_.hpp:529
TConsortium & SetConsortium(void)
Select the variant.
Definition: Person_id_.hpp:418
TStr & SetStr(void)
Select the variant.
Definition: Object_id_.hpp:304
void SetSecond(TSecond value)
Assign a value to Second data member.
Definition: Date_std_.hpp:717
void SetDb(const TDb &value)
Assign a value to Db data member.
Definition: Dbtag_.hpp:229
TStr & SetStr(void)
Select the variant.
Definition: Date_.hpp:313
TGene & SetGene(void)
Assign a value to Gene data member.
void SetEm(TEm &value)
Assign a value to Em data member.
TIdnum & SetIdnum(void)
Assign a value to Idnum data member.
void SetStatus(TStatus value)
Assign a value to Status data member.
void SetCit(TCit &value)
Assign a value to Cit data member.
list< CRef< CMedline_rn > > TSubstance
void SetAbstract(const TAbstract &value)
Assign a value to Abstract data member.
list< CRef< CMedline_si > > TXref
TXref & SetXref(void)
Assign a value to Xref data member.
list< string > TPub_type
list< CRef< CMedline_mesh > > TMesh
void SetPmid(const TPmid &value)
Assign a value to Pmid data member.
TPub_type & SetPub_type(void)
Assign a value to Pub_type data member.
TMesh & SetMesh(void)
Assign a value to Mesh data member.
list< string > TGene
TSubstance & SetSubstance(void)
Assign a value to Substance data member.
EType
type of xref
Definition: Medline_si_.hpp:86
@ eStatus_publisher
record as supplied by publisher
@ eStatus_premedline
premedline record
@ eType_carbbank
Carbohydrate Structure Database.
Definition: Medline_si_.hpp:88
@ eType_psd
Protein Sequence Database (Japan)
Definition: Medline_si_.hpp:98
@ eType_embl
EMBL Data Library.
Definition: Medline_si_.hpp:89
@ eType_swissprot
SwissProt.
Definition: Medline_si_.hpp:99
@ eType_pir
Protein Identification Resource.
Definition: Medline_si_.hpp:96
@ eType_hdb
Hybridoma Data Bank.
Definition: Medline_si_.hpp:90
@ eType_hgml
Human Gene Map Library.
Definition: Medline_si_.hpp:92
@ eType_genbank
GenBank.
Definition: Medline_si_.hpp:91
@ eType_pdb
Protein Data Bank (Brookhaven)
Definition: Medline_si_.hpp:95
@ eType_ddbj
DNA Data Bank of Japan.
Definition: Medline_si_.hpp:87
@ eType_msd
Microbial Strains Database.
Definition: Medline_si_.hpp:94
@ eType_mim
Mendelian Inheritance in Man.
Definition: Medline_si_.hpp:93
@ eType_prfseqdb
Protein Research Foundation (Japan)
Definition: Medline_si_.hpp:97
@ eType_gdb
Genome Data Base.
bool IsCollectiveName(void) const
Check if variant CollectiveName is selected.
Definition: Author_.hpp:988
TValidYN GetValidYN(void) const
Get the ValidYN member data.
Definition: Author_.hpp:788
bool IsELocationID(void) const
Check if variant ELocationID is selected.
Definition: Article_.hpp:1088
const TELocationID & GetELocationID(void) const
Get the variant data.
Definition: Article_.hpp:1094
const TAuthorList & GetAuthorList(void) const
Get the AuthorList member data.
Definition: Article_.hpp:1261
const TArticleDate & GetArticleDate(void) const
Get the ArticleDate member data.
Definition: Article_.hpp:1400
const TLanguage & GetLanguage(void) const
Get the Language member data.
Definition: Article_.hpp:1282
TIdType GetIdType(void) const
Get the IdType member data.
Definition: ArticleId_.hpp:324
const TYM & GetYM(void) const
Get the variant data.
Definition: PubDate_.cpp:352
const TPE & GetPE(void) const
Get the variant data.
Definition: Article_.cpp:206
const TYear & GetYear(void) const
Get the Year member data.
const TMeshHeading & GetMeshHeading(void) const
Get the MeshHeading member data.
const TDay & GetDay(void) const
Get the Day member data.
const TPublicationType & GetPublicationType(void) const
Get the PublicationType member data.
const TMedlineCitation & GetMedlineCitation(void) const
Get the MedlineCitation member data.
const TChemical & GetChemical(void) const
Get the Chemical member data.
bool IsSetVolume(void) const
Check if a value has been assigned to Volume data member.
const THM & GetHM(void) const
Get the HM member data.
TPubModel GetPubModel(void) const
Get the PubModel member data.
Definition: Article_.hpp:970
const TPubmedData & GetPubmedData(void) const
Get the PubmedData member data.
bool IsSetArticleTitle(void) const
Check if a value has been assigned to ArticleTitle data member.
const Tdata & Get(void) const
Get the member data.
Definition: Issue_.hpp:182
const TMedlinePgn & GetMedlinePgn(void) const
Get the variant data.
const TGrant & GetGrant(void) const
Get the Grant member data.
Definition: GrantList_.hpp:378
bool IsLFIS(void) const
Check if variant LFIS is selected.
Definition: Author_.hpp:982
const TPubDate & GetPubDate(void) const
Get the PubDate member data.
const TArticle & GetArticle(void) const
Get the Article member data.
const TSEM & GetSEM(void) const
Get the variant data.
const TCommentsCorrections & GetCommentsCorrections(void) const
Get the CommentsCorrections member data.
const THistory & GetHistory(void) const
Get the History member data.
bool IsSetAuthorList(void) const
Check if a value has been assigned to AuthorList data member.
Definition: Article_.hpp:1249
const TCommentsCorrectionsList & GetCommentsCorrectionsList(void) const
Get the CommentsCorrectionsList member data.
const TPE_2 & GetPE_2(void) const
Get the PE_2 member data.
Definition: Article_.hpp:1210
bool IsSetCompleteYN(void) const
Check if a value has been assigned to CompleteYN data member.
const TIssue & GetIssue(void) const
Get the Issue member data.
bool IsSetIssue(void) const
Check if a value has been assigned to Issue data member.
const TMonth & GetMonth(void) const
Get the Month member data.
const TCollectiveName & GetCollectiveName(void) const
Get the variant data.
Definition: Author_.cpp:278
const TAttlist & GetAttlist(void) const
Get the Attlist member data.
const Tdata & Get(void) const
Get the member data.
const TArticleTitle & GetArticleTitle(void) const
Get the ArticleTitle member data.
bool IsSetELocationID(void) const
Check if a value has been assigned to ELocationID data member.
Definition: Article_.hpp:1028
const TLFIS & GetLFIS(void) const
Get the variant data.
Definition: Author_.cpp:256
const TELocationID & GetELocationID(void) const
Get the ELocationID member data.
Definition: Article_.hpp:1040
const TPubMedPubDate & GetPubMedPubDate(void) const
Get the PubMedPubDate member data.
Definition: History_.hpp:167
bool IsSetValidYN(void) const
Check if a value has been assigned to ValidYN data member.
Definition: Author_.hpp:762
const TGeneSymbol & GetGeneSymbol(void) const
Get the GeneSymbol member data.
const TPublicationStatus & GetPublicationStatus(void) const
Get the PublicationStatus member data.
const Tdata & Get(void) const
Get the member data.
const TMedlinePgn & GetMedlinePgn(void) const
Get the MedlinePgn member data.
const Tdata & Get(void) const
Get the member data.
Definition: Volume_.hpp:182
bool IsYM(void) const
Check if variant YM is selected.
Definition: PubDate_.hpp:790
const TMedlineTA & GetMedlineTA(void) const
Get the MedlineTA member data.
const TAttlist & GetAttlist(void) const
Get the Attlist member data.
Definition: Article_.hpp:1120
const TPagination & GetPagination(void) const
Get the Pagination member data.
Definition: Article_.hpp:1010
const TMedlineJournalInfo & GetMedlineJournalInfo(void) const
Get the MedlineJournalInfo member data.
const TJournal & GetJournal(void) const
Get the Journal member data.
Definition: Article_.hpp:1150
bool IsSetCommentsCorrectionsList(void) const
Check if a value has been assigned to CommentsCorrectionsList data member.
const TDataBank & GetDataBank(void) const
Get the DataBank member data.
const TArticleIdList & GetArticleIdList(void) const
Get the ArticleIdList member data.
TCompleteYN GetCompleteYN(void) const
Get the CompleteYN member data.
bool IsSetIdType(void) const
Check if a value has been assigned to IdType data member.
Definition: ArticleId_.hpp:298
bool IsSetHM(void) const
Check if a value has been assigned to HM data member.
const Tdata & Get(void) const
Get the member data.
Definition: Day_.hpp:182
const TArticleId & GetArticleId(void) const
Get the ArticleId member data.
const TAuthor & GetAuthor(void) const
Get the Author member data.
const TMonth & GetMonth(void) const
Get the Month member data.
bool IsMedlinePgn(void) const
Check if variant MedlinePgn is selected.
const TVolume & GetVolume(void) const
Get the Volume member data.
bool IsSetHistory(void) const
Check if a value has been assigned to History data member.
const Tdata & Get(void) const
Get the member data.
Definition: Year_.hpp:182
const TLC & GetLC(void) const
Get the LC member data.
Definition: Author_.hpp:1036
bool IsMedlineDate(void) const
Check if variant MedlineDate is selected.
Definition: PubDate_.hpp:796
bool IsSEM(void) const
Check if variant SEM is selected.
const TAttlist & GetAttlist(void) const
Get the Attlist member data.
Definition: ArticleId_.hpp:361
const TAttlist & GetAttlist(void) const
Get the Attlist member data.
Definition: Author_.hpp:1006
const TDay & GetDay(void) const
Get the Day member data.
const Tdata & Get(void) const
Get the member data.
Definition: Month_.hpp:182
bool IsPE(void) const
Check if variant PE is selected.
Definition: Article_.hpp:1082
const TMedlineDate & GetMedlineDate(void) const
Get the variant data.
Definition: PubDate_.cpp:374
const TAbstractText & GetAbstractText(void) const
Get the AbstractText member data.
Definition: Abstract_.hpp:210
const TYear & GetYear(void) const
Get the Year member data.
string UTF8ToAsciiString(const char *src, const SUnicodeTranslation *default_translation, const TUnicodeTable *table=NULL, EConversionResult *result=NULL)
Convert UTF8 into ASCII string.
Definition: unicode.cpp:526
@ e_not_set
int i
int isspace(Uchar c)
Definition: ncbictype.hpp:69
int toupper(Uchar c)
Definition: ncbictype.hpp:73
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
static BOOL utf8
Definition: pcregrep.c:199
static char * locale
Definition: pcregrep.c:149
CRef< CPub > journal(ParserPtr pp, char *bptr, char *eptr, CRef< CAuth_list > &auth_list, CRef< CTitle::C_E > &title, bool has_muid, CRef< CCit_art > &cit_art, Int4 er)
Definition: ref.cpp:1468
static const char * str(char *buf, int n)
Definition: stats.c:84
static const char * proc
Definition: stats.c:21
Definition: type.c:6
Modified on Mon Dec 11 02:36:50 2023 by modify_doxy.py rev. 669887