Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API / CSV export / Add support for custom export. #7132

Merged
merged 3 commits into from
Aug 24, 2023
Merged

Commits on Jun 5, 2023

  1. API / CSV export / Add support for custom export.

    Current CSV export is based on XSL transformations and can be hard to use when user is interested in element with multiple values (eg. online source, contacts).
    
    Default CSV export remains the same but add the possibility to customize the export with 2 additional parameters to create custom export:
    
    * `loopElementXpath`: element to loop on eg. use
    `.` for the metadata
    `.//gmd:CI_ResponsibleParty` for all contacts in ISO19139,
    `.//gmd:transferOptions/*/gmd:onLine/*` for all online resources in ISO19139.
    
    * `propertiesXpath`: columns to extract eg.
    `gmd:identificationInfo/*/gmd:citation/*/gmd:title//text()` for the title.
    
    Also add parameters for defining separators:
    * `sep` for column separator
    * `internalSep` when multiple values are stored in a field
    
    User can then build custom reports from the API:
    
    eg. Export Contact with role,org,email
    http://localhost:8080/srv/api/records/csv?bucket=s101&loopElementXpath=.//gmd:CI_ResponsibleParty&propertiesXpath=gmd:role/*/@codeListValue&propertiesXpath=gmd:organisationName/*/text()&propertiesXpath=.//gmd:electronicMailAddress/*/text()
    
    eg. Export Online source with protocol,url,name,desc
    http://localhost:8080/srv/api/records/csv?bucket=s101&loopElementXpath=.//gmd:transferOptions/*/gmd:onLine/*&propertiesXpath=gmd:protocol/*/text()&propertiesXpath=gmd:linkage/*/text()&propertiesXpath=gmd:name/*/text()&propertiesXpath=gmd:description/*/text()
    
    eg. Export Metadata with title,alternateTitle,status,maintenanceFreq,...
    http://localhost:8080/srv/api/records/csv?bucket=s101&loopElementXpath=.&propertiesXpath=gmd:identificationInfo/*/gmd:citation/*/gmd:title//text()&propertiesXpath=gmd:identificationInfo/*/gmd:citation/*/gmd:alternateTitle//text()&propertiesXpath=gmd:identificationInfo/*/gmd:status/*/@codeListValue&propertiesXpath=gmd:identificationInfo/*//gmd:maintenanceAndUpdateFrequency/*/@codeListValue&propertiesXpath=gmd:identificationInfo/*//gmd:otherConstraints//text()&propertiesXpath=gmd:identificationInfo/*/gmd:topicCategory//text()&propertiesXpath=gmd:identificationInfo/*/gmd:language/*/@codeListValue&propertiesXpath=gmd:identificationInfo/*/gmd:graphicOverview/*/gmd:fileName/*/text()
    
    Functions from XPath v1 can also be used eg. `count`
    http://localhost:8080/srv/api/records/csv?bucket=s101&loopElementXpath=.&propertiesXpath=count(gmd:identificationInfo/*/gmd:descriptiveKeywords)
    
    For all exports 2 columns are added first:
    * UUID
    * permalink
    
    When using XPath, it is recommended to export records in same schema (or at least same base schema). If not, then XPath error messages are returned in cells unless XPath provided do not require namespaces. Users have to configure a proper selection to avoid mixing schema.
    fxprunayre committed Jun 5, 2023
    Configuration menu
    Copy the full SHA
    103e35e View commit details
    Browse the repository at this point in the history
  2. Sonarlint.

    fxprunayre committed Jun 5, 2023
    Configuration menu
    Copy the full SHA
    533edb4 View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2023

  1. Configuration menu
    Copy the full SHA
    8fd2370 View commit details
    Browse the repository at this point in the history