pmsi_plus / src /ingest /load_data.py
basilefuchs's picture
feat cache
fb6ade0
Raw
History Blame Contribute Delete
356 Bytes
import streamlit as st
import polars as pl
import requests
GRIST_URL = "https://grist.numerique.gouv.fr/o/dim-chu-brest/api/docs/5ZXqTKBiHTD2qqUj6GVPtp"
@st.cache_data
def load_grist(table: str)->pl.DataFrame:
records = requests.get(f"{GRIST_URL}/tables/{table}/records").json()["records"]
return pl.DataFrame(records).drop("id").unnest("fields")