Skip to content

Bug and enhancement for accrual periodicity#89

Open
jbrown-xentity wants to merge 9 commits intomainfrom
bug/accrualPeriodicity2
Open

Bug and enhancement for accrual periodicity#89
jbrown-xentity wants to merge 9 commits intomainfrom
bug/accrualPeriodicity2

Conversation

@jbrown-xentity
Copy link
Collaborator

@jbrown-xentity jbrown-xentity commented Mar 19, 2026

Plans to resolve #16 and #17, and address comments. This replaces #58, which is out of date and doesn't have some necessary changes/upgrades.

I agree @zopalmer14 , this shouldn't be any string. I've limited it to the lists from the different standards, and linked to the documentation in the JSON schema description. Because ISO-8601 is so open and contains so many possibilities, I decided to allow "recurring" type strings but to allow any number or value type without getting too in the weeds on what could possibly be implemented (months, days, time seconds, etc).

Now that we understand the nuance between oneOf and anyOf (oneOf forces it to only match one of the possible validations, which is rare that we want to do), this should be good to go.

This also provides a good starting point for the "complete" dataset example. It's quite extensive, but also isn't fully complete because it ignores every implementation of the "Concept" class, which is itself a whole issue that should be addressed. I also updated the test code to give more detailed and simplified information around things that don't validate. Below is what it looked like before the improvements, the latter after these changes.

Before updates:

Field: temporal
      Error: [{'@type': 'PeriodOfTime', 'startDate': '2024-01-01', 'endDate': '2024-09-30'}] is not valid under any of the given schemas
      Schema path: properties/temporal/anyOf
      Validator: anyOf
      Sub-errors (2 alternatives failed):
        Field: (root)
          Error: [{'@type': 'PeriodOfTime', 'startDate': '2024-01-01', 'endDate': '2024-09-30'}] is not of type 'null'
          Schema path: 0/type
          Validator: type

        Field: 0
          Error: {'@type': 'PeriodOfTime', 'startDate': '2024-01-01', 'endDate': '2024-09-30'} is not valid under any of the given schemas
          Schema path: 1/items/oneOf
          Validator: oneOf
          Sub-errors (3 alternatives failed):
            Field: (root)
              Error: {'@type': 'PeriodOfTime', 'startDate': '2024-01-01', 'endDate': '2024-09-30'} is not of type 'string'
              Schema path: 1/type
              Validator: type

            Field: endDate
              Error: '2024-09-30' is not valid under any of the given schemas
              Schema path: 0/properties/endDate/anyOf
              Validator: anyOf
              Sub-errors (2 alternatives failed):
                Field: (root)
                  Error: '2024-09-30' is not of type 'null'
                  Schema path: 0/type
                  Validator: type

                Field: (root)
                  Error: '2024-09-30' is valid under each of {'format': 'date'}, {'format': 'date-time'}
                  Schema path: 1/oneOf
                  Validator: oneOf


            Field: startDate
              Error: '2024-01-01' is not valid under any of the given schemas
              Schema path: 0/properties/startDate/anyOf
              Validator: anyOf
              Sub-errors (2 alternatives failed):
                Field: (root)
                  Error: '2024-01-01' is not of type 'null'
                  Schema path: 0/type
                  Validator: type

                Field: (root)
                  Error: '2024-01-01' is valid under each of {'format': 'date'}, {'format': 'date-time'}
                  Schema path: 1/oneOf
                  Validator: oneOf

After updates:

FAIL: Dataset/good/comprehensive-dataset.json (expected good, but validation failed)

  Validation errors for Dataset/good/comprehensive-dataset.json:
    temporal: field is not null and [0]: does not match any alternative:
    - endDate: field is not null and '2026' is valid under each of {'format': 'date'}, {'pattern': '^[0-9]{4}$', 'description': 'A year in YYYY format'}, {'format': 'date-time'}
    - expected type 'string'

@jbrown-xentity jbrown-xentity requested a review from a team March 19, 2026 16:41
@jbrown-xentity jbrown-xentity added bug Something isn't working enhancement New feature or request ready-for-review labels Mar 19, 2026
@jbrown-xentity jbrown-xentity changed the title Bug/accrual periodicity2 Bug and enhancement for accrual periodicity Mar 19, 2026
Copy link
Collaborator

@neilmb neilmb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one copy-pasta fix, but otherwise great.

{
"@type": "Dataset",
"title": "Example Dataset",
"description": "A minimal dataset example with invalid periodicity",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment (non-blocking): This looks like a copy-paste error.

Suggested change
"description": "A minimal dataset example with invalid periodicity",
"description": "A minimal dataset example with a valid periodicity",

Copy link

@zopalmer14 zopalmer14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Schema changes and examples LGTM. I left one comment on test_json_schema.py but it's trivial

@zopalmer14 zopalmer14 linked an issue Mar 20, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] DatasetSeries.accrualPeriodicity [Bug] Dataset.accrualPeriodicity

3 participants