Ecotrust / wc-data-registry

Data Registry for the West Coast Governors Alliance
Other
10 stars 8 forks source link

Date-published is incorrect for iso2 records #136

Closed twelch closed 9 years ago

twelch commented 9 years ago

An ISO2 records published 2 different dates, creation and published like so

<gmd:date>
   <gmd:CI_Date>
      <gmd:date>
         <gco:Date>2015-02-15</gco:Date>
      </gmd:date>
      <gmd:dateType>
         <gmd:CI_DateTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
                              codeListValue="publication">publication</gmd:CI_DateTypeCode>
      </gmd:dateType>
   </gmd:CI_Date>
</gmd:date>
<gmd:date>
   <gmd:CI_Date>
      <gmd:date>
         <gco:Date>1916-08-22</gco:Date>
      </gmd:date>
      <gmd:dateType>
         <gmd:CI_DateTypeCode codeList="http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode"
                              codeListValue="creation">creation</gmd:CI_DateTypeCode>
      </gmd:dateType>
   </gmd:CI_Date>
</gmd:date>

The problem seems to be that the second date is always parsed out as the published date. The XPATH match string that's used isn't smart enough to match the published date explicitly by using the DateTypeCode. Here is the current naive XPATH used here - https://github.com/Ecotrust/wc-data-registry/blob/master/site_raw/_includes/js/services/Metadata.js

isoii: "gmd\:identificationInfo > gmd\:MD_DataIdentification > gmd\:citation > gmd\:CI_Citation > gmd\:date > gmd\:CI_Date > gmd\:date > gco\:Date, identificationInfo > MD_DataIdentification > citation > CI_Citation > date > CI_Date > gdate > Date"

twelch commented 9 years ago

Example record - http://wcga-vm01.sdsc.edu/discover/#?s=SCCOOS&text=manual

2015-02-15 is the published date but instead the creation date is displayed, 1916-08-22

twelch commented 9 years ago

We've confirmed that by manually switching the order of the two date records that the published date is used. This proves that the xpath used is simply returning the last date record and needs to be improved.