metadata101 / iso19139.ca.HNAP

ISO Harmonized North American Profile (HNAP)
GNU General Public License v2.0
4 stars 18 forks source link

Customize search csv export for HNAP #374

Closed tylerjmchugh closed 3 months ago

tylerjmchugh commented 3 months ago

HNAP Schema is using the iso19139 csv. Added a tpl-csv.xsl customized for HNAP, copied from iso19139's tpl-csv.xsl.

RI codes used in column names are mapped to a meaningful and readable string using codelists.

Without this PR the HNAP headers look like this

image

Values should come from codelists.

<xsl:variable name="codelists" select="/root/gui/schemas/iso19139.ca.HNAP/codelists"/>

Updated some issues related to thesaurus keywords.

Reference system element added so that geoBox coordinates can be used appropriately.

ianwallen commented 3 months ago

@tylerjmchugh Some of the items that you are changing in tpl-csv.xsl may be better fixed in the geonetwork core iso19139 base code as I would expect that the bugs are in that templates as well.

@josegar74 do you see any reason to have HNAP specific implementation for this code? Seems like most of the change can be applied to https://github.com/geonetwork/core-geonetwork/blob/6de7305e63cb08b7976b91e9473e90d750b88483/schemas/iso19139/src/main/plugin/iso19139/layout/tpl-csv.xsl and maybe even https://github.com/geonetwork/core-geonetwork/blob/6de7305e63cb08b7976b91e9473e90d750b88483/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/tpl-csv.xsl

ianwallen commented 3 months ago

I guess there is a reason for HNAP to have it's own version HNAP stores codelist as RI* values and it puts the value as both English and French like the following image HNAP has special code which uses the RI* code to lookup the code list to get the proper value to be displayed.

I believe it is something like this, but you will need to look into it. <xsl:apply-templates mode="render-value" select="*/@codeListValue"/>

tylerjmchugh commented 3 months ago

I guess there is a reason for HNAP to have it's own version HNAP stores codelist as RI* values and it puts the value as both English and French like the following image HNAP has special code which uses the RI* code to lookup the code list to get the proper value to be displayed.

I believe it is something like this, but you will need to look into it. <xsl:apply-templates mode="render-value" select="*/@codeListValue"/>

I'm still trying to figure out how the render-value template relates to the RI Codes.

Right now I am getting the codelist myself:

https://github.com/metadata101/iso19139.ca.HNAP/blob/5015bcfb99e61eea64f5bf6a252e2e2e90dfbba3/src/main/plugin/iso19139.ca.HNAP/layout/tpl-csv.xsl#L45

Then I am getting the value element for the entry with a code that matches the RI code. And then I am getting the text before the first semi-colon (english text):

https://github.com/metadata101/iso19139.ca.HNAP/blob/5015bcfb99e61eea64f5bf6a252e2e2e90dfbba3/src/main/plugin/iso19139.ca.HNAP/layout/tpl-csv.xsl#L76

I figured that using just the english is ok for a column key as the codelist values are known and there should always be an english value. I found similar logic in other HNAP files and geonetwork functions.

Is something like this acceptable?

I also saw some examples of the RI code to readable string mapping being done with hardcoded variables but I figure using the codelist is better.

ianwallen commented 3 months ago

@tylerjmchugh

I figured that using just the english is ok for a column key as the codelist values are known and there should always be an english value. I found similar logic in other HNAP files and geonetwork functions.

Using @codeListValue would be more accurate however I do see what you mean. There seems to be lots of cases that are using tokenize().

@josegar74, What is the best way to get the language values?

i.e. in the following

 <gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://nap.geogratis.gc.ca/metadata/register/napMetadataRegister.xml#IC_87" codeListValue="RI_366">creation; création</gmd:CI_DateTypeCode>
</gmd:dateType>

It seems like getting RI_366 from codelist would be the correct way to get the value. Parsing creation; création seems like it can be buggy and cause issues getting the data based on different languages.

Can you give some guidance.

josegar74 commented 3 months ago

The codes like RI_366 are translated in the codelist files (label element):

https://github.com/metadata101/iso19139.ca.HNAP/blob/085ee01500873bb768dfef69e0a36814a941944b/src/main/plugin/iso19139.ca.HNAP/loc/eng/codelists.xml#L24

But I think should be quite safe to parse the value creation; création as in HNAP for the codelist fields in the XML contains the format English value;French value.