adiwg / mdTranslator

Metadata translation tool built using Ruby
https://www.adiwg.org/mdTranslator/
The Unlicense
14 stars 12 forks source link

Liability Statement Missing in Translations from mdJSON #236

Closed dwalt closed 1 year ago

dwalt commented 1 year ago

Distribution Liability (distliab) is not writing to CSDGM from mdJSON input: schema{ } > metadata{ } > resourceDistribution[ ] > distribution{ } > liabilityStatement. Data appears to be in mdJSON file.

timothypage commented 1 year ago

I think the issue might be, related to this comment in the fgdc writer for distribution

# in FGDC each distribution can have only one distributor
# the passed in mdJson hDistribution may contain multiple distributors
# therefore, create a separate FGDC distribution record for each distributor
# and repeat the distribution information

so if they're no distributor, no distribution info gets printed out. I added a check if there's no distributors, still print out the description and liabilityStatement

dwalt commented 1 year ago

While that rule is true, it is not the use case here in which there is a single distribution.

Here is the mdJSON, followed by the translated CSDGM:

    "resourceDistribution": [{
        "distributor": [{
            "contact": {
                "role": "distributor",
                "party": [{
                    "contactId": "1b759b80-bb2a-4b66-898d-56e4c9b4a341"
                }]
            },
            "orderProcess": [{
                "fees": "None",
                "orderingInstructions": "It is recommended that a geographic information system or other native GeoTIFF viewer be used to view the elevation raster."
            }],
            "transferOption": [{
                "onlineOption": [{
                    "uri": "https://doi.org/10.5066/P9K7CFRI",
                    "protocol": "HTTPS",
                    "description": "Landing webpage for data download"
                }],
                "distributionFormat": [{
                    "formatSpecification": {
                        "title": "geoTIFF"
                    },
                    "compressionMethod": "LZW"
                }],
                "transferSize": 6000
            }]
        }],
        "description": "Authoritative source for the data.",
        "liablityStatement": "Unless otherwise stated, all data, metadata and related materials are considered to satisfy the quality standards relative to the purpose for which the data were collected. Although these data and associated metadata have been reviewed for accuracy and completeness and approved for release by the U.S. Geological Survey (USGS), no warranty expressed or implied is made regarding the display or utility of the data on any other system or for general or scientific purposes, nor shall the act of distribution constitute any such warranty."
    }],
 <distinfo>
      <distrib>
         <cntinfo>
            <cntorgp>
               <cntorg>U.S. Geological Survey, Alaska Science Center</cntorg>
            </cntorgp>
            <cntaddr>
               <addrtype>physical</addrtype>
               <address>4210 University Drive</address>
               <city>Anchorage</city>
               <state>AK</state>
               <postal>99508</postal>
               <country>USA</country>
            </cntaddr>
            <cntvoice>907-786-7000</cntvoice>
            <cntfax>907-786-7020</cntfax>
            <cntemail>ascweb@usgs.gov</cntemail>
         </cntinfo>
      </distrib>
      <resdesc>Authoritative source for the data.</resdesc>
      <stdorder>
         <digform>
            <digtinfo>
               <formname>geoTIFF</formname>
               <formspec>geoTIFF</formspec>
               <filedec>LZW</filedec>
               <transize>6000</transize>
            </digtinfo>
            <digtopt>
               <onlinopt>
                  <computer>
                     <networka>
                        <networkr>https://doi.org/10.5066/P9K7CFRI</networkr>
                     </networka>
                  </computer>
                  <accinstr>HTTPS</accinstr>
                  <oncomp>Landing webpage for data download</oncomp>
               </onlinopt>
            </digtopt>
         </digform>
         <fees>None</fees>
         <ordering>It is recommended that a geographic information system or other native GeoTIFF viewer be used to view the elevation raster.</ordering>
      </stdorder>
      <techpreq/>
   </distinfo>

The distliab tags should appear below the resdesc tags

timothypage commented 1 year ago

@dwalt I see the issue, it looks like there a misspelling, liablityStatement vs liabilityStatement (missing i)

this is coming from mdEditor https://github.com/adiwg/mdEditor/blob/f94770686df07ef76aa111f8f9734b32bbad7f21/app/pods/components/object/md-distribution/template.hbs#L22

since this is in the Production version I'll do a little digging on how we can handle upgrading existing mdJson to the correct spelling transparently in the editor, and I suppose we should handle both spellings in the translator

dwalt commented 1 year ago

Good eye! I would agree with supporting both spellings in the translator to avoid breaking older mdJSON files. I am surprised the schema validator did not catch the invalid tag.

timothypage commented 1 year ago

@dwalt this and the other "CSDGM" issues are deployed here for testing:

https://dev-translator.mdeditor.org/demo

(and https://dev-editor.mdeditor.org/dashboard points to the above)

dwalt commented 1 year ago

mdJSON-CSDGM translated successfully in test

hmaier-fws commented 1 year ago

@dwalt how do we want to handle instances where BOTH a liabilityStatement (imported from CSDGM) and a liablityStatement (missing i) are present? I came across an instance of this today. In theory, the statement entered via the editor (after CSDGM import) could supersede the initial statement. Do we want to append the two values into a single statement?

dwalt commented 1 year ago

@hmaier-fws I would tend to think that what the user entered in mdEditor is the latest and greatest and should supersede what was imported. Often, the re-entered text is the same as what was imported, so if it is appended, it is definitely wrong.

dwalt commented 1 year ago

This problem has been discovered in -2 output and HTML and is therefore universal. The fix should solve it for all writers that write Liability Statement, but should be verified.

jwaspin commented 1 year ago

PR created https://github.com/adiwg/mdEditor/pull/557

jwaspin commented 1 year ago

https://github.com/adiwg/mdEditor/issues/497 is related