<jupyter_start><jupyter_text>read the json files and fill Laptime table<jupyter_code>import json
import os

tracks = {}
for t in Track.objects.all():
    tracks[str(t.rsr_id)] = t
cars = {}
for c in Car.objects.all():
    cars[str(c.rsr_id)] = c

for track_rsr_id in os.listdir('rsr_stats'):
    with open('rsr_stats/' + track_rsr_id + '/times.json') as fp:
        times = json.load(fp)
    for car_rsr_id, seconds in times.items():
        l, created = Laptime.objects.get_or_create(
            track = tracks[track_rsr_id],
            car = cars[car_rsr_id],
            defaults={'seconds': seconds})
        if not created:
            l.seconds = seconds
            l.save()
    print("{0} done...".format(track_rsr_id))
l = Laptime.objects.all()[0]
l.seconds, l.id
# l.seconds = 100000
# l.save()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14354066985645933, 'fraction_numerical': 0.009569377990430622, 'mean_word_length': 2.8930232558139535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '74740', 'license': 'MIT', 'n_tokens_mistral': 314, 'n_tokens_neox': 306, 'n_words': 66, 'path': 'devstuff/rsr_put_into_db.ipynb', 'repo_name': 'abecede753/acracers', 'size': '836'}