Skip to content

General usage examples

Stache edited this page Jun 7, 2022 · 4 revisions

Complete pipeline

This is an example on one usage, but of course, it will mainly depends on your needs.

Load the data

import json

with open("input.json", "r") as json_file:
    data = json.load(json_file)

Parse the data

from argonodes.parsers import JSONParser

parser = JSONParser()
json_data = parser(data)

Create a Tree for exploration

from argonodes.nodes import Tree

tree = Tree(json_data)

Play with the Tree

from argonodes.appliers import DistinctValues

distinct_values = DistinctValues()

distinct_values(tree)
# or
tree.apply(distinct_values)

Create a Model from the Tree

from argonodes.models import Model

model = Model(name="My model", tree=tree)

Filter the Model

from argonodes.filters import Filter

keep_placeVisit_only = Filter(model, paths="$.timelineObjects[*].placeVisit")

keep_placeVisit_only(model)
# or
model.apply(keep_placeVisit_only)

Export the Model

from argonodes.exporters import JSONExporter

exporter = JSONExporter()

json_out = model.export(exporter)
# or
json_out = exporter(model)

Ugly working one liner

with open("input.json", "r") as json_file:
    json_out = Model(Tree(json.load(json_file))).export(exporter)

Argonodes Wiki

Tutorials

  • SOON

Usage and pipeline

  1. General usage examples
  2. Parsers: Preparation and conversion
  3. Nodes: Explore the data
  4. Appliers: Enhance the data
  5. Models: Abstract the data
  6. Filters: Filter and refine
  7. Exporters: Save your hard work!

Schemas

Argonodes

Known sources

Ressources

Clone this wiki locally