GithubHelp home page GithubHelp logo

san99tiago / jsonpath-ng-experiments Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 577 KB

Multiple Python experiments for JSON Path NG library.

License: MIT License

Python 100.00%
json-schema san99tiago santiago-garcia-arango santiago-garcia-arango-developer santiago-garcia-arango-devops santiago-garcia-arango-tech jsonpath-ng

jsonpath-ng-experiments's Introduction

JSONPATH-NG-EXPERIMENTS

github-actions-badge

This repository covers multiple experiments for advanced JSON Mappers with the help of the Python library json-path-ng and a custom Mapper implementation.

Software Architecture ๐Ÿ†


Summary/Overview ๐Ÿ“œ

  • Core Python implementations on top of json-path-ng and managed with Poetry.
  • API developed with FastAPI.
  • Unit and Integration Tests for the source code with PyTest.
  • Continuous Integration on top of GitHub Actions with Code Quality Job and Unit Tests Coverage >90%.

Usage ๐Ÿ‘ป

Follow these steps to configure the project locally:

Clone the repository

First, clone the repository:

git clone https://github.com/san99tiago/jsonpath-ng-experiments
cd jsonpath-ng-experiments

Configure Python Dependencies with Poetry

To install Poetry and configure the virtual environment, please follow the steps based on your preferred install method:

After poetry tool is installed, proceed to execute:

poetry shell
poetry install

Execute locally the JSON Mapper with FastAPI

To easily run the FastAPI server, proceed with:

poe local-fastapi

Execute the JSON Mapper

Now, in your preferred tool to execute API Requests, proceed to execute the following REST-API request and inject your JSON payload to be transformed:

  • [PATCH] http://127.0.0.1:8000/quotes

Real Example Payload/Response

The Example that will be shown, is based on the current JSON Mapper configured to transform some personal quotes from one source schema into a custom destination format.

The actual mapping is configured at the file:

Example Input Payload:

{
  "miscellaneous": {
    "quotes": [
      {
        "uuid": "2008d4d2-49fd-48e4-a305-796b75953edd",
        "author": "Japanese Proverb",
        "sentence": "Discipline will sooner or later defeat intelligence",
        "score": 5,
        "details": {
          "source": "Instagram",
          "year": null
        },
        "filters": [
          {
            "quoteSentiment": "Positive",
            "quoteType": "Discipline",
            "importance": "HIGH"
          },
          {
            "quoteSentiment": "Positive",
            "quoteType": "Success",
            "importance": "LOW"
          }
        ]
      },
      {
        "uuid": "ab93c944-8c77-4e79-84e4-c78cb125f1ad",
        "author": "Alex Hormozi",
        "sentence": "The longer you delay the ask, the bigger the ask you can make",
        "score": 0,
        "details": {
          "source": "100M Offers",
          "year": 2021
        },
        "filters": []
      }
    ]
  }
}

Example JSON Response:

{
  "quotes": [
    {
      "id": "2008d4d2-49fd-48e4-a305-796b75953edd",
      "author": "Japanese Proverb",
      "quote": "Discipline will sooner or later defeat intelligence",
      "quality": "AWESOME",
      "category": "Discipline",
      "sentiment": "Positive",
      "allTypes": [
        {
          "type": "Discipline"
        },
        {
          "type": "Success"
        }
      ]
    },
    {
      "id": "ab93c944-8c77-4e79-84e4-c78cb125f1ad",
      "author": "Alex Hormozi",
      "quote": "The longer you delay the ask, the bigger the ask you can make",
      "quality": "N/A"
    }
  ]
}

Further Edits

In order to update the functionalities, please update:

Special thanks ๐Ÿป

  • I am grateful to the talented individuals who have dedicated their time and effort to develop the exceptional open-source projects that have been used in the creation of this solution.

Author ๐ŸŽน

Santiago Garcia Arango

As a curious DevOps Engineer, I am deeply passionate about implementing cutting-edge cloud-based solutions on AWS.
I firmly believe that today's greatest challenges must be solved by the expertise of individuals who are truly passionate about their work.

LICENSE

Copyright 2023 Santiago Garcia Arango, under the MIT license.

jsonpath-ng-experiments's People

Contributors

san99tiago avatar

Stargazers

 avatar

Watchers

 avatar  avatar

jsonpath-ng-experiments's Issues

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.