Skip to content

Microservice to construct and validate a submission harvested from a published document

License

Notifications You must be signed in to change notification settings

lblod/validate-submission-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

validate-submission-service

Microservice to construct and validate a submission harvested from a published document or sent manually.

Getting started

Add the service to a stack

Add the following snippet to your docker-compose.yml:

validate-submission:
  image: lblod/validate-submission-service
  volumes:
    - ./config/semantic-forms:/share/semantic-forms
    - ./data/files/submissions:/share/submissions

The volume mounted in /share/semantic-forms must contain all the Turtle files containing current and deprecated form definitions. We recommend adding a timestamp to the Turtle file names to differentiate them over time.

The volume mounted in /share/submissions must contain the Turtle files containing the data harvested from the published documents. The resulting Turtle files to fill in the forms will also be written to this folder.

Configure the delta-notification service to send notifications on the /delta endpoint when an automatic submission task is read for validation. Add the following snippet in the delta rules configuration of your project:

export default [
  {
    match: {
      predicate: {
        type: 'uri',
        value: 'http://www.w3.org/ns/adms#status'
      },
      object: {
        type: 'uri',
        value: 'http://lblod.data.gift/automatische-melding-statuses/ready-for-validation'
      }
    },
    callback: {
      url: 'http://validate-submission/delta',
      method: 'POST'
    },
    options: {
      resourceFormat: 'v0.0.1',
      gracePeriod: 1000,
      ignoreFromSelf: true
    }
  }
]

Reference

API

Delta handling (automatic submissions)

POST /delta

Triggers the construction and validation of a submission for a harvested publication.

The service is triggered by updates of resources of type melding:AutomaticSubmissionTask of which the status is updated to http://lblod.data.gift/automatische-melding-statuses/ready-for-validation .

The delta handling consists of 2 steps:

  1. Try to fill in a Toezicht form with the harvested data
  2. Auto-submit the form if it's valid and auto-submission is requested

Manual editing of submission documents

Update a submission document
PUT /submission-documents/:uuid

expected payload: {
 additions: '',
 removals: ''
}

Update a submission document based on the submitted document uuid. The additions and removals are written to TTL files. The current state of the filled in form is also written to a separate TTL file.

Submit a submission document
POST /submission-document/:uuid/submit

Submits a submission document if it's valid.

Model

Automatic submission task

A resource describing the status and operation of the subtask of processing an automatic submission job.

Class

task:Task

Properties

The model is specified in the README of the job-controller-service.


Automatic submission task statuses

Once the enrichment process starts, the status of the automatic submission task is updated to http://redpencil.data.gift/id/concept/JobStatus/busy.

On successful completion, the status of the automatic submission task is updated to http://redpencil.data.gift/id/concept/JobStatus/success. The resultsContainer is then linked to the inputContainer of the task, because no file has been created or modified, only triples in the database.

On failure, the status is updated to http://redpencil.data.gift/id/concept/JobStatus/failed. If possible, an error is written to the database and the error is linked to this failed task.


Submission

Submission to be validated and submitted.

Class

meb:Submission

Properties

For a full list of properties of a submission, we refer to the automatic submission documentation. The relevant properties for the validate-submission service are listed below.

Name Predicate Range Definition
status adms:status skos:Concept Status of the submission
submittedResource dct:subject foaf:Document Document that is the subject of the submission

Submission statuses

The status of a submission will be updated if the form is valid and submission is requested.

Possible statuses of a submission are:

Submitted document

Class

foaf:Document (and ext:SubmissionDocument)

Properties
Name Predicate Range Definition
source dct:source nfo:FileDataObject TTL files containing data about the submitted document. The TTL files have different types

Turtle file

TTL file containing triples used to fill in a form.

Class

nfo:FileDataObject

Properties
Name Predicate Range Definition
type dct:type nfo:FileDataObject Type of the TTL file (additions, removals, meta, form, current filled in form data)

Additional properties are specified in the model of the file service.

Possible values of the file type are:

Related services

The following services are also involved in the automatic processing of a submission:

About

Microservice to construct and validate a submission harvested from a published document

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published