Skip to content

Commit

Permalink
Final release merge (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-Nan authored Jul 14, 2024
2 parents 394508d + cc9184b commit c58e499
Show file tree
Hide file tree
Showing 74 changed files with 2,562 additions and 1,101 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

## 📢 About the Project

Welcome to the official repository for the `CODE.ING` group, developing an open-source `Building Information Enhancer` software for the `BUILD.ING` partner as a part of the `AMOS 2024` project.
Welcome to the official repository for the `CODE.ING` group, developing an open-source `Building Information Enhancer` software for the `BUILD.ING` partner as a part of the `AMOS 2024` project.

The `BCI Building Information Enhancer` is a platform for individual building owners or industry professionals, allowing them to access information about specific addresses, locations, or regions. This information can be used for a variety of applications, from sustainability certifications for buildings, over calculating the solar power potential, up to aiding in district planning. In general, the BCI building information enhancer offers significant benefits for various stakeholders in the property market.

For our project mission, the team agreed to create an MVP for the BCI Building Information Enhancer, the core functionality will be displaying data from a fixed number of sources, including satellite images, charging stations, and data needed for sustainability certification. Our goal is to build a practical and scalable tool that can grow with our users' needs. Finally, to read about the architecture of our service visit our [GitHub Wiki Pages](https://github.com/amosproj/amos2024ss04-building-information-enhancer/wiki).

## 🚀 Setup & Deployment

`BCI Building Information Enhancer` project is integrated with a full [CI-CD pipeline](https://github.com/amosproj/amos2024ss04-building-information-enhancer/wiki/CI%E2%80%90CD-Pipeline) and thus deployed automatically for public use as a [BCI website](http://prod.amos.b-ci.de/) using servers provided by the industry partner. However, production servers might be turned off in the future, so it is also possible to deploy a production-ready system on your local machine using the provided Docker compose file.
`BCI Building Information Enhancer` project is integrated with a full [CI-CD pipeline](https://github.com/amosproj/amos2024ss04-building-information-enhancer/wiki/CI%E2%80%90CD-Pipeline) and thus deployed automatically for public use as a [BCI website](http://prod.amos.b-ci.de/) using servers provided by the industry partner. However, production servers might be turned off in the future, so it is also possible to deploy a production-ready system on your local machine using the provided Docker compose file.

## 📦 Deployment using Docker

Expand Down
21 changes: 0 additions & 21 deletions backend/api-gateway/Controllers/APIGatewayController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,27 +138,6 @@ public async Task<IActionResult> LoadLocationData([FromBody, Required] LocationD

}

// Helper method to generate mock data
private List<DatasetItem> GenerateMockData(string mapId, int count)
{
var random = new Random();
var data = new List<DatasetItem>();

for (int i = 0; i < count; i++)
{
var item = new DatasetItem
{
Id = Guid.NewGuid().ToString(), // Generate a unique ID
Key = $"{mapId} Item {i + 1} (distance)",
Value = $"{random.Next(50, 1000)} m",
MapId = mapId
};
data.Add(item);
}

return data;
}

/// <summary>
/// Gets the dataset viewport data based on the provided parameters.
/// </summary>
Expand Down
19 changes: 15 additions & 4 deletions backend/api-gateway/Models/LocationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,28 @@ public class Coordinate

public class LocationDataResponse
{
public List<DatasetItem> IndividualData { get; set; } = new List<DatasetItem>();
public List<DatasetItem> GeneralData { get; set; } = new List<DatasetItem>();
public List<DatasetItem> IndividualData { get; set; } = [];
public List<DatasetItem> SelectionData { get; set; } = [];
}

public class DatasetItem
{
public string Id { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string DatasetId { get; set; } = string.Empty;

public double[] Coordinate { get; set; } = [];
public List<double[]> PolygonCoordinates { get; set; } = [];
public List<SubdataItem> Subdata { get; set; } = [];
public string Value { get; set; } = string.Empty; // some items may not have subdata and should instead be directly displayed with a value

}

public class SubdataItem
{
public string Key { get; set; } = string.Empty;

public string Value { get; set; } = string.Empty;
public string MapId { get; set; } = string.Empty; // Optional -> for "open in map" functionality

}


Expand Down
45 changes: 21 additions & 24 deletions backend/lib/BieMetadata/MetadataDbHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class MetadataDbHelper
private string mMetaDataDbUrl;

private IMongoDatabase mDatabase;

public bool Connected { get; private set; }

public MetadataDbHelper()
Expand Down Expand Up @@ -58,7 +58,7 @@ public bool CreateConnection()
return metadataObject;
}

public bool UpdateMetadata(string dataset, string tableName, int numberOfLines, BoundingBox boundingBox)
public bool UpdateMetadata(string dataset, MetadataObject.TableData tableData)
{
// Load the collection
var collection = mDatabase.GetCollection<MetadataObject>("datasets");
Expand All @@ -74,31 +74,28 @@ public bool UpdateMetadata(string dataset, string tableName, int numberOfLines,
return false;
}

// Load the existing table
var existingTable = metadataObject.additionalData.Tables.Find(t => t.Name == tableName);
if (existingTable == null)
// Load and remove any existing table
var existingTable = metadataObject.additionalData.Tables.Find(t => t.Name == tableData.Name);
if (existingTable != null)
{
// Create a new table object if not present
var newTable = new MetadataObject.TableData()
{
Name = tableName,
NumberOfLines = numberOfLines,
BoundingBox = boundingBox
};
metadataObject.additionalData.Tables.Add(newTable);
collection.ReplaceOne(g => g.basicData.DatasetId == dataset, metadataObject);
return true;
metadataObject.additionalData.Tables.Remove(existingTable);
}

// Table info already exists, for now just choose the larger number of lines number.
existingTable.NumberOfLines = existingTable.NumberOfLines < numberOfLines
? numberOfLines
: existingTable.NumberOfLines;

// always write the current Bounding box
existingTable.BoundingBox = boundingBox;

// Insert the new Table object.
metadataObject.additionalData.Tables.Add(tableData);
collection.ReplaceOne(g => g.basicData.DatasetId == dataset, metadataObject);
return true;
}
}

public bool UpdateMetadata(string dataset, string tableName, int numberOfLines, BoundingBox boundingBox)
{
return UpdateMetadata(dataset,
new MetadataObject.TableData()
{
Name = tableName,
NumberOfLines = numberOfLines,
BoundingBox = new BoundingBox(),
RowHeaders = new List<string>()
});
}
}
54 changes: 49 additions & 5 deletions backend/lib/BieMetadata/MetadataObject.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
// ReSharper disable InconsistentNaming

namespace BieMetadata;

Expand Down Expand Up @@ -67,26 +66,71 @@ public class AdditionalData
public int MarkersThreshold { get; set; } = 0;

/// <summary>
/// The display property is the property that should be shown in a popup.
/// A list of display properties that should be shown in a marker popup.
/// </summary>
public string DisplayProperty { get; set; } = string.Empty;
public List<DisplayProperty> DisplayProperty { get; set; } = new List<DisplayProperty>();

/// <summary>
/// Table data populated by the data pipeline. Contains the name and the size of the all .yaml files correlated to that specific dataset.
/// </summary>
public List<TableData> Tables { get; set; } = new List<TableData>();

/// <summary>
/// A polygon coloring rule for different values.
/// </summary>
[BsonIgnoreIfNull] // Add this attribute to ignore null values
public PolygonColoring? PolygonColoring { get; set; }
}

/// <summary>
/// Table data populated by the data pipeline. Contains the name and the size of the all .yaml files correlated to that specific dataset.
/// </summary>
public class TableData
{
// The name of the .yaml file
/// <summary>
/// the name of the table
/// </summary>
public string Name { get; set; } = string.Empty;
// The number of lines of data in that file.

/// <summary>
/// the number of lines in the table
/// </summary>
public int NumberOfLines { get; set; } = 0;

/// <summary>
/// the bounding box of the geomtry data in the table
/// </summary>
public BoundingBox? BoundingBox { get; set; }

/// <summary>
/// the headers of the dataset. Should NOT include the special Location header.
/// </summary>
public List<string> RowHeaders { get; set; }
}

/// <summary>
/// A list of display values to show for the markers on the map
/// </summary>
public class DisplayProperty
{
// The display name to show
public string displayName { get; set; } = string.Empty;
// The value to show
public string value { get; set; } = string.Empty;
}

/// <summary>
/// Polygon coloring rules
/// </summary>
public class PolygonColoring
{
public string attributeName { get; set; } = string.Empty;
public List<PolygonColor> colors { get; set; } = new List<PolygonColor>();
}

public class PolygonColor
{
public string color { get; set; } = string.Empty;
public List<string> values { get; set; } = new List<string>();
}
}
96 changes: 88 additions & 8 deletions backend/metadata-database/init-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const datasets = [
LongDescription: `An empty, default map of Germany, with no data loaded. Useful for exploring the map.`,
MinZoomLevel: -1,
MarkersThreshold: -1,
DisplayProperty: "",
DisplayProperty: [],
PolygonColoring: null,
Tables: [],
},
},
Expand All @@ -46,7 +47,8 @@ const datasets = [
LongDescription: `A map of EV charging stations displays the locations of electric vehicle charging points located in Germany, helping drivers plan routes and manage charging needs. It is essential for supporting the adoption and convenience of electric vehicles.`,
MinZoomLevel: 11,
MarkersThreshold: -1,
DisplayProperty: "name",
DisplayProperty: [{ displayName: "Operator", value: "operator" }],
PolygonColoring: null,
Tables: [],
},
},
Expand All @@ -64,7 +66,8 @@ const datasets = [
LongDescription: `House footprints refer to the outline or ground area covered by a house, typically measured from the exterior walls of the structure. This footprint includes all parts of the house that are in contact with the ground, and is important for planning and zoning purposes, calculating property taxes, and designing land use.`,
MinZoomLevel: 11,
MarkersThreshold: 17,
DisplayProperty: "",
DisplayProperty: [],
PolygonColoring: null,
Tables: [],
},
},
Expand All @@ -81,8 +84,55 @@ const datasets = [
DataType: "SHAPE",
LongDescription: `The Actual Use map describes the use of the earth's surface in four main groups (settlement, traffic, vegetation and water bodies). The division of these main groups into almost 140 different types of use, such as residential areas, road traffic, agriculture or flowing water, enables detailed evaluations and analyses of the use of the earth's surface.`,
MinZoomLevel: 11,
MarkersThreshold: 17,
DisplayProperty: "",
MarkersThreshold: 15,
DisplayProperty: [],
PolygonColoring: {
attributeName: "nutzart",
colors: [
{
color: "DarkOrchid",
values: [
"Wohnbaufläche",
"Industrie- und Gewerbefläche",
"Halde",
"Bergbaubetrieb",
"Tagebau, Grube Steinbruch",
"Fläche gemischter Nutzung",
"Fläche besonderer funktionaler Prägung",
"Sport-, Freizeit- und Erholungsfläche",
"Friedhof",
],
},
{
color: "green",
values: ["Wald", "Gehölz", "Sumpf"],
},
{
color: "yellow",
values: [
"Landwirtschaft",
"Heide",
"Moor",
"Unland/Vegetationslose Fläche",
],
},
{
color: "RosyBrown",
values: [
"Straßenverkehr",
"Weg",
"Platz",
"Bahnverkehr",
"Flugverkehr",
"Schiffsverkehr",
],
},
{
color: "Cyan",
values: ["Fließgewässer", "Hafenbecken", "Stehendes Gewässer"],
},
],
},
Tables: [],
},
},
Expand All @@ -91,15 +141,45 @@ const datasets = [
DatasetId: "building_models",
Name: "Building Models",
ShortDescription: `Simplified 3D building models.`,
Icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M136.83,220.43a8,8,0,0,1-11.09,2.23A183.15,183.15,0,0,0,24,192a8,8,0,0,1,0-16,199.11,199.11,0,0,1,110.6,33.34A8,8,0,0,1,136.83,220.43ZM24,144a8,8,0,0,0,0,16,214.81,214.81,0,0,1,151.17,61.71,8,8,0,1,0,11.2-11.42A230.69,230.69,0,0,0,24,144Zm208,16a216.51,216.51,0,0,0-48.59,5.49q8.24,6.25,16,13.16A201.53,201.53,0,0,1,232,176a8,8,0,0,1,0,16c-6,0-11.93.29-17.85.86q8.32,8.67,15.94,18.14a8,8,0,1,1-12.48,10A247,247,0,0,0,24,128a8,8,0,0,1,0-16,266.33,266.33,0,0,1,48,4.37V80a8,8,0,0,1,3.2-6.4l64-48a8,8,0,0,1,9.6,0l64,48A8,8,0,0,1,216,80v32.49c5.31-.31,10.64-.49,16-.49a8,8,0,0,1,0,16,246.3,246.3,0,0,0-84.26,14.69q9.44,5,18.46,10.78A232.2,232.2,0,0,1,232,144a8,8,0,0,1,0,16ZM120,88h48a8,8,0,0,1,8,8v21.94q11.88-2.56,24-4V84L144,42,88,84v35.81q12.19,3,24,7.18V96A8,8,0,0,1,120,88Zm8.07,45.27A262.48,262.48,0,0,1,160,121.94V104H128v29.24Z"></path></svg>',
Icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,224H208V32h8a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16h8V224H24a8,8,0,0,0,0,16H232a8,8,0,0,0,0-16ZM64,32H192V224H160V184a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v40H64Zm80,192H112V192h32ZM88,64a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm48,0a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H144A8,8,0,0,1,136,64ZM88,104a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H96A8,8,0,0,1,88,104Zm48,0a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H144A8,8,0,0,1,136,104ZM88,144a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H96A8,8,0,0,1,88,144Zm48,0a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H144A8,8,0,0,1,136,144Z"></path></svg>',
},
additionalData: {
Icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M136.83,220.43a8,8,0,0,1-11.09,2.23A183.15,183.15,0,0,0,24,192a8,8,0,0,1,0-16,199.11,199.11,0,0,1,110.6,33.34A8,8,0,0,1,136.83,220.43ZM24,144a8,8,0,0,0,0,16,214.81,214.81,0,0,1,151.17,61.71,8,8,0,1,0,11.2-11.42A230.69,230.69,0,0,0,24,144Zm208,16a216.51,216.51,0,0,0-48.59,5.49q8.24,6.25,16,13.16A201.53,201.53,0,0,1,232,176a8,8,0,0,1,0,16c-6,0-11.93.29-17.85.86q8.32,8.67,15.94,18.14a8,8,0,1,1-12.48,10A247,247,0,0,0,24,128a8,8,0,0,1,0-16,266.33,266.33,0,0,1,48,4.37V80a8,8,0,0,1,3.2-6.4l64-48a8,8,0,0,1,9.6,0l64,48A8,8,0,0,1,216,80v32.49c5.31-.31,10.64-.49,16-.49a8,8,0,0,1,0,16,246.3,246.3,0,0,0-84.26,14.69q9.44,5,18.46,10.78A232.2,232.2,0,0,1,232,144a8,8,0,0,1,0,16ZM120,88h48a8,8,0,0,1,8,8v21.94q11.88-2.56,24-4V84L144,42,88,84v35.81q12.19,3,24,7.18V96A8,8,0,0,1,120,88Zm8.07,45.27A262.48,262.48,0,0,1,160,121.94V104H128v29.24Z"></path></svg>',
Icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232,224H208V32h8a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16h8V224H24a8,8,0,0,0,0,16H232a8,8,0,0,0,0-16ZM64,32H192V224H160V184a8,8,0,0,0-8-8H104a8,8,0,0,0-8,8v40H64Zm80,192H112V192h32ZM88,64a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H96A8,8,0,0,1,88,64Zm48,0a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H144A8,8,0,0,1,136,64ZM88,104a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H96A8,8,0,0,1,88,104Zm48,0a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H144A8,8,0,0,1,136,104ZM88,144a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H96A8,8,0,0,1,88,144Zm48,0a8,8,0,0,1,8-8h16a8,8,0,0,1,0,16H144A8,8,0,0,1,136,144Z"></path></svg>',
Type: "areas",
DataType: "CITYGML",
LongDescription: `The building models have a 3D object of each building plus additional information on its dimentions.`,
MinZoomLevel: 11,
MarkersThreshold: 17,
DisplayProperty: "",
DisplayProperty: [],
PolygonColoring: null,
Tables: [],
},
},
{
basicData: {
DatasetId: "air_pollutants",
Name: "Air Pollutants",
ShortDescription: `Air measurements from stations across Germany.`,
Icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M184,184a32,32,0,0,1-32,32c-13.7,0-26.95-8.93-31.5-21.22a8,8,0,0,1,15-5.56C137.74,195.27,145,200,152,200a16,16,0,0,0,0-32H40a8,8,0,0,1,0-16H152A32,32,0,0,1,184,184Zm-64-80a32,32,0,0,0,0-64c-13.7,0-26.95,8.93-31.5,21.22a8,8,0,0,0,15,5.56C105.74,60.73,113,56,120,56a16,16,0,0,1,0,32H24a8,8,0,0,0,0,16Zm88-32c-13.7,0-26.95,8.93-31.5,21.22a8,8,0,0,0,15,5.56C193.74,92.73,201,88,208,88a16,16,0,0,1,0,32H32a8,8,0,0,0,0,16H208a32,32,0,0,0,0-64Z"></path></svg>',
},
additionalData: {
Type: "markers",
DataType: "CSV",
Icon: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M240,208H224V96a16,16,0,0,0-16-16H144V32a16,16,0,0,0-24.88-13.32L39.12,72A16,16,0,0,0,32,85.34V208H16a8,8,0,0,0,0,16H240a8,8,0,0,0,0-16ZM208,96V208H144V96ZM48,85.34,128,32V208H48ZM112,112v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm-32,0v16a8,8,0,0,1-16,0V112a8,8,0,1,1,16,0Zm0,56v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Zm32,0v16a8,8,0,0,1-16,0V168a8,8,0,0,1,16,0Z"></path></svg>',
LongDescription: ` The air quality dataset provides air measurements from stations across Germany. This data includes various air pollutants, such as particulate matter (PM10 and PM2'5) and nitrogen dioxide (NO2). This data is essential for monitoring environmental health and guiding policy decisions for air quality improvement.`,
MinZoomLevel: 6,
MarkersThreshold: -1,
DisplayProperty: [
{ displayName: "Station Name", value: "station_name" },
{ displayName: "Nitrogen Dioxide (NO2)", value: "no2" },
{ displayName: "Particulate Matter (PM10)", value: "pm10" },
{ displayName: "Particulate Matter (PM2'5)", value: "pm2_5" },
{ displayName: "Ozone (O3)", value: "o3" },
{ displayName: "Carbon monoxide (CO)", value: "co" },
{ displayName: "Date", value: "date" },
{ displayName: "Time", value: "time" },
],
PolygonColoring: null,
Tables: [],
},
},
Expand Down
Loading

0 comments on commit c58e499

Please sign in to comment.