Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from datetime import datetime
  2. from million.analyze.find_holes import compute_sequences, find_holes
  3. from million.view.bar_chart import plot as bar_chart
  4. from million.analyze.count_participations import count_participations
  5. from million.analyze.retain_counts import retain_counts
  6. from million.parse.fb_exports import FacebookExportParser
  7. DATA_PATH = './data/'
  8. parser = FacebookExportParser()
  9. export = parser.parse(DATA_PATH)
  10. filtered = retain_counts(export.messages)
  11. sequences = compute_sequences(filtered)
  12. actual_counted = sum([s.end - s.start for s in sequences])
  13. print(f"Actual counted: {actual_counted}")
  14. holes = find_holes(filtered)
  15. print(len(holes))
  16. for hole in holes:
  17. print(f"{hole.start} - {hole.end} ({hole.end - hole.start})")
  18. # lets export a csv file of the holes and the people responsible for them
  19. with open('holes.csv', 'w') as f:
  20. f.write('début,fin,taille,responsable1,responsable2,date1,date2\n')
  21. for hole in holes:
  22. date_start = datetime.utcfromtimestamp(
  23. hole.start_message.timestamp_ms / 1000.0).strftime('%Y-%m-%d %H:%M:%S')
  24. date_end = datetime.utcfromtimestamp(
  25. hole.end_message.timestamp_ms / 1000.0).strftime('%Y-%m-%d %H:%M:%S')
  26. f.write(
  27. f"{hole.start},"
  28. f"{hole.end},"
  29. f"{hole.end - hole.start},"
  30. f"{hole.start_message.sender_name},"
  31. f"{hole.end_message.sender_name},"
  32. f"{date_start},{date_end}\n"
  33. )