prosesslogg module¶
- apply_edits(df, filepath_log, app_timestamp)¶
Apply a set of logged edits to a DataFrame in a vectorized manner.
This function updates rows in df based on edit records from a log Each edit specifies a target column (colId), a new value (value), and the target row identified by a UUID found inside logg[‘data’].
Only edits with a timestamp later than app_timestamp are applied. If multiple edits exist for the same (uuid, colId) combination, the most recent one (latest row in logg) is kept.
- Parameters:
df (pandas.DataFrame) – The original DataFrame containing the data to be updated. Must include a ‘uuid’ column identifying rows uniquely.
filepath_logg (filepath for logg created by ssb-dash-framework)
app_timestamp (datetime) – Only edits with a timestamp greater than this value are applied.
Returns
-------
pandas.DataFrame – A copy of df with all applicable edits applied.
Notes
-----
operations. (- Updates are applied efficiently using vectorized pandas)
(uuid (- Duplicate)
occurrence. (colId) edits are resolved by keeping the last)
unchanged. (- Rows in df without matching uuids remain)
copy. (- This function does not modify df in place; it returns an edited)
filepath_log (str)
- Return type:
DataFrame