swerik-project / pyriksdagen

MIT License
0 stars 0 forks source link

Handle dates better loading Corpus class #2

Closed BobBorges closed 6 months ago

BobBorges commented 7 months ago

Previously MPs with NA in the start or end cols were dropped while loading metadata via load_Corpus_metadata(). This fix tries to infer a missing date on the fly by the parliament year.

ninpnin commented 6 months ago

I would expect we already have this functionality somewhere in the code.

BobBorges commented 6 months ago

We have increase_date_precision() which will give you back a full date (either start/end or riksdag year, or 01-01 / 12-31) from an incomplete date, but it does nothing to an NA. The added function gets you back a likely end date from a start date if end is NA and vice-versa.

ninpnin commented 6 months ago

Could we refactor the functionality under the same function?

MansMeg commented 6 months ago

I think that would probably be better.

ninpnin commented 6 months ago

@BobBorges do we use the previous functionality somewhere? I.e. is a flag for handling NAs or not necessary?

BobBorges commented 6 months ago

The new functionality stops mps with incomplete start/end dates from getting dropped. I can't imagine why we would want to drop them, so i didn't put a flag, but I could.

ninpnin commented 6 months ago

Ok 👍 let's keep it this way then