Skip to content

Commit

Permalink
Simplify more resource processor
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Jun 12, 2024
1 parent bd1c36d commit f2f63f1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions odds/backend/processor/resource_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,15 @@ async def process(self, resource: Resource, dataset: Dataset, catalog: DataCatal
if len(true_values) == 0:
continue
resource.fields.append(field)
field_names.append(col_name)
try:
field.sample_values = [str(x) for x, _ in Counter(true_values).most_common(10)]
if len(field.sample_values) == 1:
# if all values are the same, no need for this field in the db
continue
except:
pass
if len(values) > 0:
field_names.append(col_name)
if len(values) > 0 and len(true_values) != len(values):
field.missing_values_percent = int(100 * (len(values) - len(true_values)) / len(values))
if field.data_type in ('number', 'integer', 'date', 'time', 'datetime'):
true_values = set(true_values)
Expand Down

0 comments on commit f2f63f1

Please sign in to comment.