Last active
December 23, 2023 21:05
-
-
Save tlentali/c5e33f872b693152d35a689bb7702b92 to your computer and use it in GitHub Desktop.
app org json place orga streamlite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"repas_bacalan": { | |
"schedule_start": "2022-08-30 12:00", | |
"schedule_end": "2022-08-30 14:00", | |
"place": { | |
"parc_peixotto": { | |
"address": "Cr de la Libération, 33400 Talence, france", | |
"lat": 44.8048, | |
"lon": -0.5954, | |
} | |
}, | |
"people": [ | |
"Jonathan Louedec", | |
"Thomas lentali" | |
], | |
"tag": ["friend"], | |
"legal": 0, | |
"done": 0, | |
}, | |
"afterwork_bacalan": { | |
"schedule_start": "2022-08-30 18:00", | |
"schedule_end": "2022-08-30 19:00", | |
"place": { | |
"halles bacalan": { | |
"address": "10 Quai de Bacalan, 33300 Bordeaux, france", | |
"lat": 44.857172, | |
"lon": -0.560936, | |
} | |
}, | |
"people": [ | |
"Julien Robio", | |
"Jonathan Louedec", | |
"Thomas lentali" | |
], | |
"tag": ["friend"], | |
"legal": 0, | |
"done": 0, | |
}, | |
"margaux_louis_2_ans": { | |
"schedule_start": "2022-09-04 14:00", | |
"schedule_end": "2022-09-04 17:00", | |
"place": { | |
"parc_peixotto": { | |
"address": "Cr de la Libération, 33400 Talence, france", | |
"lat": 44.8048, | |
"lon": -0.5954, | |
} | |
}, | |
"people": [ | |
"Romain Savidan", | |
"Laura Salabert", | |
"Jonathan Louedec", | |
"Virginie Dore", | |
"Louis Savidan", | |
"Margaux Savidan", | |
"Martin Louedec", | |
"Justin Louedec", | |
"Pascaline Camblong", | |
"Thomas lentali" | |
], | |
"tag": ["birthday", "friend", "baby"], | |
"legal": 1, | |
"done": 0, | |
}, | |
"lanzarote": { | |
"schedule_start": "2022-09-07 15:15", | |
"schedule_end": "2022-09-14 22:35", | |
"place": { | |
"bordeaux_billi_airport": { | |
"departure": "2022-09-07 15:15", | |
"arrival": "2022-09-14 22:35", | |
"address": "aeroport de bordeaux-merignac, 33700 merignac, france", | |
"lat": 44.8305, | |
"lon": -0.7103, | |
}, | |
"lanzarote_airport": { | |
"arrival": "2022-09-07 17:35", | |
"departure": "2022-09-14 18:20", | |
"address": "Lanzarote Airport (ACE), Arrecife Ciudad, s/n, 35500 Arrecife, Las Palmas, Spain", | |
"lat": 28.950438, | |
"lon": -13.605777, | |
}, | |
"car_rental": { | |
"car_rental_booking_number": "275184", | |
"pick-up": "In airport : Payless Cars counter", | |
"car_rental_address": "Av. las Bajas, 61-15, 35558 Caleta de Famara, Las Palmas, Spain", | |
"lat": 29.11528, | |
"lon": -13.54837, | |
}, | |
"lanzasurf": { | |
"address": "Calle Chirimoya 15 35558 Urb. Famara - 35558 Lanzarote", | |
"lat": 29.11528, | |
"lon": -13.54837, | |
"phone": "+34 697 238 115", | |
}, | |
}, | |
"people": ["Pascaline Camblong", "Thomas lentali"], | |
"tag": ["visit", "travel", "surf", "yoga"], | |
"legal": 1, | |
"done": 0, | |
}, | |
"marrakech": { | |
"schedule_start": "2022-09-15 21:50", | |
"schedule_end": "2022-09-20 23:10", | |
"people": ["Pascaline Camblong", "Thomas lentali"], | |
"place": { | |
"bordeaux_billi_airport": { | |
"departure": "2022-09-15 21:50", | |
"arrival": "2022-09-20 23:10", | |
"address": "aeroport de bordeaux-merignac, 33700 merignac, france", | |
"lat": 44.8305, | |
"lon": -0.7103, | |
}, | |
"marrakech_menara_airport": { | |
"arrival": "2022-09-15 23:25", | |
"departure": "2022-09-20 19:35", | |
"address": "marrakech menara airport, mhamid airoport, marrakech 40000, maroc", | |
"lat": 31.6046, | |
"lon": -8.0211, | |
}, | |
}, | |
"tag": ["visit", "travel"], | |
"legal": 0, | |
"done": 0, | |
}, | |
"mariage_ab_marion": { | |
"schedule_start": "2022-10-08 14:30", | |
"schedule_end": "2022-10-09 14:00", | |
"place": { | |
"mairie_bruges": { | |
"address": "Domain du grand Darnal, 54 rue Louis Fleuranceau, 33520 Bruges", | |
"lat": 44.884878, | |
"lon": -0.60661, | |
"schedule_start": "2022-10-08 14:30", | |
"schedule_end": "2022-10-08 16:00", | |
}, | |
"chateau_lafitte": { | |
"address": "Chateau Lafitte, chemin du Loup, 33370 Yvrac", | |
"lat": 44.878837, | |
"lon": -0.481069, | |
"schedule_start": "2022-10-08 17:00", | |
"schedule_end": "2022-10-09 14:00", | |
}, | |
}, | |
"people": [ | |
"Hanrifani Aboudou", | |
"Marion Legarrec", | |
"Pascaline Camblong", | |
"Angelina Pidash", | |
"Kevin Barreau", | |
"Nicolas R", | |
"Joseph Bitar", | |
"Alexandre Cortes", | |
"Valentin Monfeuga", | |
"Antho", | |
"Thomas lentali", | |
], | |
"tag": ["wedding", "friend", "mimse"], | |
"legal": 1, | |
"done": 0, | |
}, | |
"london": { | |
"schedule_start": "2022-10-17 10:20", | |
"schedule_end": "2022-10-20 19:55", | |
"object": "Bibi and Orianne birthday", | |
"people": [ | |
"Claire Grenier", | |
"Orianne Kessler", | |
"Pascaline Camblong", | |
"Thomas Grimaud", | |
"Vanessa Prr", | |
"Solene Barbotin", | |
"Thomas lentali", | |
], | |
"place": { | |
"airbnb": { | |
"address": "1 Somers Close, Londres, NW1 1RT", | |
"lat": 51.533329, | |
"lon": -0.131433, | |
"schedule_start": "2022-10-17 12:00", | |
"schedule_end": "2022-10-20 12:00", | |
}, | |
"bordeaux_billi_airport": { | |
"departure": "2022-10-17 10:20", | |
"arrival": "2022-10-20 19:55", | |
"address": "bordeaux-mérignac airport, 33700 mérignac, france", | |
"lat": 44.8305, | |
"lon": -0.7103, | |
}, | |
"london_standsted_airport": { | |
"arrival": "2022-10-17 11:00", | |
"departure": "2022-10-20 17:15", | |
"address": "Stansted Airport London (STN), Stansted, Essex CM24 1QW, UK", | |
"lat": 51.8894, | |
"lon": 0.2615, | |
}, | |
"Palace Theatre - Harry Potter and the Cursed Child" : { | |
"schedule_start": "2022-10-19 14:00", | |
"schedule_end": "2022-10-19 19:00", | |
"address": "Palace Theatre - 109-113, Shaftesbury Ave", | |
"lat": 51.512728, | |
"lon": -0.129978, | |
}, | |
"Afternoon tea - Mr Fogg's House of Botanicals" : { | |
"website": "https://www.mr-foggs.com/house-of-botanicals/", | |
"phone": "020 7590 5256", | |
"address": "48 Newman Street, Fitzrovia, London W1T 1QQ", | |
"lat": 51.518878, | |
"lon": -0.136565, | |
}, | |
"Junkyard Golf Club" : { | |
"website": "https://www.junkyardgolfclub.co.uk/london/", | |
"address": "88 Worship St, London EC2A 2BE", | |
"lat": 51.522313, | |
"lon": -0.082285, | |
}, | |
"Afternoon tea - The Orangery" : { | |
"website": "https://kensingtonpalacepavilion.co.uk/", | |
"phone": "+44 20 3166 6114", | |
"address": "Kensington Palace, Kensington Gardens, London W8 4PX", | |
"lat": 51.505198, | |
"lon": -0.188046, | |
}, | |
"Old Spitalfields Market" : { | |
"address": "16 Commercial St, London E1 6EW", | |
"lat": 51.519801, | |
"lon": -0.075656, | |
}, | |
"Backyard Market" : { | |
"address": "146 Brick Ln, London E1 6QL", | |
"lat": 51.521150, | |
"lon": -0.072140, | |
}, | |
"The Brick Lane Vintage Market" : { | |
"address": "85 Brick Ln, London E1 6QL", | |
"lat": 51.521039, | |
"lon": -0.072032, | |
}, | |
"sherlock house" : { | |
"address": "183 North Gower Street Bloomsbury London NW1 2NJ", | |
"lat": 51.526433, | |
"lon": -0.137222, | |
}, | |
"boolay crepes" : { | |
"address": "25 Earlham St, London WC2H 9LD", | |
"lat": 51.513767, | |
"lon": -0.126641, | |
}, | |
"milk train" : { | |
"address": "12 Tavistock St, London WC2E 7PH", | |
"lat": 51.511409, | |
"lon": -0.121424, | |
}, | |
"how matcha cafe" : { | |
"address": "47 Blandford St, London W1U 7HQ", | |
"lat": 51.517968, | |
"lon": -0.154633, | |
}, | |
"heddon street kitchen" : { | |
"address": "9 Heddon St, London W1B 4BE", | |
"lat": 51.510722, | |
"lon": -0.139405, | |
}, | |
}, | |
"tag": ["visit", "friend", "travel", "family", "theater"], | |
"legal": 1, | |
"done": 0, | |
}, | |
"london_new_year": { | |
"schedule_start": "2022-12-29 00:00", | |
"schedule_end": "2023-01-01 00:00", | |
"people": ["Pascaline Camblong", | |
"Thomas lentali", | |
"Sebastien Pommiers", | |
"Guillaume Castex", | |
"Delphine Reau", | |
"Thomas Ros", | |
"Jihane Benissou" | |
], | |
"place": { | |
"bordeaux_billi_airport": { | |
"departure": "2022-09-15 21:50", | |
"arrival": "2022-09-20 23:10", | |
"address": "aeroport de bordeaux-merignac, 33700 merignac, france", | |
"lat": 44.8305, | |
"lon": -0.7103, | |
}, | |
"harry potter studio" : { | |
"address": "Abbots Langley, WD25 7LR, United Kingdom", | |
"lat": 51.691086, | |
"lon": -0.418244, | |
}, | |
}, | |
"tag": ["visit", "travel", "friend"], | |
"legal": 0, | |
"done": 0, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"fiancaille_severine_louis": { | |
"schedule_start": "2022-08-05 19:30", | |
"schedule_end": "2022-08-07 18:00", | |
"place": { | |
"camblong_family": { | |
"address": "7 avenue du Général de Gaulle, Résidence de France, Bâtiment Normandie, 64000 Pau", | |
"lat": 43.301551, | |
"lon": -0.35741, | |
} | |
}, | |
"people": [ | |
"Jean-Marc Lefèvre", | |
"Valerie Lefèvre-Seguin", | |
"Thibault Lefèvre", | |
"Anna Buccio", | |
"Augustin Lefèvre", | |
"Céline Barral", | |
"Marguerite Lefèvre", | |
"Michael Uttaro", | |
"Pascaline Camblong", | |
"Louis Lefèvre", | |
"Séverine Camblong", | |
"Noel Camblong", | |
"Martine Camblong", | |
"Thomas lentali", | |
], | |
"tag": ["family", "montain", "wedding", "restaurant"], | |
"legal": 1, | |
"done": 1, | |
}, | |
"surf_lacanau": { | |
"schedule_start": "2022-08-15 13:30", | |
"schedule_end": "2022-08-15 15:30", | |
"place": { | |
"lacanau_surf_club": { | |
"address": "20 Bd de la Plage, 33680 Lacanau", | |
"lat": 45.003586, | |
"lon": -1.201379, | |
"people": [ | |
"Liliana 'Lili'" | |
], | |
} | |
}, | |
"people": [ | |
"Pascaline Camblong", | |
"Thomas lentali", | |
], | |
"tag": ["surf"], | |
"legal": 1, | |
"done": 1, | |
}, | |
"surf_biscarosse": { | |
"schedule_start": "2022-06-28 13:00", | |
"schedule_end": "2022-06-28 15:30", | |
"place": { | |
"kiwi_surf": { | |
"address": "rue des échassiers 40600 Biscarrosse Plage", | |
"lat": 44.452898, | |
"lon": -1.251988, | |
} | |
}, | |
"people": [ | |
"Pascaline Camblong", | |
"Thomas lentali", | |
], | |
"tag": ["surf"], | |
"legal": 1, | |
"done": 1, | |
}, | |
"marius_bordeaux": { | |
"schedule_start": "2022-08-14 18:00", | |
"schedule_end": "2022-08-14 20:30", | |
"place": { | |
"darwin magazin general": { | |
"address": "87 Quai des Queyries Bâtiment Nord, 33100 Bordeaux", | |
"lat": 44.849132, | |
"lon": -0.560816, | |
} | |
}, | |
"people": [ | |
"Marius Siaud", | |
"Morgan", | |
"Pascaline Camblong", | |
"Thomas lentali", | |
], | |
"tag": ["family", "drink"], | |
"legal": 1, | |
"done": 1, | |
}, | |
"movie bullet train": { | |
"schedule_start": "2022-08-16 19:15", | |
"schedule_end": "2022-08-16 21:20", | |
"place": { | |
"bordeaux ugc cine cite": { | |
"address": "15 Rue Georges Bonnac, 33000 Bordeaux", | |
"lat": 44.8405, | |
"lon": -0.581993, | |
} | |
}, | |
"people": [ | |
"Yannick Caillaud", | |
"David Tran", | |
"Pascaline Cambling", | |
"Thomas lentali" | |
], | |
"tag": ["cinema", "movie", "friend"], | |
"legal": 1, | |
"done": 1, | |
}, | |
"afterwork bibi": { | |
"schedule_start": "2022-08-18 19:00", | |
"schedule_end": "2022-08-18 22:30", | |
"place": { | |
"pub_oxford_arms": { | |
"address": "9 Pl. des Martyrs de la Résistance, 33000 Bordeaux", | |
"lat": 44.841698, | |
"lon": -0.584, | |
} | |
}, | |
"people": [ | |
"Claire Grenier", | |
"Fabrice Verschaeve", | |
"Orianne Kessler", | |
"Thomas Grimaud", | |
"Pascaline Cambling", | |
"Thomas lentali" | |
], | |
"tag": ["drink", "friend", "food", "pub"], | |
"legal": 1, | |
"done": 1, | |
}, | |
"bnp": { | |
"schedule_start": "2022-08-23 12:15", | |
"schedule_end": "2022-08-23 13:00", | |
"place": { | |
"bnp_tourny": { | |
"address": "10 Allees de Tourny, 33000 Bordeaux", | |
"lat": 44.842982, | |
"lon": -0.575281, | |
"phone": "05 56 01 43 10", | |
} | |
}, | |
"object": "Agency welcome appointment", | |
"people": ["Florence Syre", "Thomas lentali"], | |
"tag": ["bank", "appointment", "money"], | |
"legal": 1, | |
"done": 0, | |
"canceled": 1 | |
}, | |
"paris": { | |
"schedule_start": "2022-08-24 18:34", | |
"schedule_end": "2022-08-28 19:44", | |
"place": { | |
"gare_bordeaux": { | |
"address": "gare de bordeaux saint-jean, rue charles domercq, bordeaux, france", | |
"lat": 44.8264, | |
"lon": -0.556, | |
"departure": "2022-08-24 18:34" | |
}, | |
"severine_flat": { | |
"address": "43 rue de la Folie Regnault 75011 Paris", | |
"lat": 48.859793, | |
"lon": 2.386472, | |
"code": "43B11;2210B" | |
}, | |
"gare_montparnasse": { | |
"address": "gare montparnasse, 17 boulevard de vaugirard, 75741 paris, france", | |
"lat": 48.841, | |
"lon": 2.3203, | |
"departure": "2022-08-28 19:44" | |
}, | |
"tiger sugar bubble tea": { | |
"address": "29 Rue du Roi de Sicile, 75004 Paris, france", | |
"lat": 48.856487, | |
"lon": 2.35718, | |
"done": 0, | |
}, | |
"mitterand vibes - Bibliotheque François-Mitterrand": { | |
"address": "Quai François Mauriac, 75706 Paris, france", | |
"lat": 48.830006, | |
"lon": 2.376847, | |
"done": 1, | |
}, | |
"mitterand vibes - Opera Bastille": { | |
"address": "Pl. de la Bastille, 75012 Paris, france", | |
"lat": 48.852745, | |
"lon": 2.369496, | |
"done": 1, | |
}, | |
"mitterand vibes - Institut du monde arabe": { | |
"address": "1 Rue des Fosses Saint-Bernard, 75005 Paris, france", | |
"lat": 48.848415, | |
"lon": 2.354723, | |
"done": 1, | |
}, | |
"mitterand vibes - Grande Arche de la Defense": { | |
"address": "1 Parvis de la Defense, 92800 Puteaux, france", | |
"lat": 48.892106, | |
"lon": 2.238144, | |
"done": 0, | |
}, | |
"mitterand vibes - Monument des Droits de l'Homme": { | |
"address": "1 Parvis de la Defense, 92800 Puteaux, france", | |
"lat": 48.855134, | |
"lon": 2.301112, | |
"done": 0, | |
}, | |
"mitterand vibes - Les Deux Plateaux": { | |
"address": "2 Rue de Montpensier, 75001 Paris, france", | |
"lat": 48.863899, | |
"lon": 2.33655, | |
"done": 1, | |
}, | |
"moto - Vintage Motors Bastille": { | |
"address": "8 Bis Bd Richard-Lenoir, 75011 Paris, france", | |
"lat": 48.860902, | |
"lon": 2.372836, | |
"done": 1, | |
}, | |
"moto - Vintage Motors Etoile": { | |
"address": "36 Av. de la Grande Armee, 75017 Paris, france", | |
"lat": 48.875336, | |
"lon": 2.290132, | |
"done": 0, | |
}, | |
"resto indian - desi road": { | |
"address": "14 Rue Dauphine, 75006 Paris, france", | |
"lat": 48.855642, | |
"lon": 2.340028, | |
"done": 0, | |
}, | |
"Village de l'Inde: { | |
"address": "148 Rue de la Pompe, 75116 Paris, france", | |
"lat": 48.869125, | |
"lon": 2.282124, | |
"done": 1, | |
}, | |
"laetitia_flat": { | |
"address": "10 Rue Philibert-Delorme, 75017 Paris, france", | |
"lat": 48.887683, | |
"lon": 2.302161, | |
"code": "*4237#, | |
}, | |
"festival_silhouette_courts_metrages": { | |
"address": "5 Av. Debidour, 75019 Paris, france", | |
"lat": 48.881564, | |
"lon": 2.397164, | |
"people": [ | |
"Cecile Maugere", | |
"Matthieu Blanchard", | |
"Yohann Propin", | |
"Thomas Lentali" | |
], | |
}, | |
"comptoir_general": { | |
"address": "84 Quai de Jemmapes, 75010 Paris, france", | |
"lat": 48.872467, | |
"lon": 2.364943, | |
"people": [ | |
"Severinne Camblong", | |
"Pascaline Camblong", | |
"Louis Lefevre", | |
"Thomas Lentali" | |
], | |
}, | |
"maliparmi": { | |
"address": "73 Rue des Saints-Pères, 75006 Paris, france", | |
"lat": 48.852986, | |
"lon": 2.329582, | |
"people": [ | |
"Alexandra", | |
"Pascaline Camblong", | |
"Thomas Lentali" | |
], | |
}, | |
"soubies_family": { | |
"address": "3 Rue Albert Lecocq 94170 Le Perreux-sur-Marne, france", | |
"lat": 48.834188, | |
"lon": 2.504068, | |
"people": [ | |
"Alexandra", | |
"Julie Soubies", | |
"Magui", | |
"Leon", | |
"Malot", | |
"Pascaline Camblong", | |
"Thomas Lentali" | |
], | |
}, | |
}, | |
"people": [ | |
"Pascaline Camblong", | |
"Laetitia Pecorari", | |
"Lydie", | |
"Cecile Maugere", | |
"Matthieu Blanchard", | |
"Severinne Camblong", | |
"Louis Lefevre" | |
"Thomas lentali", | |
], | |
"tag": ["visit", "travel", "friend", "family"], | |
"legal": 1, | |
"done": 1, | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import july | |
import datetime | |
import folium | |
import ast | |
def get_event(df: pd.DataFrame, event:str): | |
return df[df['name'] == event].reset_index(drop=True) | |
def get_every_busy_day(df): | |
df['schedule_start'] = pd.to_datetime(df['schedule_start'], format="%Y-%m-%d %H:%M") | |
df['schedule_end'] = pd.to_datetime(df['schedule_end'], format="%Y-%m-%d %H:%M") | |
# Generate a series of Timedeltas for each row | |
n = ( | |
(df['schedule_end'].dt.normalize() - df['schedule_start'].dt.normalize()) | |
.apply(lambda d: [pd.Timedelta(days=i) for i in range(d.days+1)]) | |
.explode() | |
).rename('day_number') | |
df = df.join(n) | |
# Adjust the begin and end of each row | |
adjusted_begin = np.max([ | |
df['schedule_start'], | |
df['schedule_start'].dt.normalize() + df['day_number'] | |
], axis=0) | |
adjusted_end = np.min([ | |
df['schedule_end'], | |
pd.Series(adjusted_begin).dt.normalize() + pd.Timedelta(days=1, milliseconds=-100) | |
], axis=0) | |
# Final assembly | |
df = df.assign(begin_=adjusted_begin, end_=adjusted_end) | |
return df | |
def build_full_df(df): | |
first = True | |
for event in df['name'].unique(): | |
df_event = get_event(df, event) | |
df_test = get_every_busy_day(df_event) | |
if first: | |
df_res = df_test | |
first = False | |
else: | |
df_res = df_res.append(df_test, ignore_index=False) | |
df_res['hour_spent'] = (df_res['end_'] - df_res['begin_']).astype('timedelta64[h]') | |
df_res['percent_hour'] = np.floor(df_res['hour_spent'] * 100 / 23) | |
## exagerate hour percent to be seen more clearly in plot | |
df_res['percent_hour'] = np.where(df_res['percent_hour'] <= 50, 50, df_res['percent_hour']) | |
df_res = df_res.reset_index(drop=True) | |
return df_res | |
def get_people(df: pd.DataFrame): | |
return df['people'].explode().unique() | |
def get_place(df: pd.DataFrame): | |
return df['place'].explode().unique() | |
def get_event_place(df: pd.DataFrame): | |
return pd.DataFrame(df['place'].values[0]).T.reset_index().rename(columns={'index': 'name'}) | |
def get_event_between_dates(df: pd.DataFrame, date_start:str, date_end:str): | |
return df[(df['schedule_start'] >= date_start) & (df['schedule_end'] <= date_end)] | |
def get_map(df: pd.DataFrame): | |
map = folium.Map(location=[df["lat"].mean(), df["lon"].mean()], control_scale=True) | |
for index, location_info in df.iterrows(): | |
folium.Marker([location_info["lat"], location_info["lon"]], popup=location_info["name"]).add_to(map) | |
sw = df[['lat', 'lon']].min().values.tolist() | |
ne = df[['lat', 'lon']].max().values.tolist() | |
map.fit_bounds([sw, ne]) | |
return map | |
def plot_calendar(df: pd.DataFrame): | |
july.calendar_plot(df['begin_'], df['percent_hour'], cmap="july", date_label=True, weeknum_label=False) | |
with open('org.json') as f: | |
r=f.read() | |
res = ast.literal_eval(r) | |
df = pd.DataFrame(res).T | |
df = df.reset_index() | |
df = df.rename(columns={'index': 'name'}) | |
df = df.sort_values(by='schedule_start') | |
# full data | |
df_full = build_full_df(df) | |
plot_calendar(df_full) | |
df_full.groupby('name')['schedule_start'].count() | |
get_event_between_dates(df_full, '2022-08-23', '2022-10-21') | |
# focus on event | |
df_event = get_event(df_full, 'lanzarote') | |
peolpe = get_people(df_event) | |
place = get_place(df_event) | |
plot_calendar(df_event) | |
df_event_places = get_event_place(df_event) | |
get_map(df_event_places) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import pandas as pd | |
import numpy as np | |
import ast | |
import function | |
from streamlit_folium import st_folium | |
st.set_option('deprecation.showPyplotGlobalUse', False) | |
st.title('Org') | |
DATA_FILE = ('data_org.json') | |
def read_json_file(path: str): | |
with open(DATA_FILE) as f: | |
return f.read() | |
@st.cache | |
def load_data(): | |
res = ast.literal_eval(read_json_file(DATA_FILE)) | |
df = pd.DataFrame(res).T | |
df = df.reset_index() | |
df = df.rename(columns={'index': 'name'}) | |
df = df.sort_values(by='schedule_start') | |
return df | |
data = load_data() | |
df_full = function.build_full_df(data) | |
st.pyplot(function.plot_calendar(df_full)) | |
st.subheader('Json data') | |
st.json(read_json_file(DATA_FILE), expanded=False) | |
option = st.selectbox( | |
'Event :', data['name'].unique()) | |
df_event = function.get_event(df_full, option) | |
st.pyplot(function.plot_calendar(df_event)) | |
st.subheader('**People involved**:') | |
# st.markdown(function.get_people(df_event)) | |
# st.code(function.get_people(df_event)) | |
lst = function.get_people(df_event) | |
s = '' | |
for i in lst: | |
s += "- " + i + "\n" | |
st.markdown(s) | |
st.subheader('**Places**:') | |
df_event_places = function.get_event_place(df_event) | |
st_folium(function.get_map(df_event_places)) | |
st.write(function.get_event_place(df_event)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment