Skip to content

ENH: Add project validation metadata#288

Merged
GibranAlfa merged 2 commits into
equinor:mainfrom
GibranAlfa:add-project-validation-metadata
Jun 29, 2026
Merged

ENH: Add project validation metadata#288
GibranAlfa merged 2 commits into
equinor:mainfrom
GibranAlfa:add-project-validation-metadata

Conversation

@GibranAlfa

@GibranAlfa GibranAlfa commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Resolves #58

Added project config validation metadata so API can record when saved project data was last checked against external/project sources.

This adds:

  • ValidationRecord, with last_validated_at and last_validated_by
  • ProjectValidation, with masterdata_smda and rms_project
  • ProjectConfig.validation, defaulting to empty validation metadata

Example serialized shape:

{
  "validation": {
    "masterdata_smda": {
      "last_validated_at": "2026-06-25T10:30:00Z",
      "last_validated_by": "muga"
    },
    "rms_project": {
      "last_validated_at": "2026-06-25T10:31:00Z",
      "last_validated_by": "muga"
    }
  }
}

Empty/default shape:

{
  "validation": {
    "masterdata_smda": null,
    "rms_project": null
  }
}

The API would fill them like this:

record = ValidationRecord(
    last_validated_at=datetime.now(UTC),
    validated_by=getpass.getuser(),
)

self._fmu_dir.set_config_value(
    "validation.masterdata_smda",
    record.model_dump(),
)

Checklist

  • Tests added (if not, comment why) - just model update
  • Test coverage equal or up from main (run pytest with --cov=src/ --cov-report term-missing)
  • If not squash merging, every commit passes tests
  • Appropriate commit prefix and precise commit message used
  • All debug prints and unnecessary comments removed
  • Docstrings are correct and updated
  • Documentation is updated, if necessary
  • Latest main rebased/merged into branch
  • Added comments on this PR where appropriate to help reviewers
  • Moved issue status on project board
  • Checked the boxes in this checklist ✅

@GibranAlfa GibranAlfa changed the title ENH: add project validation metadata ENH: Add project validation metadata Jun 25, 2026
@GibranAlfa
GibranAlfa marked this pull request as ready for review June 25, 2026 13:56
@GibranAlfa
GibranAlfa requested review from slangeveld and tnatt June 25, 2026 13:56
@GibranAlfa GibranAlfa self-assigned this Jun 25, 2026
@GibranAlfa GibranAlfa added the enhancement New feature or request label Jun 25, 2026

@slangeveld slangeveld left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

"""Timestamp when the data was last validated."""

last_validated_by: str
"""User who performed the validation."""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should probably be "User who performed the last validation" to be alligned with docstring for last_validated_at

@GibranAlfa
GibranAlfa force-pushed the add-project-validation-metadata branch from 4c9eb1d to b79e922 Compare June 29, 2026 09:50
@GibranAlfa
GibranAlfa force-pushed the add-project-validation-metadata branch from b79e922 to 23a4319 Compare June 29, 2026 09:50
@GibranAlfa
GibranAlfa merged commit d1ecb1c into equinor:main Jun 29, 2026
9 checks passed
@GibranAlfa
GibranAlfa deleted the add-project-validation-metadata branch June 29, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Store when queried data was last validated with a third-party source

2 participants