Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create file parsing schema #71

Open
lboeman opened this issue Dec 16, 2020 · 1 comment
Open

Create file parsing schema #71

lboeman opened this issue Dec 16, 2020 · 1 comment

Comments

@lboeman
Copy link
Contributor

lboeman commented Dec 16, 2020

We'll need a schema to communicate how to parse data from a file upload depending on what level the user provides data, e.g. system level weather or inverter level weather.

I think this will require a system-breakdown mapping and a file-header-to-variable mapping like:

Simple file-header-to-variable mapping:

{
  "file_header": "some_csv_header",
  "variable": "ghi",
}

System-breakdown describes what part of the system spec relates to what data, with a general structure that matches the System spec

{ 
  "name": "<name of system>",
  "object_type": "system",
  "mappings": [..],
  "children": [ {
     "name": "<name of inverter>", // maybe just use index.
     "object_type": "inverter",
     "mappings": [..]
     "children": [{
       "name": "<name of array>",
       "object_type": "array",
       "mappings": [...],
     },..]
   },..]
}

Example mapping for system-level data

{
  "name": "System A",
  "object_type": "system",
  "mappings": [{
      "file_header": "some_csv_header",
      "variable": "ghi",
    },
    {... },
  ]
}

Example mapping for inverter-level data

{
  "name": "System A",
  "object_type": "system",
  "mappings": [ ],
  "children": [
     {
        "name": "Inverter 1",
        "object_type": "inverter",
        "mappings: [
          {
             "file_header": "some_csv_header",
             "variable": "ghi",
          }
         ]
     },
     {...},
  ]
}
@lboeman
Copy link
Contributor Author

lboeman commented Jan 8, 2021

It now seems like a simple mapping of schema location to mapping object will be more appropriate. Something like

{
   "/inverters/0": {
     "time": "t",
     "ghi": "global",
     "dni": "direct",
      ...
  }
}

This is what the dashboard is using for performing the mapping from user uploaded csv to the data expected by the api. Perhaps for saving a mapping we store it along with the system id and original file name so the user has an idea of what it was originally used for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant