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

entity coherence checking tool #4481

Closed
fgalan opened this issue Jan 16, 2024 · 4 comments
Closed

entity coherence checking tool #4481

fgalan opened this issue Jan 16, 2024 · 4 comments
Milestone

Comments

@fgalan
Copy link
Member

fgalan commented Jan 16, 2024

Python script to check orion DB entity inconsistencies. In particular, the following rules would be taken into account:

Rules to check:

  • Rule 10: _id field consistency
  • Rule 11: mandatory fields in entity
  • Rule 12: mandatory fields in attribute
  • Rule 13: attrNames field consistency
  • Rule 14: mdNames field consistency
  • Rule 15: not swapped subkeys in _id
  • Rule 16: location field consistency
  • Rule 17: lastCorrelator existence
  • Rule 20: entity id syntax
  • Rule 21: entity type syntax
  • Rule 22: entity servicePath syntax
  • Rule 23: attribute name syntax
  • Rule 24: attribute type syntax
  • Rule 25: metadata name syntax
  • Rule 26: metadata type syntax
  • Rule 90: detect usage of geo:x attribute type where x different from json
  • Rule 91: detect usage of more than one legacy location metadata
  • Rule 92: detect legacy location metadata should be WGS84 or WSG84
  • Rule 93: detect usage of redundant legacy location
  • Rule 94: detect usage of not redundant legacy location

For Rules 20-26: https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md#identifiers-syntax-restrictions

Entity datamodel: https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/admin/database_model.md#entities-collection

@fgalan
Copy link
Member Author

fgalan commented Jan 16, 2024

The new script make the following ones obsolete:

Btw, they are pretty old and use Python 2.x so it is a good idea to remove both

@fgalan
Copy link
Member Author

fgalan commented Jan 16, 2024

The check_legacy_location_metadata.py script in PR #4048 could be also integrated in the new script.

@fgalan
Copy link
Member Author

fgalan commented Jan 17, 2024

Rule 15 is special, as it is not individually checked on every entity. The following aggregation pipeline will help to detect violations:

db.entities.aggregate([{$group: { _id: {"id": "$_id.id", "type": "$_id.type", "servicePath": "$_id.servicePath"}, count: {$sum: 1} }}, {$match: {count: {$gt: 1}}}])

@fgalan
Copy link
Member Author

fgalan commented Jan 23, 2024

PR #4490

@fgalan fgalan added this to the 3.11.0 milestone Jan 23, 2024
@fgalan fgalan closed this as completed Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant