Code Monkey home page Code Monkey logo

Comments (15)

AirLoren avatar AirLoren commented on September 25, 2024

I would suggest the following data model :

{
"model":{
"manufacturer": "Dell",
"name": "R740",
"type": "rack",
"year": 2020
},
"configuration": {
"cpu":{
"units": 2,
"core_units": 24
"die_size": 0.245,
"manufacturer": "Intel",
"manuf_date":"2018",
"model": "",
"cpu_family":
},
"ram": [
"0":{
"units":4,
"capacity": 32,
"density":"1.79",
"manufacturer": "Samsung",
"manuf_date":"2018",
"model": "",
"integrator": "Corsaire"
},
"1":{
"units":4,
"capacity": 16,
"density":"1.79",
"manufacturer": "Hynix",
"manuf_date":"2018",
"model": "",
"integrator": "Corsaire"
}
],
"disk":[
"0":{
"units":2,
"type":"ssd",
"capacity":400,
"density": 50.6,
"manufacturer": "Samsung",
"manuf_date":"2018",
"model": ""
},
"1":{
"units":2,
"type":"hdd",
"capacity":1000,
"manufacturer": "Seagate",
"manuf_date":"2016",
"model": ""
}
],
"power_supply":{
"units":2,
"unit_weight": 10
}
}
add-method:
add-date:
}

from boaviztapi.

benjaminlebigot avatar benjaminlebigot commented on September 25, 2024

Here is my suggestion as welll :

{
  "model": {
    "manufacturer": "Dell",
    "name": "R740",
    "type": "rack",
    "year": 2020
  },
  "configuration": {
    "cpu": {
      "units": 2,
      "core_units": 24,
      "die_size": 0.245,
      "manufacturer": "Intel",
      "manuf_date": "2018",
      "model": "",
      "cpu_family": ""
    },
    "ram": [
      {
        "0": {
          "units": 4,
          "capacity": 32,
          "density": "1.79",
          "manufacturer": "Samsung",
          "manuf_date": "2018",
          "model": "",
          "integrator": "Corsaire"
        }
      },
      {
        "1": {
          "units": 4,
          "capacity": 16,
          "density": "1.79",
          "manufacturer": "Hynix",
          "manuf_date": "2018",
          "model": "",
          "integrator": "Corsaire"
        }
      }
    ],
    "disk": [
      {
        "0": {
          "units": 2,
          "type": "ssd",
          "capacity": 400,
          "density": 50.6,
          "manufacturer": "Samsung",
          "manuf_date": "2018",
          "model": ""
        }
      },
      {
        "1": {
          "units": 2,
          "type": "hdd",
          "capacity": 1000,
          "manufacturer": "Seagate",
          "manuf_date": "2016",
          "model": ""
        }
      }
    ],
    "power_supply": {
      "units": 2,
      "unit_weight": 10
    }
  },
  "add-method": "",
  "add-date": ""
}

from boaviztapi.

benjaminlebigot avatar benjaminlebigot commented on September 25, 2024

New suggestion :

{
    "model": {
      "manufacturer": "Dell",
      "name": "R740",
      "type": "rack",
      "year": 2020
    },
    "configuration": {
      "cpu": {
        "units": 2,
        "core_units": 24,
        "die_size": 0.245,
        "manufacturer": "Intel",
        "manuf_date": "2018",
        "model": "",
        "cpu_family": ""
      },
      "ram": [
        {
          "units": 4,
          "capacity": 32,
          "density": 1.79,
          "manufacturer": "Samsung",
          "manuf_date": "2018",
          "model": "",
          "integrator": "Corsaire"
        },
        {
          "units": 4,
          "capacity": 16,
          "density": 1.79,
          "manufacturer": "Hynix",
          "manuf_date": "2018",
          "model": "",
          "integrator": "Corsaire"
        }
      ],
      "disk": [
        {
          "units": 2,
          "type": "ssd",
          "capacity": 400,
          "density": 50.6,
          "manufacturer": "Samsung",
          "manuf_date": "2018",
          "model": ""
        },
        {
          "units": 2,
          "type": "hdd",
          "capacity": 1000,
          "manufacturer": "Seagate",
          "manuf_date": "2016",
          "model": ""
        }
      ],
      "power_supply": {
        "units": 2,
        "unit_weight": 10
      }
    },
    "add-method": "",
    "add-date": ""
  }

from boaviztapi.

benjaminlebigot avatar benjaminlebigot commented on September 25, 2024

useful for next time :

https://jsontopydantic.com/

from boaviztapi.

samuelrince avatar samuelrince commented on September 25, 2024

JSON Schema:

{
  "title": "Server",
  "type": "object",
  "properties": {
    "model": {
      "$ref": "#/definitions/ModelServer"
    },
    "configuration": {
      "$ref": "#/definitions/ConfigurationServer"
    },
    "add_method": {
      "title": "Add Method",
      "type": "string"
    },
    "add_date": {
      "title": "Add Date",
      "type": "string"
    }
  },
  "definitions": {
    "ModelServer": {
      "title": "ModelServer",
      "type": "object",
      "properties": {
        "manufacturer": {
          "title": "Manufacturer",
          "type": "string"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "type": {
          "title": "Type",
          "type": "string"
        },
        "year": {
          "title": "Year",
          "type": "string"
        }
      }
    },
    "Cpu": {
      "title": "Cpu",
      "type": "object",
      "properties": {
        "units": {
          "title": "Units",
          "type": "integer"
        },
        "core_units": {
          "title": "Core Units",
          "type": "integer"
        },
        "die_size": {
          "title": "Die Size",
          "type": "number"
        },
        "die_size_per_core": {
          "title": "Die Size Per Core",
          "type": "number"
        },
        "process": {
          "title": "Process",
          "type": "number"
        },
        "manufacturer": {
          "title": "Manufacturer",
          "type": "string"
        },
        "manufacture_date": {
          "title": "Manufacture Date",
          "type": "string"
        },
        "model": {
          "title": "Model",
          "type": "string"
        },
        "family": {
          "title": "Family",
          "type": "string"
        }
      }
    },
    "Ram": {
      "title": "Ram",
      "type": "object",
      "properties": {
        "units": {
          "title": "Units",
          "type": "integer"
        },
        "capacity": {
          "title": "Capacity",
          "type": "integer"
        },
        "density": {
          "title": "Density",
          "type": "number"
        },
        "process": {
          "title": "Process",
          "type": "number"
        },
        "manufacturer": {
          "title": "Manufacturer",
          "type": "string"
        },
        "manufacture_date": {
          "title": "Manufacture Date",
          "type": "string"
        },
        "model": {
          "title": "Model",
          "type": "string"
        },
        "integrator": {
          "title": "Integrator",
          "type": "string"
        }
      }
    },
    "Disk": {
      "title": "Disk",
      "type": "object",
      "properties": {
        "units": {
          "title": "Units",
          "type": "integer"
        },
        "type": {
          "title": "Type",
          "type": "string"
        },
        "capacity": {
          "title": "Capacity",
          "type": "integer"
        },
        "density": {
          "title": "Density",
          "type": "number"
        },
        "manufacturer": {
          "title": "Manufacturer",
          "type": "string"
        },
        "manufacture_date": {
          "title": "Manufacture Date",
          "type": "string"
        },
        "model": {
          "title": "Model",
          "type": "string"
        }
      }
    },
    "PowerSupply": {
      "title": "PowerSupply",
      "type": "object",
      "properties": {
        "units": {
          "title": "Units",
          "type": "integer"
        },
        "unit_weight": {
          "title": "Unit Weight",
          "type": "number"
        }
      }
    },
    "ConfigurationServer": {
      "title": "ConfigurationServer",
      "type": "object",
      "properties": {
        "cpu": {
          "$ref": "#/definitions/Cpu"
        },
        "ram": {
          "title": "Ram",
          "type": "array",
          "items": {
            "$ref": "#/definitions/Ram"
          }
        },
        "disk": {
          "title": "Disk",
          "type": "array",
          "items": {
            "$ref": "#/definitions/Disk"
          }
        },
        "power_supply": {
          "$ref": "#/definitions/PowerSupply"
        }
      }
    }
  }
}

from boaviztapi.

bertrandkeller avatar bertrandkeller commented on September 25, 2024

J'essaye d'utiliser Eleventy pour constituer mon objet à exploiter.

Je ne sais pas comment stocker au mieux les fichiers "inventaire", je réfléchis pour le moment ça donne
server
└── nom-serveur-1.json
└── nom-serveur-2.json

from boaviztapi.

da-ekchajzer avatar da-ekchajzer commented on September 25, 2024

Surement la meilleure manière en effet.
On réfléchit à supporter des CSV en entré, mais ça sera sûrement quand on s'attaquera à une vue système d'information.
Si tu veux un exemple qui fonctionne sur la version qu'on sort cet aprem : #6 (comment)

L'exemple suit le modèle ci-dessus

from boaviztapi.

bertrandkeller avatar bertrandkeller commented on September 25, 2024

On peut aussi construire un CSV avec des intitulés sous cette forme : configuration:cpu:number

On peut utiliser ce package NPM pour convertir en format structuré :
https://www.npmjs.com/package/treeize

from boaviztapi.

bertrandkeller avatar bertrandkeller commented on September 25, 2024

Ce qui impliquerait quand même de travail en priorité sur un fichier unique avec plein de serveurs, plutôt que plein de fichiers éclatés.

Pour le CSV, ça donnerait un truc comme ça :

"model:brand","model:name","model:type","model:year","configuration:cpu:number","configuration:cpu:core_number","configuration:cpu:die","configuration:cpu:manufacturer","configuration:cpu:model","configuration:cpu:cpu_family","configuration:ram:capacity","configuration:ram:quantity","configuration:ram:die","configuration:ram:manufacturer","configuration:ram:model","configuration:ram:cpu_family","configuration:ssd:capacity","configuration:ssd:quantity","configuration:ssd:die","configuration:ssd:manufacturer","configuration:ssd:model","configuration:hdd:number","configuration:hdd:manufacturer","configuration:hdd:model","configuration:power_supply:weight","configuration:power_supply:quantity"
"Dell","R740","rack",2020,2,24,0.245,"Intel","",,32,12,1.79,"Samsung","","Corsaire",400,1,50.6,"Samsung","",0,"Samsung","",10,1

from boaviztapi.

bertrandkeller avatar bertrandkeller commented on September 25, 2024

Ma lib node n'a pas l'air d'aimer les double quote sur les champs. Donc, ça marche mieux sans double quote.
J'arrive à récupérer le JSON associé.

Si fichier json dans un répertoire, j'envoie le contenu de ce json pour la requête ;
Si csv présent dans le répertoire, je converti le csv, et je m'en sers pour la requête.

Mais l'accès au serveur de test a l'air de ne plus marcher.

model:brand,model:name,model:type,model:year,configuration:cpu:number,configuration:cpu:core_number,configuration:cpu:die,configuration:cpu:manufacturer,configuration:cpu:model,configuration:cpu:cpu_family,configuration:ram:capacity,configuration:ram:quantity,configuration:ram:die,configuration:ram:manufacturer,configuration:ram:model,configuration:ram:cpu_family,configuration:ssd:capacity,configuration:ssd:quantity,configuration:ssd:die,configuration:ssd:manufacturer,configuration:ssd:model,configuration:hdd:number,configuration:hdd:manufacturer,configuration:hdd:model,configuration:power_supply:weight,configuration:power_supply:quantity
Dell,R740,rack,2020,2,24,0.245,Intel,,,32,12,1.79,Samsung,,Corsaire,400,1,50.6,Samsung,,0,Samsung,,10,1

from boaviztapi.

da-ekchajzer avatar da-ekchajzer commented on September 25, 2024

Hum on a publié ce matin dessus la V0.
Si tu veux voir la doc tu as des exemples de JSON qui fonctionnent bien :
http://149.202.185.115/API/server_route/

from boaviztapi.

da-ekchajzer avatar da-ekchajzer commented on September 25, 2024

Tu as une issue dédié ici => #14

from boaviztapi.

bertrandkeller avatar bertrandkeller commented on September 25, 2024

Ok,

J'obtiens bien le résultat. Je continuerai la semaine prochaine.

J'ai donc script Node. Qui fonctionne avec eleventy et que je dois paramétrer pour fonctionner avec goHugo.
Il génère un objet pour eleventy ou peut écrire un fichier JSON pour Hugo.

Il faut ajouter une colonne au CSV pour avoir le nom de serveur. Ensuite. suffira de savoir ce que je fais avec ces données.

J'ai les informations en entrée que je peux exploiter ; plus celle de l’API que je peux afficher aussi.
Une petite liste de serveurs avec leur impact (plus le total :: la somme de tous).

C'est quoi exactement : gwp, pe, adp ?

from boaviztapi.

da-ekchajzer avatar da-ekchajzer commented on September 25, 2024
Quels sont les principaux indicateurs environnementaux considérés ?
Potentiel d’épuisement des ressources abiotiques : ADP (Abiotic Depletion Potential) évalue l'utilisation de minéraux et de matières premières fossiles. L’expression “ressources abiotiques” désigne des ressources non vivantes telles que le sol, l'eau, l'air et les minéraux.Unité : cet indicateur est exprimé en kg d'équivalents d'antimoine (kgSbeq). L'antimoine (symbole Sb) étant l’élément chimique utilisé comme unité de référence pour quantifier une consommation de matière première dans une analyse de cycle de vie.Certaines études différencient les impacts liés aux ressources minérales (ADPe ou ADPelement) et ceux liés aux ressources fossiles (ADPf ou ADPfossils)
Potentiel de gaz à effet de serre : GWP (Global Warming Potential) évalue l'effet sur le réchauffement de la planèteUnité : cet indicateur est exprimé en kilogramme d'équivalents de dioxyde de carbone (kgCO2eq).
Consommation de ressources énergétiques (renouvelables + non renouvelables) : PE (Primary Energy)Unité : cet indicateur est exprimé mégajoules (MJ)

from boaviztapi.

da-ekchajzer avatar da-ekchajzer commented on September 25, 2024

je passe nos discussion sur => #14 pour avoir l'historique

from boaviztapi.

Related Issues (20)

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.