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

[ODS-5665] Add ability to query organizations by an identification code #1166

Merged
merged 21 commits into from
Oct 25, 2024

Conversation

mjaksn
Copy link
Contributor

@mjaksn mjaksn commented Oct 17, 2024

No description provided.

private const string IdentificationCodeTableAlias = "idct";
private readonly ConcurrentDictionary<FullName, Join> _identificationCodeTableJoinByRootEntityName = new();

public IdentificationCodeAggregateQueryCriteriaApplicator(
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming conventions would indicate a name of IdentificationCodeAggregateRootQueryCriteriaApplicator here. See # 4 in Naming Conventions .

{
if (additionalParameters == null || !additionalParameters.Any() || additionalParameters.All(
ap => AggregateRootCriteriaProviderHelpers.PropertiesToIgnore.Contains(ap.Key, StringComparer.OrdinalIgnoreCase)))
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Coding conventions call for these return statements to be wrapped in { and }. Current state of the documentation isn't explicit on this point, but it is heavily implied by the Formatting section, and this would be inconsistent with the rest of the code base.

// If the entity does not have an identificationCodes collection with queryable properties, return
if (!_resourceIdentificationCodePropertiesProvider.TryGetIdentificationCodeProperties(
resource, out List<ResourceProperty> identificationCodeProperties))
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Coding conventions call for these return statements to be wrapped in { and }.

.ToArray();

if (applicableAdditionalParameters.Length == 0)
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Development standards call for these return statements to be wrapped in { and }.

// Find any supplied additionalParameters with a non-default value and name matching that of a queryable identificationCode property, if none then return
var applicableAdditionalParameters = additionalParameters
.Where(
x => !x.Value.IsDefaultValue() &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Coding conventions call for logical operators like && and || to be placed as leading on the next line, not trailing on the previous line.

_provider = new ResourceIdentificationCodePropertiesProvider();
const string ResourceName = "edfi.Calendar";

var domainModel = DomainModelDefinitionsProviderHelper.DomainModelProvider.GetDomainModel();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe put this in a [OneTimeSetUp] attributed method since it's the same model every time.

}

[Test]
public void TryFindIdentificationCodes_ShouldReturnTrueAndCorrectIdentificationCodeProperties_WhenABaseResourceHasIdentificationCode()
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename this to remove "Base" from the final name segment? Course is not really a base class, and it fits with the test above which is testing WhenResourceHasNoIdentificationCode -- maybe just use WhenResourceHasIdentificationCode?

}

[Test]
public void TryFindIdentificationCodes_ShouldReturnTrueAndCorrectIdentificationCodeProperties_WhenADerivedResourceHasIdentificationCode()
Copy link
Contributor

Choose a reason for hiding this comment

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

Definitely optional ... you could go with WhenADerivedResourceHasInheritedIdentificationCode here.

"method": "GET",
"header": [],
"url": {
"raw": "{{ApiBaseUrl}}/data/v3/ed-fi/localEducationAgencies?educationOrganizationIdentificationSystemDescriptor=uri://ed-fi.org/EducationOrganizationIdentificationSystemDescriptor%23non-existatnt",
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the spelling on non-existent...

@@ -1950,6 +1952,206 @@
"response": []
}
]
},
{
"name": "When filtering by IdentificationCode",
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like these tests could really use some negative test data (data that would show up in the results if the implementation was incorrect). For example, in a "Setup" folder create a new temporary School that has identification codes that match the value being searched but uses a different identification system. (Also add a "Teardown" folder that removes this School and use a separate subfolder in between to hold the test requests, as necessary).

So, for example, create a School with an identification code that uses uri://ed-fi.org/EducationOrganizationIdentificationSystemDescriptor#Other with a value of 255901001. This school should also be returned when only searching by identification code 255901001 but should not be returned if both the identification system and code are used in the search.

image

parameterList.Add(
new Parameter
{
name = (x.DescriptorName ?? x.PropertyName).ToCamelCase(),
Copy link
Contributor

Choose a reason for hiding this comment

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

So, I'm curious about the decision to use DescriptorName instead of the PropertyName here. The DescriptorName property actually returns the name of the descriptor entity and will in many cases be the same as the property name, but in the event that a role-name is applied, this will have the effect of stripping that. Is that what was intended here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking of entities and concerned descriptor property names could be suffixed with Id. That's not an issue with resources, so I changed it to only use PropertyName in the latest commit.

@@ -0,0 +1,98 @@
// SPDX-License-Identifier: Apache-2.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix typo in the filename.

@gmcelhanon gmcelhanon merged commit 0938d93 into main Oct 25, 2024
16 checks passed
@gmcelhanon gmcelhanon deleted the ODS-5665 branch October 25, 2024 19:41
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