update how journal information and issn are handled master
authorDon Armstrong <don@donarmstrong.com>
Thu, 13 Jul 2017 21:05:20 +0000 (16:05 -0500)
committerDon Armstrong <don@donarmstrong.com>
Thu, 13 Jul 2017 21:05:20 +0000 (16:05 -0500)
lib/Reference/Retrieve/PubMed.pm

index 6cc771b..78cf935 100644 (file)
@@ -201,8 +201,8 @@ sub _create_reference_from_xml($$){
                             title      => [_fix_medline_title($ref->{MedlineCitation}->{Article}->{ArticleTitle})],
                             abstract   => [_fix_medline_abstract($ref->{MedlineCitation}->{Article}->{Abstract}->{AbstractText})],
                             journal    => [_fix_medline_journal($ref->{MedlineCitation}->{Article}->{Journal},
                             title      => [_fix_medline_title($ref->{MedlineCitation}->{Article}->{ArticleTitle})],
                             abstract   => [_fix_medline_abstract($ref->{MedlineCitation}->{Article}->{Abstract}->{AbstractText})],
                             journal    => [_fix_medline_journal($ref->{MedlineCitation}->{Article}->{Journal},
-                                                                $ref->{MedlineCitation}->{Article}->{MedlineJournalInfo},
-                                                                $ua,
+                                                     $ref->{MedlineCitation}->{MedlineJournalInfo},
+                                                     $ua,
                                                                 #@_, # configuration
                                                                )],
                             _fix_ids($ref),
                                                                 #@_, # configuration
                                                                )],
                             _fix_ids($ref),
@@ -332,9 +332,14 @@ sub _fix_medline_journal($$$;){
      #         </TranslationStack>
      # </eSearchResult>
 
      #         </TranslationStack>
      # </eSearchResult>
 
-     my $ISSN = $journal->{ISSN};
+     my $ISSN = length($journal->{ISSN})? $journal->{ISSN} : $medline_journal->{ISSNLinking};
      if (ref $ISSN) {
          $ISSN = $ISSN->{content};
      if (ref $ISSN) {
          $ISSN = $ISSN->{content};
+  }
+     if (not length($ISSN)) {
+         use Data::Printer;
+         p $journal;
+         die "No ISSN";
      }
      my $url = qq(http://www.ncbi.nlm.nih.gov/nlmcatalog/?term=${ISSN}[ISSN]&format=text&report=xml);
      print STDERR "url: $url\n" if $DEBUG;
      }
      my $url = qq(http://www.ncbi.nlm.nih.gov/nlmcatalog/?term=${ISSN}[ISSN]&format=text&report=xml);
      print STDERR "url: $url\n" if $DEBUG;