Team
TeamDataSchema
Bases: DataFrameModel
A panderas.DataFrameModel for team information.
Provider-specific team identifier fields are added before validation during TeamSyncableContent.validate_data_schema().
competition_id and season_id must be provided when using TeamSyncEngine.use_competition_context.
Source code in src/glass_onion/team.py
competition_id = Field(nullable=False, coerce=True)
class-attribute
instance-attribute
The competition the team is competing in. This is assumed to be universally unique across the TeamSyncableContent objects provided to TeamSyncEngine.
season_id = Field(nullable=False, coerce=True)
class-attribute
instance-attribute
The season of the competition that the team is competing in. This is assumed to be universally unique across the TeamSyncableContent objects provided to TeamSyncEngine.
team_name = Field(nullable=False)
class-attribute
instance-attribute
The name of the team.
TeamSyncEngine
Bases: SyncEngine
A subclass of SyncEngine to use for team objects.
See synchronize_pair()[glass_onion.team.TeamSyncEngine.synchronize_pair] for methodology details.
Source code in src/glass_onion/team.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
__init__(content, use_competition_context=False, verbose=False)
Creates a new TeamSyncEngine object. Setting use_competition_context adds competition_id and season_id (assumed to be universal across all data providers) to join_columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
list[str]
|
a list of SyncableContent objects. |
required |
use_competition_context
|
bool
|
should the competition context (IE: columns |
False
|
verbose
|
bool
|
a flag to verbose logging. This will be |
False
|
Source code in src/glass_onion/team.py
synchronize_pair(input1, input2)
Synchronizes two TeamSyncableContent objects.
Methodology
- Attempt to join pair simply on
team_name. - With remaining records, attempt to match via cosine similarity using a minimum threshold of 75% similarity.
- For any remaining records, attempt to match via cosine similarity using no minimum similarity threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input1
|
SyncableContent
|
a TeamSyncableContent object from |
required |
input2
|
SyncableContent
|
a TeamSyncableContent object from |
required |
Returns:
| Type | Description |
|---|---|
SyncableContent
|
If |
SyncableContent
|
If |
SyncableContent
|
If both dataframes are non-empty, returns a new TeamSyncableContent object with synchronized identifiers from |
Source code in src/glass_onion/team.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
TeamSyncableContent
Bases: SyncableContent
A subclass of SyncableContent to use for team objects.
Source code in src/glass_onion/team.py
validate_data_schema()
Checks if this object's data meets the schema requirements for this object type. See TeamDataSchema for more details.
Raises:
| Type | Description |
|---|---|
SchemaError
|
if |
Returns:
| Type | Description |
|---|---|
bool
|
True, if |