Skip to content

Commit

Permalink
small fix to ensure filtered_dict does not generate in every run
Browse files Browse the repository at this point in the history
  • Loading branch information
xehu committed Oct 8, 2024
1 parent bf762d0 commit 1dad080
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions-feature_dict.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
cd src
cd team_comm_tools
python feature_dict.py
python feature_dict.py run
- name: Package Lambda function
run: |
Expand Down
14 changes: 10 additions & 4 deletions src/team_comm_tools/feature_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from flask import Flask, jsonify
import json
import sys

app = Flask(__name__)

Expand Down Expand Up @@ -607,10 +608,15 @@
}
}

keys_to_keep = ["columns", "file", "level", "semantic_grouping", "description", "references", "wiki_link"]
def generate_filtered_dict():

filtered_dict = {feature_name: {key: value for key, value in feature_data.items() if key in keys_to_keep}
keys_to_keep = ["columns", "file", "level", "semantic_grouping", "description", "references", "wiki_link"]

filtered_dict = {feature_name: {key: value for key, value in feature_data.items() if key in keys_to_keep}
for feature_name, feature_data in feature_dict.items()}
with open('./filtered_dict.json', 'w') as json_file:
json.dump(filtered_dict, json_file, indent=4)

with open('./filtered_dict.json', 'w') as json_file:
json.dump(filtered_dict, json_file, indent=4)
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == 'run':
generate_filtered_dict()

0 comments on commit 1dad080

Please sign in to comment.