-
Notifications
You must be signed in to change notification settings - Fork 2
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
Display UPP identifiers in the output. Little bit of optimising query #20
Conversation
concordances/cypher.go
Outdated
NewModelIdentifiers neoIdentifier `json:"newModelIdentifiers"` | ||
OldModelTypes []string `json:"oldModelTypes"` | ||
OldModelIdentifiers neoIdentifier `json:"oldModelIdentifiers"` | ||
UUID string `json:"UUID"` |
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.
Should this be "uuid"
to be idiomatic json?
concordances/cypher.go
Outdated
OldModelIdentifiers neoIdentifier `json:"oldModelIdentifiers"` | ||
UUID string `json:"UUID"` | ||
Types []string `json:"types"` | ||
Identifiers neoIdentifier `json:"identifiers"` |
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.
Logically identifiers
would represent multiple ids? Not just one neoIdentifier
? If neoIdentifier
as a struct represents more than one id, that should be called neoIdentifiers
instead
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.
Yeah, agreed. Hangover from the previous model.
RETURN canonical.prefUUID as prefUUID, p.uuid AS UUID, labels(p) AS oldModelTypes, labels(p) AS newModelTypes, | ||
{labels:labels(ids), value:ids.value} AS oldModelIdentifiers, | ||
{labels:labels(leafId), value:leafId.value} AS newModelIdentifiers | ||
MATCH (p)-[:IDENTIFIES]-(ids:Identifier) |
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.
Is this no longer required to be a Concept
?
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.
The Concept
constraint is defined in the first line of the query, so it's not needed again.
@@ -208,6 +195,10 @@ func mapAuthorityToAuthorityProperty(authority string) string { | |||
|
|||
func mapAuthorityToIdentifierLabel(authority string) (label string) { | |||
switch authority { | |||
case UP_AUTHORITY: |
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.
This should probably be a map
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.
There's no performance improvement by changing it to a map, and I think this is slightly more readable than defining the map and then doing the lookup.
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.
Disagree - you're doing a key value lookup, which is exactly what maps exist for. Adding new mappings will require 2 lines for the constants, plus an addition to this switch statement, which is inefficient
concordances/cypher_test.go
Outdated
return expected.Concordance[i].Concept.ID < expected.Concordance[j].Concept.ID | ||
}) | ||
sort.Slice(expected.Concordance, func(i, j int) bool { | ||
sort.SliceStable(expected.Concordance, func(i, j int) bool { |
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.
Not sure I like this duplication for expected and actual concordance sorting, but can't offer an alternative (that doesn't involve implementing sort.Interface
on Concordances in 3 diff ways)
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.
I've extracted it so at least it's not repeated for both slices.
concordances/cypher_test.go
Outdated
assert.True(t, reflect.DeepEqual(expected, actual), fmt.Sprintf("Actual aggregated concept differs from expected: Test: %v \n Expected: %v \n Actual: %v", testName, expected, actual)) | ||
} | ||
|
||
func fullConcordanceSort(concordanceList []Concordance) { |
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.
This is nitpicky but fullConcordanceSort
should be simpler (i.e. sortConcordances
). Naming it full
implies theres another alternative sort func that could be used, but there isn't one.
No description provided.