Git Product home page Git Product logo

climatemind / climatemind-backend Goto Github PK

View Code? Open in Web Editor NEW
17.0 11.0 18.0 35.17 MB

Your climate action is here 🌎 Our API is a source for learning how climate change personally affects you and the things you care about most. Additionally, it will teach a scientifically proven method for communicating to others that climate change is a personally relevant issue to inspire action.

Home Page: https://contribute.climatemind.org/v/rest-api/

License: MIT License

Python 98.33% Dockerfile 0.45% Shell 1.09% Mako 0.09% JavaScript 0.03%
flask owl-ontology climate climate-change climate-action global-warming python climate-science climatechange

climatemind-backend's People

Contributors

aicarras avatar andrew-banister avatar bengineerdavis avatar biotom avatar brianpeiris avatar cyplas avatar danmash avatar dependabot[bot] avatar dmarx avatar econaxis avatar expan75 avatar hutsonjason avatar mncharlton avatar moataz-mahmoud avatar nickcallaghan avatar ppython avatar rodriguesk avatar rolandoldengarm avatar rscarrasco avatar sabineu avatar seanmajorpayne avatar seanppayne avatar svenstar74 avatar tadakongithub avatar y-himanen avatar znurgl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

climatemind-backend's Issues

ConflictError

Sentry Issue: BACK-END-A

ConflictError: 
  File "flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "flask_limiter/extension.py", line 702, in __inner
    return obj(*a, **k)
  File "app/auth/routes.py", line 211, in register
    raise ConflictError(

Refactor user_scores endpoint to add marshmallow schema validation

Modules and functions to refactor

  • app/scoring/routes.py::user_scores

Refactor reason

The refactoring is needed to filter issues like Sentry Issue: BACKEND-G caused by an invalid request body. (the problem is what frontend sent us SetOne object with questionId > 10)

Details:
ValueError: 15 is not a valid PersonalValue
(10 additional frame(s) were not displayed)


...
  File "app/scoring/process_scores.py", line 43, in calculate_scores
    value_type = PersonalValue(question_id)
  File "enum.py", line 309, in __call__
    return cls.__new__(cls, value)
  File "enum.py", line 600, in __new__
    raise exc
  File "enum.py", line 584, in __new__
    result = cls._missing_(value)
  File "enum.py", line 613, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))

request body

{
questionResponses: {
SetOne: [
{"answerId":"2","questionId":"15"}, 
{"answerId":"4","questionId":"9"}, 
{"answerId":"2","questionId":"4"}, 
{"answerId":"2","questionId":"8"}, 
{"answerId":"4","questionId":"10"}, 
{"answerId":"3","questionId":"6"}, 
{"answerId":"3","questionId":"1"}, 
{"answerId":"4","questionId":"3"}, 
{"answerId":"3","questionId":"2"}, 
{"answerId":"2","questionId":"7"}
], 
SetTwo: [
{"answerId":"4","questionId":"15"}, 
{"answerId":"3","questionId":"19"}, 
{"answerId":"5","questionId":"14"}, 
{"answerId":"4","questionId":"18"}, 
{"answerId":"3","questionId":"20"}, 
{"answerId":"4","questionId":"16"}, 
{"answerId":"5","questionId":"11"}, 
{"answerId":"3","questionId":"13"}, 
{"answerId":"2","questionId":"12"}, 
{"answerId":"3","questionId":"17"}
]
}
}

Suggested solution

  • new marshmallow schema created to validate the request body
  • documentation (Climate-Mind_bundled.yml) updated to show 422 HTTP error

Tests

  • integration test for the endpoint OR/AND unit test for a schema

Check Windows installation

Discussed in https://github.com/ClimateMind/climatemind-backend/discussions/446

Originally posted by Nehemiah60 November 7, 2022
I am not sure but I think there should be updates on the installation guide. On my windows machine, all the containers were running but the api-1 would exit almost instantly. The log files showed the error: /usr/bin/env bash\r: No such file or directory. I had to research and the solution was to use a windows Ubuntu Subsystem to clone the repo.

Transform User B events analytics table to analytics table which contain events from both User B and User A

User story

As an analyst, I want to history log of the state changes occurring in the conversation table (when new state gets written to the conversation table, then that change should be registered as a user A event and thus make a new row in the conversations analytics table, so I know when it occurred

Acceptance criteria

  • #415
  • And any conversation state changes for user A need to be tracked in this conversation_analytics_data
  • #416

Fix services.webapp.environment.CHOKIDAR_USEPOLLING contains true, which is an invalid type, it should be a string, number, or a null

Describe the bug

I just forked the repo, and cloned it in my computer. I then proceeded to run it locally, but when I issued:

docker-compose -p climatemind-backend --profile webapp -f docker/docker-compose.yml up -d --build

it threw the following:

ERROR: The Compose file './docker/docker-compose.yml' is invalid because:
services.webapp.environment.CHOKIDAR_USEPOLLING contains true, which is an invalid type, it should be a string, number, or a null

My environment:

  • Docker 20.10.12.
  • Docker Compose 1.29.2
  • Linux Mint 21

To Reproduce

Steps to reproduce the issue:

  • cd into the project directory.
  • run the following:
docker-compose -p climatemind-backend --profile webapp -f docker/docker-compose.yml up -d --build

Expected behavior

I expected no error message from the above command.

Task

  • Check out if quoting the true literal at CHOKIDAR_USEPOLLING: true (file docker/docker-compose.yml) fixes the problem.

port 8050 not working correctly in Docker

I can't figure out what's wrong and why the following code doesn't work:

docker-compose up -d
CLIMATEMIND_ID=$(docker ps -lq)
docker exec -it $CLIMATEMIND_ID python process_new_ontology_and_visualize.py

It results in:

IDP-C02XCAGMJG5J:climatemind-backend kameronr$ CLIMATEMIND_ID=$(docker ps -lq)
IDP-C02XCAGMJG5J:climatemind-backend kameronr$ docker exec -it $CLIMATEMIND_ID python process_new_ontology_and_visualize.py
* Owlready2 * Running HermiT...
    java -Xmx500M -cp /usr/local/lib/python3.8/site-packages/owlready2/hermit:/usr/local/lib/python3.8/site-packages/owlready2/hermit/HermiT.jar org.semanticweb.HermiT.cli.CommandLine -c -O -D -I file:////tmp/tmp5k42mrmb
* Owlready2 * HermiT took 0.8050453662872314 seconds
* Owlready * (NB: only changes on entities loaded in Python are shown, other changes are done but not listed)
Name: 
Type: DiGraph
Number of nodes: 164
Number of edges: 236
Average in degree:   1.4390
Average out degree:   1.4390
get_figure! FIG IS RETURNING
Dash is running on http://127.0.0.1:8050/

 Warning: This is a development server. Do not use app.run_server
 in production, use a production WSGI server like gunicorn instead.

 * Serving Flask app "process_new_ontology_and_visualize" (lazy loading)
 * Environment: development
 * Debug mode: off
 * Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)

But then when go to that url it shows the following "This page isn't working"
Screen Shot 2020-09-21 at 12 06 01 PM

Screen Shot 2020-09-21 at 12 09 16 PM

Refactor Feed Routes & Score Nodes

Issues exist in feed.py and score_nodes.py and should be refactored. Score nodes presently uses unconventional python naming with variables in ALL_CAPS format, has a few variables that are declared and never used, and does not use dependency injection as it should. It is only used by the feed, but is located in the scoring folder so it should be relocated. Imports should be in Pep8 order & relative imports should be used when possible. Storing the climate feed into the db should not occur in this class.

Feed uses some variables in ALL_CAPS, a generalized try/except to catch multiple types of errors, and imports are not in pep8 order.Both should use Pep 287 reST formatting for docstrings

Feed & Scores Refactor

Refactor the feed routes and the score_nodes.py file.

Issues exist in feed.py and score_nodes.py and should be refactored. Score nodes presently uses unconventional python naming with variables in ALL_CAPS format, has a few variables that are declared and never used, and does not use dependency injection as it should. It is only used by the feed, but is located in the scoring folder so it should be relocated. Imports should be in Pep8 order & relative imports should be used when possible. Storing the climate feed into the db should not occur in this class.

Feed uses some variables in ALL_CAPS, a generalized try/except to catch multiple types of errors, and imports are not in pep8 order.Both should use Pep 287 reST formatting for docstrings

We're passing a quiz_uuid instead of a session_uuid to the localized graph function.

Missing zip code lead to an error in get_feed endpoint

Sentry Issue: BACKEND-D

TypeError: 'NoneType' object is not iterable
  File "app/feed/routes.py", line 59, in get_feed_results
    recommended_nodes = SCORE_NODES.get_user_nodes()
  File "app/scoring/score_nodes.py", line 138, in get_user_nodes
    self.simple_scoring()
  File "app/scoring/score_nodes.py", line 69, in simple_scoring
    localised_acyclic_graph = build_localised_acyclic_graph(self.G, self.QUIZ_UUID)
  File "app/scoring/build_localised_acyclic_graph.py", line 150, in build_localised_acyclic_graph
    lrf_single_postcode_dict = check_if_valid_postal_code(quiz_uuid)
  File "app/scoring/build_localised_acyclic_graph.py", line 72, in check_if_valid_postal_code
    exists_in_lrf_table = list(result.fetchone())

CustomError: 
(1 additional frame(s) were not displayed)
...
  File "flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "flask_cors/decorator.py", line 128, in wrapped_function
    resp = make_response(f(*args, **kwargs))
  File "app/feed/routes.py", line 39, in get_feed
    feed_entries = get_feed_results(quiz_uuid, N_FEED_CARDS, session_uuid)
  File "__init__.py", line 907, in decorated_function
    rv = f(*args, **kwargs)
  File "app/feed/routes.py", line 63, in get_feed_results
    raise CustomError(

As a back-end developer, I want to get the unique invite link for a user

User story

As a back-end developer, I want to get the unique invite link for a user, so I can create the new endpoint for the fronte-end team

Acceptance criteria

  • Find out the way to generate the unique the shortest URL possible for a user. (e.g. BASE_FRONTEND_URL + "/i/" + first N chars of the user.UUID)
  • The new property invite_url in Users model should be created which returns that unique link
  • The new PyTest unit test created to test this method

Pillow dependabot security update

Dependabot opened a security issue for this repo, which it can't automatically fix. There are 4 moderate-severity CVEs, all concerning the Pillow library. Since Pillow is an image library, I'm not sure if we really need it- I'm going to look at why this is being imported and how we can remove it/change the version.

Refactor URL hardcoding

What to refactor?

There are cases in the codebase when we are using hardcoding URLs to the project web app:

  • app.models.PasswordResetLink.reset_url
  • app/sendgrid/templates/reset_password.py template and usage
  • app/sendgrid/templates/user_b_shared_email.py template and usage
  • app/sendgrid/templates/welcome_email.py template and usage

Refactor reason

The refactoring is needed because we need the ability to use different URLs per environment:

Suggested solution

  • Update all configs from config.py to use the env variable with URL (this solution doesn't suitable for many production envs I suppose, but it's ok for now)

Acceptance criteria

  • missing ENV variable shouldn't lead to an error, default config value should be prod

Tests

  • manual tests
  • unit tests with mocking for the class method
  • integration tests with mocking for emails

search_node() API is not working

The API should take in any node in the ontology and then returns JSON that represents all relevant data stored in the ontology.

Currently this is what happens:
Screen Shot 2020-07-25 at 9 49 11 PM

Additionally, the error screen showing I think is also the wrong error screen? I think the error should be showing the search_node API error message if there is an issue.

climatemind-backend-master$ env FLASK_APP=climatemind.py flask run
 * Serving Flask app "climatemind.py"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [25/Jul/2020 21:29:03] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [25/Jul/2020 21:29:03] "GET /favicon.ico HTTP/1.1" 404 -
[2020-07-25 21:30:31,145] ERROR in app: Exception on /ontology [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/kameronr/Documents/personal/climate change outreach/new uploads/climatemind-backend-master/knowledge_graph/routes.py", line 21, in query
    mind = app.config["MIND"]
KeyError: 'MIND'
127.0.0.1 - - [25/Jul/2020 21:30:31] "GET /ontology?query=coal+mining HTTP/1.1" 500 -

Refactor Feed & Score Nodes

What to refactor?

  • app/scoring/score_nodes.py

Refactor reasons and solutions

  • Score nodes presently use unconventional python naming with variables in ALL_CAPS format,
  • has a few variables that are declared and never used
  • does not use dependency injection as it should.
  • it is only used by the feed but is located in the scoring folder so it should be relocated.
  • Storing the climate feed into the db should not occur in this class.
  • Feed uses some variables in ALL_CAPS, a generalized try/except to catch multiple types of errors,
  • Imports are not in pep8 order & relative imports should be used when possible
  • Both should use Pep 287 reST formatting for docstrings.
  • We're passing a quiz_uuid to a query for a session_uuid in the localized graph function and this is bad!

Tests

  • unit tests

Add tests for Documentation

What should be tested?

Due to GitHub possible issue, it would be nice to have some checks on the CI pipeline to check the documentation structure.

Test cases:

  • SUMMARY.md should contain files only from docs folder
  • all .md files should be located in docs folder
  • there are no invalid paths like docs/docs/docs... in the SUMMARY.md file
  • files are not duplicated
  • check that links in .md files are not pointing to app.gitbook.com
  • check that links in .md files are pointing to existing pages.

Documentation

after this ticket is done update the documentation
Screenshot 2022-10-16 at 10 55 24

Shared value description for 2 people, not 1

There needs to be a separate description of the personal values for when it's the description of the shared value between 2 people. Currently the copy for description for single person is used for the description of shared values. It needs to be a different copy version (one where it says β€˜you both’ instead of just β€˜you’.) See the attachment.

image

User story

As a ..., I want to ..., so I can ...

Acceptance criteria

  • This is something that can be verified to show that this user story is satisfied.

'personal value' field in networkx object is populating wrong

Details below pulled from https://www.pivotaltracker.com/story/show/174997522
Please make github branch with title beginning with 174997522 to fix this issue so the code automatically gets associated with the user story in pivotal tracker when a PR is made. Don't forget to click "start" for in the pivotal tracker story if picking up this issue!

The 'personal value' field is populated incorrectly in the networkx object of the ontology. The code must be wrong somehow. There are nodes with 'direct classes' and 'all classes' fields/keys that include specific personal value types that then are missing in the list of values under the 'personal value' field/key for that same node. see comments below for screenshot examples.

Some part of the code in make_graph.py in the function add_ontology_data_to_graph_nodes() must be adding the field 'personal value' to the networkx object and populating it with wrong values. That part of the code needs to be corrected.

def add_ontology_data_to_graph_nodes(G, onto):

David is the person who noticed this bug.

The screenshot shows the example for
IRI: "http://webprotege.stanford.edu/RLc1ySxaRs4HWkW4m5w2Me" (note this is not a real url, it's just a unique identifier for the node)
individual name: "increase in area burned by wildfire"

Notice how 'universalism' is included for the 'direct classes' and 'all classes' but missing for 'personal values' in the networkx object.

Screen Shot 2020-09-20 at 3 32 04 PM

Screen Shot 2020-09-25 at 1 29 08 PM

Screen Shot 2020-09-25 at 1 29 15 PM

User is unable to retake the quiz

Sentry Issue: BACK-END-B

IntegrityError: ('23000', '[23000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The UPDATE statement conflicted with the FOREIGN KEY constraint "fk_users__quiz_uuid__scores". The conflict occurred in database "sqldb-web-test-001", table "dbo.scores", column \'quiz_uuid\'. (547) (SQLExecDirectW)')
  File "sqlalchemy/engine/base.py", line 1276, in _execute_context
    self.dialect.do_execute(
  File "sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)

IntegrityError: (pyodbc.IntegrityError) ('23000', '[23000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The UPDATE statement conflicted with the FOREIGN KEY constraint "fk_users__quiz_uuid__scores". The conflict occurred in database "sqldb-web-test-001", table "dbo.scores", column \'quiz_uuid\'. (547) (SQLExecDirectW)')
[SQL: UPDATE users SET quiz_uuid=? WHERE users.user_uuid = ?]
[parameters: (UUID('a8d30ffc-9964-4730-af38-36aa31fb6e3b'), 'C34EAF2F-9E88-474E-9A03-EED62B5F5A5D')]
(Background on this error at: h...
(17 additional frame(s) were not displayed)
...
  File "sqlalchemy/engine/base.py", line 1316, in _execute_context
    self._handle_dbapi_exception(
  File "sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception
    util.raise_(
  File "sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "sqlalchemy/engine/base.py", line 1276, in _execute_context
    self.dialect.do_execute(
  File "sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)

DatabaseError: 
(1 additional frame(s) were not displayed)
...
  File "flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "flask_cors/decorator.py", line 128, in wrapped_function
    resp = make_response(f(*args, **kwargs))
  File "flask_jwt_extended/view_decorators.py", line 115, in decorator
    return fn(*args, **kwargs)
  File "app/scoring/routes.py", line 82, in user_scores
    process_scores.persist_scores(user_uuid, session_uuid)
  File "app/scoring/process_scores.py", line 100, in persist_scores
    raise DatabaseError(

Fix 429 Too Many Requests error in local

Describe the bug

429 Too Many Requests error appears in local

To Reproduce

set -B                  # enable brace expansion
for i in {1..300}; do
  curl --request POST \
      --url http://127.0.0.1:5000/password-reset \
      --header 'Content-Type: application/json' \
      --header 'X-Session-Id: 360bf0c5-5fb2-430f-8902-77b8041237a9' \
      --data '{
      "email": "[email protected]"
    }'
done

you will get 429 error code in some time.
Which shouldn't be the case.

Expected behavior

No error on local

Task

  • fix app.auth.routes.ip_whitelist which doesn't work on local docker environment.
  • fix correspoing unit tests

Drop flask-selfdoc

What to refactor?

Remove Autodoc from the project

Refactor reason

The refactoring is needed because it's not used, and the endpoint doesn't work.

Suggested solution

Tests

  • CI should pass

Find out the source of all countries with geocodes

Question to answer in this research

What trusted source of geo data we could use in the project? Data we need to store are

  • country name
  • country geocode (e.g. US/UK/FR)
  • postal code format
  • list of postal codes (since could require frequent updates, it's optional)

Research reason

The research is needed because we are going to handle worldwide postal codes, not the US only.

Ideas to start with

Problem hitting endpoints

When I try and hit any of the endpoints (including the one in test_posting.py, http://127.0.0.1:5000/get_user_scores), I get the attached error in the browser, and the message FileNotFoundError: [Errno 2] No such file or directory: './climate_mind_ontology'. This is the latest code from master, but running the code after cloning from scratch from 'climatemind-backend' fails because of the requirements.txt issue I described previously.
image

Problem installing pygraphviz

When I try and run 'pip install -r requirements.txt', it fails with the error: ERROR: Command errored out with exit status 1: command: /Users/ittd/climatemind-backend/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup.py'"'"'; __file__='"'"'/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-record-9cpocl9v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ittd/climatemind-backend/venv/include/site/python3.7/pygraphviz cwd: /private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/ Complete output (33 lines): running install Trying dpkg Failed to find dpkg Trying pkg-config Package libcgraph was not found in the pkg-config search path. Perhaps you should add the directory containing 'libcgraph.pc' to the PKG_CONFIG_PATH environment variable No package 'libcgraph' found Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup.py", line 93, in <module> tests_require=['nose>=1.3.7', 'doctest-ignore-unicode>=0.1.2', 'mock>=2.0.0'], File "/Users/ittd/climatemind-backend/venv/lib/python3.7/site-packages/setuptools/__init__.py", line 163, in setup return distutils.core.setup(**attrs) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup_commands.py", line 44, in modified_run self.include_path, self.library_path = get_graphviz_dirs() File "/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup_extra.py", line 162, in get_graphviz_dirs include_dirs, library_dirs = _try_configure(include_dirs, library_dirs, _pkg_config) File "/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup_extra.py", line 117, in _try_configure i, l = try_function() File "/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup_extra.py", line 72, in _pkg_config output = S.check_output(['pkg-config', '--libs-only-L', 'libcgraph']) File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 376, in check_output **kwargs).stdout File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 468, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['pkg-config', '--libs-only-L', 'libcgraph']' returned non-zero exit status 1. ---------------------------------------- ERROR: Command errored out with exit status 1: /Users/ittd/climatemind-backend/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup.py'"'"'; __file__='"'"'/private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-install-56vasmf8/pygraphviz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/3j/dq8385xs2b3gr_w7yxrqbvjr0000gs/T/pip-record-9cpocl9v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ittd/climatemind-backend/venv/include/site/python3.7/pygraphviz Check the logs for full command output.
This happens also when I try and run pip install pygraphviz

Find out a source of occupations

Question to answer in this research

For the "Occupations" milestone we need a list of occupations and sectors. Sectors could be multi-level to be able link climate impacts and actions not for a single occupation only but for sectors or subsectors.

Research reason

Ideas to start with

  • ...

As a user, I want to delete my account

User story

As a user, I want to delete my account, so I can remove all my data from the app

Acceptance criteria

  • Only the user himself could remove his account.
  • All data related to the user removed as well
  • unit test
  • documentation for the endpoint

Refactor network_x_processor

What to refactor?

  • Currently, there are plenty of loops across G.nodes list which could be optimized in some way.
  • app/network_x_tools/network_x_processor.py could be also used to do general operations with DiGraph (G) such as:
    • search.
    • get effects
    • get solutions

Refactor reason

Code duplication and PEP8

Tests

  • unit tests

Flask app doesn't run locally

I tried running the Flask app locally and it fails and gives the following error:

$ cd climatemind-backend-master
$ env FLASK_APP=climatemind.py flask run

 * Serving Flask app "climatemind.py"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
Usage: flask run [OPTIONS]

Error: While importing "climatemind", an ImportError was raised:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 240, in locate_app
    __import__(module_name)
  File "/Users/kameronr/Documents/personal/climate change outreach/new uploads/climatemind-backend-master/climatemind.py", line 1, in <module>
    from knowledge_graph import app
  File "/Users/kameronr/Documents/personal/climate change outreach/new uploads/climatemind-backend-master/knowledge_graph/__init__.py", line 5, in <module>
    from knowledge_graph import routes
  File "/Users/kameronr/Documents/personal/climate change outreach/new uploads/climatemind-backend-master/knowledge_graph/routes.py", line 7, in <module>
    from knowledge_graph.Mind import Mind
  File "/Users/kameronr/Documents/personal/climate change outreach/new uploads/climatemind-backend-master/knowledge_graph/Mind.py", line 2, in <module>
    from knowledge_graph import make_network
  File "/Users/kameronr/Documents/personal/climate change outreach/new uploads/climatemind-backend-master/knowledge_graph/make_network.py", line 3, in <module>
    from network_class import Network
ModuleNotFoundError: No module named 'network_class'

documentation problem?

When I run the backend app locally, I get the message " Running on http://0.0.0.0:5000" but then when I go to that page on my browser I get the message "This site can't be reached".
However, if I go to "http://127.0.0.1:5000" then it works. Can the app be fixed so the url mentioned in the terminal is actually the right url I need to go to? And if that can't be fixed, then can this issue at least be mentioned in the readme so other people don't struggle trying to figure out the right url to go to?

Annotation 2020-09-09 213711 API broken
Annotation 2020-09-09 213711 API
Annotation 2020-09-09 213711

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.