-
Notifications
You must be signed in to change notification settings - Fork 5
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
Update tutorial cdm extension via selection of concepts #1035
base: main
Are you sure you want to change the base?
Update tutorial cdm extension via selection of concepts #1035
Conversation
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few clarification, what I am most surprised by is starting with subsetting and not neat.read
.
@@ -80,3 +96,83 @@ def data_model(self, concepts: str | list[str]) -> IssueList: | |||
print(f"Subset to {after} concepts.") | |||
|
|||
return issues | |||
|
|||
def core_data_model(self, concepts: str | list[str]) -> IssueList: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the thinking about placing this method here and not under neat.read.cdf.data_model.cognite_core()
? Feels strange to start a session with neat.subset
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will move under read...
@@ -1795,6 +1797,76 @@ def _convert_metadata_to_info(cls, metadata: DMSMetadata) -> "InformationMetadat | |||
) | |||
|
|||
|
|||
class _SubsetEditableCDMRules(VerifiedRulesTransformer[DMSRules, DMSRules]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not subclass SubsetDMSRules
and add a few extra validations?
For example,
class _SubsetEditableCDMRules(SubsetDMSRules):
if not_in_cognite_core := {view.external_id for view in views} - COGNITE_CORE_CONCEPTS.union(
COGNITE_CORE_FEATURES
):
raise NeatValueError(
f"Concept(s) {', '.join(not_in_cognite_core)} is/are not part of the Cognite Core Data Model. Aborting."
)
super().__init__(views)
and similar for the transform method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As two classes differ from each other. I am not dropping any of CDM views, to make sure that data model functions in UI. Though I will see if I can subclass it.
Description
Improved Extending Core Data Model tutorial, and made modification to the code base to assure fully functional data model in CDF.
Bump
Changelog
Added
...subset.data_model.core_data_model
inNeatSession
Changed