Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/bdc skeleton #42

Closed
wants to merge 38 commits into from
Closed

Feature/bdc skeleton #42

wants to merge 38 commits into from

Conversation

ruchita-nathani
Copy link
Contributor

I have created a basic structure for the BDC feature. This structure comprises the following components:

  • Two methods are used in the data collector class for data collection only.
  • The "get_data_from_csv()" method is used to retrieve information from a CSV file and utilize it in the Google API.
  • The "get_data_from_api()" method is used to retrieve the necessary information from the API by utilizing the data from the CSV file and extracting specific information that we need for the predictor. This relevant data is then stored in a JSON file.
  • The given_data file is the CSV file that has already been provided, and the collected_data file will be filled with the data collected from the API.
  • Currently, I have used a dummy API to obtain the data.

dirkriehle and others added 30 commits October 14, 2023 20:51
Added Branching Strategy in README.md
One of the deliverables for Sprint 1 is the planning document in PDF Format.
Signed-off-by: Felix Zailskas <[email protected]>
Signed-off-by: Felix Zailskas <[email protected]>
Added technology and Repository tools. Issue: #3.
…ecture

Add documentation regarding the software architecture
Fixing the licensing issues created by PRs
added impediments screenshot
…mentation

added the documentation for pull requests in file Contribution.md
Fix the logo so that only the correct version (dark / light) gets displayed.
Overview over possible features we want to add to our Base Data Collector (BDC)
The dynamic media source was still not working, but now it should
Copy link
Collaborator

@luccalb luccalb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Just a few minor adjustments.

# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2023 Ruchita Nathani <[email protected]>
import csv
import requests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add requests package to the dependencies in Pipfile. You can do so by running pipenv install requests in bash.

def get_data_from_csv():
"""Retrieve information from the CSV file and utilize it in the Google API"""
data = []
with open('../data/given_data.csv', 'r', encoding='utf8') as file:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relative path will result in a FileNotFoundError if it's run from anywhere else than inside /BDC/src/. I suggest using absolute paths:

Suggested change
with open('../data/given_data.csv', 'r', encoding='utf8') as file:
file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../data/given_data.csv')
with open(file_path, 'r', encoding='utf8') as file:

if response.status_code == 200:
data = response.json()

with open("../data/collected_data.json", "w") as json_file:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Suggested change
with open("../data/collected_data.json", "w") as json_file:
file_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '../data/collected_data.json')
with open(file_path, "w") as json_file:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants