Skip to content

Commit

Permalink
added discharge_facility to the metadata field
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaoPang committed Apr 19, 2024
1 parent 9ec2f3e commit 81604e3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/meds_etl/omop.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ def write_event_data(
end = cast_to_datetime(batch, table_name + "_end_datetime", move_to_end_of_day=True)
metadata["end"] = end

if 'discharged_to_concept_id' in batch.columns:
metadata['discharge_facility'] = (
pl.coalesce(pl.col('discharged_to_concept_id'), 0).replace(concept_id_map)
)

batch = batch.filter(code.is_not_null())

columns = {
Expand Down

0 comments on commit 81604e3

Please sign in to comment.