e2nIEE / pandahub

A data hub for pandapower and pandapipes networks based on MongoDB.
Other
12 stars 12 forks source link

Fix: 'TypeError' in ph.get_net_value_from_db #31

Closed lhillma closed 1 year ago

lhillma commented 1 year ago

The PandaHub.get_net_value_from_db method used the variable name "element" once for the type of element for which to look up a specified value ("load", "sgen", "bus", "trafo", etc.) and once for the MongoDB document retrieved from the database. This led to a TypeError when calling the method, as "element" was used to determine dtypes in line 895 after it went from being the element type to the db document. Fix this by determining dtypes prior to the DB query. Furthermore, rename the collection retrieved from the DB to "documents" and "document" for clarity, which is consistent with the implementation of ph.set_net_value_in_db.