Skip to content

Commit

Permalink
Merge pull request #454 from ncihtan/gh-actions-test
Browse files Browse the repository at this point in the history
Update build-dependencies-table.yml
  • Loading branch information
aditigopalan authored Sep 10, 2024
2 parents 18d89fc + d8667dd commit 1547507
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/build-dependencies-table.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
import requests
import pandas as pd
from io import StringIO
def fetch_and_save_attribute_table():
url = "https://schematic.api.sagebionetworks.org/v1/visualize/attributes"
jsonld_url = "https://raw.githubusercontent.com/ncihtan/data-models/main/HTAN.model.jsonld"
Expand All @@ -45,17 +45,18 @@ jobs:
params = {'schema_url': jsonld_url}
print("Fetching attribute table...")
response = requests.get(url, params=params)
# Change to POST if required by the API
response = requests.post(url, params=params)
print(f"Status Code: {response.status_code}")
print(f"Response Text: {response.text[:500]}") # Print first 500 characters for review
if response.status_code == 200:
content_type = response.headers.get('Content-Type', '')
if 'text/html' in content_type:
print("Response in text/html format, converting to CSV...")
try:
df = pd.read_csv(StringIO(response.text))
print("Fetched attribute table.")
df.to_csv('HTAN.dependencies.csv', index=False)
print("Saved to HTAN.dependencies.csv.")
except Exception as e:
Expand All @@ -64,8 +65,10 @@ jobs:
print("Unexpected content type. Expected text/html but got:", content_type)
else:
print(f"Failed to fetch data. Status Code: {response.status_code}")
if __name__ == "__main__":
fetch_and_save_attribute_table()
fetch_and_save_attribute_table()
EOF
- name: Commit changes
Expand Down

0 comments on commit 1547507

Please sign in to comment.