-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: start on EU and US CSL mappers
- Loading branch information
Showing
2 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package csl | ||
|
||
import ( | ||
"strings" | ||
"time" | ||
|
||
"github.com/moov-io/watchman/pkg/csl" | ||
"github.com/moov-io/watchman/pkg/search" | ||
) | ||
|
||
func PtrToEntity(record *csl.EUCSLRecord) search.Entity[csl.EUCSLRecord] { | ||
if record != nil { | ||
return ToEntity(*record) | ||
} | ||
return search.Entity[csl.EUCSLRecord]{} | ||
} | ||
|
||
func ToEntity(record csl.EUCSLRecord) search.Entity[csl.EUCSLRecord] { | ||
out := search.Entity[csl.EUCSLRecord]{ | ||
Source: search.SourceEUCSL, | ||
SourceData: record, | ||
} | ||
|
||
if strings.EqualFold(record.EntitySubjectType, "person") { | ||
out.Type = search.EntityPerson | ||
out.Person = &search.Person{} | ||
|
||
if len(record.NameAliasWholeNames) > 0 { | ||
out.Name = record.NameAliasWholeNames[0] | ||
out.Person.Name = record.NameAliasWholeNames[0] | ||
out.Person.AltNames = record.NameAliasWholeNames[1:] | ||
} | ||
if len(record.BirthDates) > 0 { | ||
tt, err := time.Parse("2006-01-02", record.BirthDates[0]) | ||
if err == nil { | ||
out.Person.BirthDate = &tt | ||
} | ||
} | ||
} | ||
|
||
return out | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
package mapper | ||
|
||
import ( | ||
"github.com/moov-io/watchman/pkg/csl" | ||
"github.com/moov-io/watchman/pkg/search" | ||
) | ||
|
||
// Entity List – Bureau of Industry and Security | ||
func EL_ToEntity(record csl.EL) search.Entity[csl.EL] { | ||
out := search.Entity[csl.EL]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
// out.Type = // TODO(adam): | ||
|
||
// record.AlternateNames []string // TODO(adam): | ||
// record.Addresses []string // TODO(adam): | ||
|
||
return out | ||
} | ||
|
||
// Military End User List | ||
func MEU_ToEntity(record csl.MEU) search.Entity[csl.MEU] { | ||
out := search.Entity[csl.MEU]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// Name string `json:"name"` | ||
// Addresses string `json:"addresses"` | ||
|
||
return out | ||
} | ||
|
||
// Sectoral Sanctions Identifications List (SSI) - Treasury Department | ||
func SSI_ToEntity(record csl.SSI) search.Entity[csl.SSI] { | ||
out := search.Entity[csl.SSI]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// Addresses []string `json:"addresses"` | ||
// Remarks []string `json:"remarks"` | ||
// AlternateNames []string `json:"alternateNames"` | ||
|
||
// IDsOnRecord []string `json:"ids"` | ||
|
||
return out | ||
} | ||
|
||
// Unverified List – Bureau of Industry and Security | ||
func UVL_ToEntity(record csl.UVL) search.Entity[csl.UVL] { | ||
out := search.Entity[csl.UVL]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
// Addresses []string `json:"addresses"` | ||
|
||
return out | ||
} | ||
|
||
// Foreign Sanctions Evaders (FSE) - Treasury Department | ||
func FSE_ToEntity(record csl.FSE) search.Entity[csl.FSE] { | ||
out := search.Entity[csl.FSE]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// Type string `json:"type"` | ||
// Addresses []string `json:"addresses,omitempty"` | ||
// DatesOfBirth string `json:"datesOfBirth"` | ||
// IDs []string `json:"IDs"` | ||
|
||
return out | ||
} | ||
|
||
// Nonproliferation Sanctions (ISN) - State Department | ||
func ISN_ToEntity(record csl.ISN) search.Entity[csl.ISN] { | ||
out := search.Entity[csl.ISN]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// Remarks []string `json:"remarks,omitempty"` | ||
// AlternateNames []string `json:"alternateNames,omitempty"` | ||
|
||
return out | ||
} | ||
|
||
// Palestinian Legislative Council List (PLC) - Treasury Department | ||
func PLC_ToEntity(record csl.PLC) search.Entity[csl.PLC] { | ||
out := search.Entity[csl.PLC]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// Type string `json:"type"` | ||
// Addresses []string `json:"addresses,omitempty"` | ||
// DatesOfBirth string `json:"datesOfBirth"` | ||
// IDs []string `json:"IDs"` | ||
// Remarks []string `json:"remarks,omitempty"` | ||
|
||
return out | ||
} | ||
|
||
// CAPTA (formerly Foreign Financial Institutions Subject to Part 561 - Treasury Department) | ||
func CAP_ToEntity(record csl.CAP) search.Entity[csl.CAP] { | ||
out := search.Entity[csl.CAP]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// Type string `json:"type"` | ||
// Addresses []string `json:"addresses,omitempty"` | ||
// DatesOfBirth string `json:"datesOfBirth"` | ||
// IDs []string `json:"IDs"` | ||
// Remarks []string `json:"remarks,omitempty"` | ||
|
||
return out | ||
} | ||
|
||
// ITAR Debarred (DTC) - State Department | ||
func DTC_ToEntity(record csl.DTC) search.Entity[csl.DTC] { | ||
out := search.Entity[csl.DTC]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// AlternateNames []string `json:"alternateNames,omitempty"` | ||
|
||
return out | ||
} | ||
|
||
// Non-SDN Chinese Military-Industrial Complex Companies List (CMIC) - Treasury Department | ||
func CMIC_ToEntity(record csl.CMIC) search.Entity[csl.CMIC] { | ||
out := search.Entity[csl.CMIC]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// Type string `json:"type"` | ||
// Addresses []string `json:"addresses,omitempty"` | ||
// DatesOfBirth string `json:"datesOfBirth"` | ||
// IDs []string `json:"IDs"` | ||
// Remarks []string `json:"remarks,omitempty"` | ||
|
||
return out | ||
} | ||
|
||
// Non-SDN Menu-Based Sanctions List (NS-MBS List) - Treasury Department | ||
func NS_MBS_ToEntity(record csl.NS_MBS) search.Entity[csl.NS_MBS] { | ||
out := search.Entity[csl.NS_MBS]{ | ||
Source: search.SourceUSCSL, | ||
SourceData: record, | ||
} | ||
|
||
out.Name = record.Name | ||
|
||
// Type string `json:"type"` | ||
// Addresses []string `json:"addresses,omitempty"` | ||
// DatesOfBirth string `json:"datesOfBirth"` | ||
// IDs []string `json:"IDs"` | ||
// Remarks []string `json:"remarks,omitempty"` | ||
|
||
return out | ||
} |