Skip to content

Commit

Permalink
Update the invenio and pride packages (#36)
Browse files Browse the repository at this point in the history
* Update [email protected]

- Rework the tokenisation and acess to the metadata in Accordance to ARKTokenization 5.0.0
- Add checks for token existence to the checks for token value

* Create [email protected]

- Rework the tokenisation and acess to the metadata in Accordance to ARKTokenization 5.0.0
- Add checks for token existence to the checks for token value

* use in-package frontmatter metadata extraction for [email protected] and [email protected]

* simplify sanity checks: instead of compiling via fsc, check wether the package can be run via fsi. Revisit compilation in  the future, since this is not ideal.

* only publish preview index on push

---------

Co-authored-by: Kevin Schneider <[email protected]>
  • Loading branch information
LibraChris and kMutagene authored Jun 6, 2024
1 parent 50a81ce commit 25904a4
Show file tree
Hide file tree
Showing 6 changed files with 259 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ jobs:
update-preview-index:
needs: staging-area-pre-publish-checks
runs-on: ubuntu-latest
if: needs.staging-area-pre-publish-checks.outputs.trigger-update-preview-index == 'true'
if: needs.staging-area-pre-publish-checks.outputs.trigger-update-preview-index == 'true' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Set up .NET
Expand Down
116 changes: 116 additions & 0 deletions StagingArea/invenio/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
let [<Literal>]PACKAGE_METADATA = """(*
---
Name: invenio
Summary: Validates if the ARC contains the necessary metadata to be publishable via Invenio.
Description: |
Validates if the ARC contains the necessary metadata to be publishable via Invenio.
The following metadata is required:
- Investigation has title and description
- All persons in Investigation Contacts must have a name, last name, affiliation and valid email
MajorVersion: 2
MinorVersion: 0
PatchVersion: 0
Publish: true
Authors:
- FullName: Oliver Maus
Affiliation: DataPLANT
- FullName: Christopher Lux
Email: [email protected]
Affiliation: RPTU Kaiserslautern
AffiliationLink: http://rptu.de/startseite
Tags:
- Name: ARC
- Name: data publication
ReleaseNotes: |
- Rework the tokenisation and acess to the metadata in Accordance to ARKTokenization 6.0.0/ARCExpect 2.0.0
---
*)"""

#r "nuget: ARCExpect, 2.0.0"

open ControlledVocabulary
open Expecto
open ARCExpect
open ARCTokenization
open ARCTokenization.StructuralOntology
open System.IO

// Input:
let arcDir = Directory.GetCurrentDirectory()

// Values:
let absoluteDirectoryPaths = FileSystem.parseARCFileSystem arcDir

let investigationMetadata =
absoluteDirectoryPaths
|> Investigation.parseMetadataSheetsFromTokens() arcDir
|> List.concat


// Validation Cases:
let cases =
testList INVMSO.``Investigation Metadata``.INVESTIGATION.key.Name [
// Investigation has title
ARCExpect.validationCase (TestID.Name INVMSO.``Investigation Metadata``.INVESTIGATION.``Investigation Title``.Name) {
investigationMetadata
|> Validate.ParamCollection.ContainsParamWithTerm
INVMSO.``Investigation Metadata``.INVESTIGATION.``Investigation Title``
}
// Investigation has description
ARCExpect.validationCase (TestID.Name INVMSO.``Investigation Metadata``.INVESTIGATION.``Investigation Description``.Name) {
investigationMetadata
|> Validate.ParamCollection.ContainsParamWithTerm
INVMSO.``Investigation Metadata``.INVESTIGATION.``Investigation Description``
}
// Investigation has contacts with name, last name, affiliation and email
// Investigation Person First Name
ARCExpect.validationCase (TestID.Name $"{INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person First Name``.Name} exists") {
investigationMetadata
|> Validate.ParamCollection.ContainsParamWithTerm INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person First Name``
}
ARCExpect.validationCase (TestID.Name $"{INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person First Name``.Name} is not empty") {
investigationMetadata
|> Seq.filter (Param.getTerm >> (=) INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person First Name``)
|> Seq.iter Validate.Param.ValueIsNotEmpty
}
// Investigation Person Last Name
ARCExpect.validationCase (TestID.Name $"{INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Last Name``.Name} exists") {
investigationMetadata
|> Validate.ParamCollection.ContainsParamWithTerm INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Last Name``
}
ARCExpect.validationCase (TestID.Name $"{INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Last Name``.Name} is not empty") {
investigationMetadata
|> Seq.filter (Param.getTerm >> (=) INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Last Name``)
|> Seq.iter Validate.Param.ValueIsNotEmpty
}
// Investigation Person Affiliation
ARCExpect.validationCase (TestID.Name $"{INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Affiliation``.Name} exists") {
investigationMetadata
|> Validate.ParamCollection.ContainsParamWithTerm INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Affiliation``
}
ARCExpect.validationCase (TestID.Name $"{INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Affiliation``.Name} is not empty") {
investigationMetadata
|> Seq.filter (Param.getTerm >> (=) INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Affiliation``)
|> Seq.iter Validate.Param.ValueIsNotEmpty
}
// Investigation Person Email
ARCExpect.validationCase (TestID.Name $"{INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Email``.Name} exists") {
investigationMetadata
|> Validate.ParamCollection.ContainsParamWithTerm INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Email``
}
ARCExpect.validationCase (TestID.Name INVMSO.``Investigation Metadata``. ``INVESTIGATION CONTACTS``.``Investigation Person Email``.Name) {
investigationMetadata
|> Seq.filter (Param.getTerm >> (=) INVMSO.``Investigation Metadata``.``INVESTIGATION CONTACTS``.``Investigation Person Email``)
|> Seq.iter (Validate.Param.ValueMatchesRegex StringValidationPattern.email)
}
]

// Execution:

Setup.ValidationPackage(
metadata = Setup.Metadata(PACKAGE_METADATA),
CriticalValidationCases = [cases]
)
|> Execute.ValidationPipeline(
basePath = arcDir
)
Loading

0 comments on commit 25904a4

Please sign in to comment.