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

Express more combination of required resources in schemas.json #1953

Closed
peterdesmet opened this issue Feb 27, 2023 · 8 comments
Closed

Express more combination of required resources in schemas.json #1953

peterdesmet opened this issue Feb 27, 2023 · 8 comments

Comments

@peterdesmet
Copy link
Member

Publishing a Camtrap DP (ipt3.gbif-uat.org) currently fails:

Publishing version #1.0 of resource camtrap-dp-0-6 failed: Archive generation for resource camtrap-dp-0-6 failed: io.frictionlessdata.tableschema.exception.TableValidationException: Declared column observationID not found in data

The event-observations file does contain a observationID column however. Maybe there is some code checking for an observations resource (Camtrap DP 0.4), while Camtrap 0.6 expects a event-observations and/or media-observations resource?

20:00:50 Data package generation started for version #1.0
20:00:50 Start writing data file for event-observations
20:00:51 Data file written for event-observations with 39 records and 18 columns
20:00:51 Start writing data file for media-observations
20:00:51 Data file written for media-observations with 0 records and 19 columns
20:00:51 Start writing data file for deployments
20:00:51 Data file written for deployments with 4 records and 23 columns
20:00:51 Start writing data file for media
20:00:51 Data file written for media with 423 records and 12 columns
20:00:51 All data files completed
20:00:51 Metadata added
@mike-podolskiy90
Copy link
Contributor

Thank you for reporting the bug @peterdesmet
Maybe the IPT expects all four entities mapped? Have you tried that?

@mike-podolskiy90
Copy link
Contributor

Yes, my guess was correct. If you map all four of them you can publish the resource

@peterdesmet
Copy link
Member Author

Aha! The intended behaviour is that all of the following are valid:

  • deployments, media, media-observations
  • deployments, media, event-observations
  • deployments, media, media-observations, event-observations

@mike-podolskiy90
Copy link
Contributor

mike-podolskiy90 commented Feb 27, 2023

Ok, if we want more complex functionality there we need to implement it somehow in the schema file https://rs.gbif.org/sandbox/experimental/schemas.json , so IPT can understand what combinations are valid. By default all entities are required

@peterdesmet
Copy link
Member Author

Thanks! Suggestions on how to express this best in schemas.json? Ping @timrobertson100.

@mike-podolskiy90
Copy link
Contributor

mike-podolskiy90 commented Feb 27, 2023

Add something like this to https://rs.gbif.org/sandbox/experimental/schemas.json at the scheme level

{
  "constraints": [
    {
      "required": ["deployments", "media"],
      "anyOf": ["media-observations", "event-observations"]
    }
  ]
}

@mike-podolskiy90
Copy link
Contributor

keys would be required, optional, anyOf, oneOf

@peterdesmet peterdesmet added this to the Camtrap DP milestone Feb 27, 2023
@peterdesmet peterdesmet changed the title Publication fails for Camtrap DP Express more combination of required resources in schemas.json Feb 27, 2023
@mike-podolskiy90
Copy link
Contributor

I've updated rs.gbif.org by adding schema requirements. Just deployed and tested on ipt3.gbif-uat.org, looks fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants