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

Add initial FML generator based on the StructureComparison code #163

Open
wants to merge 4 commits into
base: experimental
Choose a base branch
from

Conversation

brianpos
Copy link
Contributor

@brianpos brianpos commented Sep 5, 2024

I tested this to generate the R5 to R6 initial maps

@brianpos brianpos requested a review from GinoCanessa September 5, 2024 07:15
{
group.Input[0].Type = srcResourceType + srcVersion.ToRLiteral();
group.Input[1].Type = tgtResourceType + tgtVersion.ToRLiteral();
group.Extends = "Resource";
Copy link
Contributor Author

@brianpos brianpos Sep 5, 2024

Choose a reason for hiding this comment

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

I couldn't spot the routine to retrieve the Base type (i.e. all the StructureDefinition content) for the structure being processed in the resource.
(searching for DomainResource or Resource, or the other datatypes where they are for complex types)
Should I just be using _source.TryResolveByCanonicalUri()

if (_source.TryResolveByCanonicalUri(c.Source.Url, out Resource? sd))
        group.Extends = (sd as StructureDefinition)?.cgBaseTypeName();

Copy link
Contributor

Choose a reason for hiding this comment

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

In the StructureComparison object (c, I believe at this point in the code), there are references to the Source and Target StructureDefinition resources subject to comparison.

In each of the structures, there is the function to get the base type (cgBaseTypeName).

In DefinitionCollection, there are a few functions you could use - I would probably lean towards TryGetStructure.

If we want a collapsed convenience function to do both, I would be fine with that (e.g., cgBaseTypeStructure).

continue;

// Filter out any backbone element props
var backboneElementProps = new[] { "id", "extension", "modifierExtension" };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There has to be a better way to locate if the property isn't from the differential (and thus not required at this level in the resource)

Copy link
Contributor

Choose a reason for hiding this comment

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

Today there is a function in ElementDefinitionExtensions, cgIsInherited which tells you whether an element is inherited or not, based on the path.

The function will work well in this scenario (all core definitions), but I have a note to update it for profile detection.

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

Successfully merging this pull request may close these issues.

2 participants