Skip to content

Commit

Permalink
Process IndustryClassfication concepts
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalin Arsov committed Dec 17, 2020
1 parent dcbdc89 commit 3eea0e8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions concept/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type ConcordedConcept struct {
IsDeprecated bool `json:"isDeprecated,omitempty"`
// Location
ISO31661 string `json:"iso31661,omitempty"`
// IndustryClassification
IndustryIdentifier string `json:"industryIdentifier,omitempty"`
// Source representations
SourceRepresentations []s3.Concept `json:"sourceRepresentations,omitempty"`
}
3 changes: 3 additions & 0 deletions concept/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,9 @@ func mergeCanonicalInformation(c ConcordedConcept, s s3.Concept, scopeNoteOption
if s.IssuedBy != "" {
c.IssuedBy = s.IssuedBy
}
if s.IndustryIdentifier != "" {
c.IndustryIdentifier = s.IndustryIdentifier
}
c.IsDeprecated = s.IsDeprecated
return c
}
Expand Down
39 changes: 39 additions & 0 deletions concept/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,34 @@ func TestAggregateService_GetConcordedConcept_Memberships(t *testing.T) {
assert.Equal(t, expectedConcept, c)
}

func TestAggregateService_GetConcordedConcept_IndustryClassification(t *testing.T) {
svc, _, _, _, _, _, _ := setupTestService(200, payload)
expectedConcept := ConcordedConcept{
PrefUUID: "IndustryClassification_Smartlogic_UUID",
PrefLabel: "Newspaper, Periodical, Book, and Directory Publishers",
Type: "IndustryClassification",
Aliases: []string{"Newspaper, Periodical, Book, and Directory Publishers"},
IndustryIdentifier: "5111",
SourceRepresentations: []s3.Concept{
{
UUID: "IndustryClassification_Smartlogic_UUID",
PrefLabel: "Newspaper, Periodical, Book, and Directory Publishers",
IndustryIdentifier: "5111",
Authority: "Smartlogic",
AuthValue: "IndustryClassification_Smartlogic_UUID",
Type: "IndustryClassification",
},
},
}

c, tid, err := svc.GetConcordedConcept(context.Background(), "IndustryClassification_Smartlogic_UUID", "")
sort.Strings(c.Aliases)
sort.Strings(expectedConcept.Aliases)
assert.NoError(t, err)
assert.Equal(t, "tid_359", tid)
assert.Equal(t, expectedConcept, c)
}

func TestAggregateService_ProcessMessage_Success(t *testing.T) {
svc, _, _, eventQueue, _, _, _ := setupTestService(200, payload)
err := svc.ProcessMessage(context.Background(), "28090964-9997-4bc2-9638-7a11135aaff9", "")
Expand Down Expand Up @@ -1541,6 +1569,17 @@ func setupTestServiceWithTimeout(clientStatusCode int, writerResponse string, ti
Type: "Location",
},
},
"IndustryClassification_Smartlogic_UUID": {
transactionID: "tid_359",
concept: s3.Concept{
UUID: "IndustryClassification_Smartlogic_UUID",
PrefLabel: "Newspaper, Periodical, Book, and Directory Publishers",
IndustryIdentifier: "5111",
Authority: "Smartlogic",
AuthValue: "IndustryClassification_Smartlogic_UUID",
Type: "IndustryClassification",
},
},
},
}
conceptsQueue := &mockSQSClient{
Expand Down
2 changes: 2 additions & 0 deletions s3/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ type Concept struct {
IsDeprecated bool `json:"isDeprecated,omitempty"`
// Location
ISO31661 string `json:"iso31661,omitempty"`
// IndustryClassification
IndustryIdentifier string `json:"industryIdentifier,omitempty"`
}

0 comments on commit 3eea0e8

Please sign in to comment.