BEMServer / bemserver-core

https://bemserver-docs.readthedocs.io/
MIT License
3 stars 3 forks source link

Easier import location (Site, Building, Storey, Space) #228

Open scls19fr opened 4 months ago

scls19fr commented 4 months ago

Hello,

In BEMServer, locations have a hierachical form. 4 CSV files can be used to import location (site, building, storey, space) Maybe supporting YAML import should be considered as it can be a very convenient maner to populate database with sample data (in an human readable format).

---
sites:
  Site 1:
    latitude: -90
    longitude: -180
    description: AAAAAA
    ifc_id: AAAAAA
    buildings:
      Building 1:
        description: AAAAAA
        ifc_id: AAAAAA
        storeys:
          R0:
            description: AAAAAA
            ifc_id: AAAAAA
            spaces:
              ROOM 1:
                description: AAAAAA
                ifc_id: AAAAAA
              ROOM 2:
                description: AAAAAA
                ifc_id: AAAAAA
          R1:
            description: AAAAAA
            ifc_id: AAAAAA
      Building 2:
        description: AAAAAA
        ifc_id: AAAAAA

Linting and viewing such a file can be done using online tools such as https://jsonformatter.org/yaml-viewer and https://www.yamllint.com/

Others options to consider could be TOML https://transform.tools/yaml-to-toml

[sites."Site 1"]
latitude = -90
longitude = -180
description = "AAAAAA"
ifc_id = "AAAAAA"

[sites."Site 1".buildings."Building 1"]
description = "AAAAAA"
ifc_id = "AAAAAA"

[sites."Site 1".buildings."Building 1".storeys.R0]
description = "AAAAAA"
ifc_id = "AAAAAA"

[sites."Site 1".buildings."Building 1".storeys.R0.spaces."ROOM 1"]
description = "AAAAAA"
ifc_id = "AAAAAA"

[sites."Site 1".buildings."Building 1".storeys.R0.spaces."ROOM 2"]
description = "AAAAAA"
ifc_id = "AAAAAA"

[sites."Site 1".buildings."Building 1".storeys.R1]
description = "AAAAAA"
ifc_id = "AAAAAA"

[sites."Site 1".buildings."Building 2"]
description = "AAAAAA"
ifc_id = "AAAAAA"

Kind regards

lafrech commented 4 months ago

This makes sense. I like the YAML representation.

Our workflow involves using a spreadsheet as an exchange format between actors of the project, and I don't think a YAML file would work because most are more comfortable using excel than a plain text editor. (Which is a pity because generating a proper comma-separated UTF-8 encoded .csv file from Excel is just a nightmare, but LibreOffice does better.)

In short we wouldn't object to adding this feature, even if it adds a dependency to pyyaml, but we won't do it.

Let's keep this open to keep track of the idea. Anyone, fell free to propose an implementation.

Transfering this to bemserver-core as this is where it happens (in input_output).