Git Product home page Git Product logo

encyclo-flower's Introduction

Solving problems is fun.

Software development is lifelong learning. The learning never stops.

Personal Favorite Technologies

Python FastAPI Flask JavaScript Bootstrap

Postgres MongoDB

Docker Kubernetes Google Cloud

Git GitHub GitHub Actions

Shell Script Ubuntu Kali Alpine Linux

About Me

I'm a self-taught software developer from Israel, open source enthusiast, who loves the field of SW development.
For each problem I face, simple or complex, I will have to break it down into smaller manageable units, and solved the pieces one by one, according to the design, plan, and requirements. The feeling I get after solving a problem and providing the solution is the feeling of accomplishment and enlightenment. This gives me the motivation and confidence to continue learning and improving my skills.
My passion to OSS tools and solutions comes from the idea it is built on (anyone can contribute), and the community which supports it (anyone can help). Social networking with world-class developers is PRICELESS!.

What I Do

Mainly I do backend development, cloud DevOps and data schema design. Most of my solutions are cloud-based infrastructure and services (especially GCP) and can be in various platforms, like VMs, Kubernetes, containers (Docker), serverless, and managed services. I mostly enjoy coding in Python, JavaScript, and SQL.
The Linux ecosystem so powerful and versatile, building on top of it is great and easy.
My specialty is building REST APIs, bots and ETL processes, and DBs design (data perspective).

My Skills

Programming languages: Python, JavaScript, SQL, Shell, HTML, CSS.
Python packages for APIs: Flask and FastAPI.
Container: Docker, Kubernetes, and other cloud-based solutions.
Serverless: GCP Functions, AWS Lambda, OpenFaaS and Knative.
Cloud services And infrastructure: GCP and a bit of AWS.
Database: Postgres, MSSQL, Oracle, MongoDB, Redis, Prometheus, some experience with Firebase and ElasticSearch.
Queues/Messaging: RabbitMQ, Kafka and Cloud Pub/Sub.
Scheduling: Apache Airflow (Python-based).
CI/CD: Github actions.
Source control: Git and Github.
Monitoring: Grafana and Alertmanager.
Infrastructure provisioning and server configuration: Cloud APIs, Terraform and Ansible.

What I'm Learning

Currently, I'm learning distributed SW (OSS tools and blockchain) and advanced Linux management and configuration.

encyclo-flower's People

Contributors

dependabot[bot] avatar idanyosef1 avatar lgtm-com[bot] avatar ofersadan85 avatar ohad24 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

encyclo-flower's Issues

Dependabot can't access secrets and fails pull request tests

This error prevents any tests from Dependabot to pass (Dependabot can't access secrets)
I can try to fix this by splitting Dependabot workflows from the others (Will improve CI)
let me know if you want me to work on this

The error in Dependabot PR:

Error: google-github-actions/auth failed with: the GitHub Action workflow must specify exactly one of "workload_identity_provider" or "credentials_json"! If you are specifying input values via GitHub secrets, ensure the secret is being injected into the environment. By default, secrets are not passed to workflows triggered from forks, including Dependabot.

API should fail gracefully

API should fail gracefully in any of these conditions:

  • MONGO_URI is not set or the connection fails
  • GOOGLE_APPLICATION_CREDENTIALS is not set or the file doesn't exist or the storage itself isn't available

To fail gracefully is to continue working but to return error messages as replies to API calls

We've discussed it a lot, the issue with google storage is already being worked on in #17 in tests (but should also not be an issue in a working API instance without tests).

I suggest to keep this issue open to track this and as a reminder, but it's not urgent

This is for several reasons that aren't related to dependabot as in #16 or pytest in #17 :

  • Docker image creation fails without a clear error indicating what the problem is, hard to debug
  • Test/dev environments are more difficult to setup quickly (even if unrelated to running tests)
  • At the very minimum, a "hello world" function that doesn't require extra resources shouldn't fail when un-needed resources aren't available, this will be easier to scale-up in the future (if the API is split between servers with different resources, for example)

Suggested fix: minimize packages in requirements.txt

The reason why we have so many package conflicts (as shown by dependabot pull requests) is beacuse the requirements.txt is too specific about packages we don't care about (because of pip freeze)

src/api/requirements.txt should only contain packages that we explicitly need for the api and pip should resolve the dependencies automatically. We will receive less dependabot pull requests and all of them will be 100% relevant. Another advantage is that no "dev" packages (black for example) are needed for the api docker image. If we need "dev" packages, they should be in another requirements.txt in the root of the repository

If it seems ok to you I suggest I will minimize src/api/requirements.txt as much as possible (the minimal version that passes all tests)

Double loading of json data in scripts/load_db_data.py

  1. This script loads to a local mongodb and also to an external mongodb URI, it should instead only load to the URI (so we can decide if it's only local or not based on the environment variable).
  2. scripts/plant_data_17_02_2022.json is hardcoded and will need to be changed if test data changes, it's better to setup loading of all *.json files in this folder

Missing jq package from server

When recreating the server the latest problem was that metadata wasn't being fetched because of missing dependency jq - it must be added to the required apt packages in the ansible playbook

Conflicting versions of pip packages

There are several dependencies in src/api/requirements.txt that are conflicting with one another

To replicate, run this on a new clone of the repository:

git clone [email protected]:ohad24/encyclo-flower.git
cd encyclo-flower
python3.10 -m venv venv
source venv/bin/activate
pip install --upgrade -r src/api/requirements.txt

Example error 1:

ERROR: Cannot install -r src/api/requirements.txt (line 25) and cachetools==5.0.0 because these package versions have conflicting dependencies.

The conflict is caused by:
The user requested cachetools==5.0.0
google-auth 2.3.3 depends on cachetools<5.0 and >=2.0.0

I fixed the above by changing google-auth==2.3.3 to google-auth>=2.3.3 (which installed version 2.6.0)
I fixed a similar issue with black==21.9b0 by installing black==22.1.0
After those 2 fixes the install went off perfectly.

Suggestion 1: Update versions in src/api/requirements.txt
Suggestion 2: Set up automatic pull request for newer package versions - this will also fix security issues with older packages that are not being updated regularly

Let me know if you want me to work on one of these suggestions

Refactoring prepare_search_query

I can't test it yet but the easiest approach would be something like this:

def prepare_search_query(search_input) -> dict:
    query_and = []
    for attribute in dir(search_input):
        value = getattr(search_input, attribute, None)
        if attribute.startswith('_') or value is None:
            continue
        elif attribute == 'name_text':
            query_and.append(prepare_query_plant_name_text(search_input.name_text))
        elif attribute == 'location_names':
            for location_name in search_input.location_names:
                query_and.append({"locations.location_name": location_name})
        elif isinstance(value, bool):
            query_and.append({attribute: value})
        elif isinstance(value, str):
            query_and.append({attribute: {"$in": value}})

    if not query_and:
        raise HTTPException(
            status_code=400,
            detail="must supply at least one parameter",
        )
    query = {"$and": query_and}
    return query

However this can also be improved in the 'search_input' object itself, but I was unable to locate where it's coming from or where it's class is defined

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.