langrenn-sprint / event-service

Backend service to adminster events, will generate racelists etc
Apache License 2.0
0 stars 0 forks source link

Ved innlasting av 2023-fil: Det har oppstått en feil - ('Error - 500: Number of passed names did not match number of header fields in the file.',). #113

Closed stigbd closed 1 year ago

stigbd commented 1 year ago

Frå loggen:

{ "message": "Number of passed names did not match number of header fields in the file", "exc_info": 'Traceback (most recent call last):\n File "/usr/local/lib/python3.10/site-packages/aiohttp_middlewares/error.py", line 210, in middleware\n return await handler(request)\n File "/usr/local/lib/python3.10/site-packages/aiohttp/web_urldispatcher.py", line 954, in _iter\n resp = await method()\n File "/app/event_service/views/contestants.py", line 157, in post\n result = await ContestantsService.create_contestants(\n File "/app/event_service/services/contestants_service.py", line 233, in create_contestants\n df = pd.read_csv(\n File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 211, in wrapper\n return func(*args, *kwargs)\n File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 331, in wrapper\n return func(args, kwargs)\n File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 950, in read_csv\n return _read(filepath_or_buffer, kwds)\n File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 605, in _read\n parser = TextFileReader(filepath_or_buffer, kwds)\n File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1442, in init\n self._engine = self._make_engine(f, self.engine)\n File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1753, in _make_engine\n return mapping[engine](f, self.options)\n File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 79, in init\n self._reader = parsers.TextReader(src, kwds)\n File "pandas/_libs/parsers.pyx", line 547, in pandas._libs.parsers.TextReader.cinit\n File "pandas/_libs/parsers.pyx", line 777, in pandas._libs.parsers.TextReader._get_header\nValueError: Number of passed names did not match number of header fields in the file', "severity": "ERROR", "serviceContext": {"service": "event-service"}, }

stigbd commented 1 year ago

Det var fleire feil her:

Då gikk det betre, og endte opp med en stk duplikat:

Opprettet 760 av 761 deltakere. Duplikater (1):

  • contestant: {'first_name': 'Pia Boye', 'last_name': 'Refsnes', 'birth_date': '12.09.2012', 'gender': 'K', 'ageclass': 'J 11 år', 'region': None, 'club': 'Oslo Skikrets', 'event_id': '0ee2558a-46c2-4831-847a-eb472576c9b9', 'email': 'Koll, IL - Ski', 'team': 'orefsnes@gmail.com', 'minidrett_id': None, 'id': '9f54ff09-9079-450a-b67b-8209f98f65b0', 'bib': None, 'distance': 'sprint fri', 'seeding_points': None}
stigbd commented 1 year ago

Tiltak: Utfør betre validering av input-fil slik at det er mulig å gi meir fornuftig feilmeldinger til bruker.

stigbd commented 1 year ago

Vil bli fiksa i #114