pacificclimate / wx-files-service

0 stars 0 forks source link

Index with file datestamp if metadata unavailable #19

Open jameshiebert opened 3 years ago

jameshiebert commented 3 years ago

The file parsing script theoretically relies on metadata information inside the file header (split by " | "). There have been rare cases where this information isn't available, and the only thing that is actually used is the file creation date. This could be obtained from the filesystem (e.g. os.path.getctime()).

Use the filesysystem as a fallback source of metadata if it's not available within the file.

Yes, that's why I named them like that. But we could just do something like

parts = line.split(" | ")
try:
    location_part = parts[0]
except:
    # ...

try:
    creation_date_part = parts[3]
except:
    # ...

_Originally posted by @rod-glover in https://github.com/pacificclimate/wx-files-service/pull/18#discussion_r742286725_