diff --git a/api/scripts b/api/scripts index 44488df..657a639 160000 --- a/api/scripts +++ b/api/scripts @@ -1 +1 @@ -Subproject commit 44488dfdc8a15f4723824ce2f8f12a1ebdd0d23d +Subproject commit 657a63975325f42bd932108d7d73ddfbd04487a7 diff --git a/api/src/process_track.py b/api/src/process_track.py index d793ec7..42013f1 100644 --- a/api/src/process_track.py +++ b/api/src/process_track.py @@ -6,10 +6,8 @@ import json from obs.face.importer import ImportMeasurementsCsv from obs.face.annotate import AnnotateMeasurements -from obs.face.filter import MeasurementFilter -from obs.face.geojson import ExportMeasurements, ExportRoadAnnotation +from obs.face.filter import PrivacyFilter, ChainFilter, AnonymizationMode, RequiredFieldsFilter, ConfirmedFilter from obs.face.osm import DataSource as OSMDataSource -from obs.face.filter import PrivacyFilter log = logging.getLogger(__name__) @@ -55,19 +53,23 @@ def process(args): os.makedirs(args.output, exist_ok=True) - filename_log = os.path.join(args.output, f"{dataset_id}.log") - log.info("Annotating and filtering CSV file") - with open(filename_log, "w") as logfile: - measurements, statistics = ImportMeasurementsCsv().read( - filename_input, - user_id="dummy", - dataset_id=dataset_id, - log=logfile, - ) - measurements = AnnotateMeasurements(osm, cache_dir=args.cache_dir).annotate(measurements) - confirmed_measurements = MeasurementFilter().filter(measurements, log=logfile) - valid_measurements = MeasurementFilter(remove_unconfirmed=False).filter(measurements, log=logfile) + measurements, statistics = ImportMeasurementsCsv().read( + filename_input, + user_id="dummy", + dataset_id=dataset_id, + ) + + measurements = AnnotateMeasurements(osm, cache_dir=args.cache_dir).annotate(measurements) + + valid_measurements = ChainFilter( + RequiredFieldsFilter(), + PrivacyFilter( + user_id_mode=AnonymizationMode.REMOVE, + measurement_id_mode=AnonymizationMode.REMOVE, + ), + ).filter(measurements, log=log) + confirmed_measurements = ConfirmedFilter().filter(valid_measurements, log=log) # write out confirmed_measurements_json = {