@mod-construction/mod-dlm v1.1.0
mod-dlm
Open source domain specific language to describe prefab construction elements.
mod-dlm is an open-source domain-specific language (DSL) for describing prefab elements in the Architecture, Engineering, and Construction (AEC) industry. This project provides tools for defining entity models and automatically generating CRUD APIs, enabling suppliers to create and manage catalogs of their products easily.
You can always find the most up-to-date API documentation here.
Table of Contents
Features
- Domain-Specific Language: Define prefab elements with a custom DSL tailored for the AEC industry.
- Automatic CRUD API Generation: Generate RESTful APIs for managing prefab elements.
- Multi-language Support: Define entities once and generate code in multiple languages including TypeScript, Python, Java, and Go.
- 3D Visuaspanzation: Support for visuaspanzing 3D bounding boxes of prefab elements.
- Comprehensive Metadata: Include critical attributes such as material composition, dimensions, weight, thermal properties, and more.
- Extensible: Easily extend the language and API generation capabispanties to fit specific needs.
Data Model
erDiagram
PrefabElement {
UUID id
string name
string description
string[] images
string ifcType
string bimModelUrl
}
PrefabElement ||--|| VersionMetadata : has
VersionMetadata {
string version
string status
date lastUpdated
}
PrefabElement ||--|| BoundingBox : has
BoundingBox {
float width
float height
float depth
}
PrefabElement ||--|| ProductCategory : has
ProductCategory {
string category
string buildingSystem
}
PrefabElement ||--|| Material : has
Material {
string finishMaterial
string structuralMaterial
}
PrefabElement ||--|| Dimensional : has
Dimensional {
Range width
Range height
Range length
}
Dimensional ||--|| Range : uses
Range {
float min
float max
}
PrefabElement ||--|| StructuralProperties : has
StructuralProperties {
float safetyFactor
}
StructuralProperties ||--|| LoadBearingCapacity : has
LoadBearingCapacity {
float maximumLoad
string forceUnit
string loadDistribution
string testStandard
}
PrefabElement ||--|| Performance : has
Performance {
float thermalTransmittance
float airTightness
float vaporPermeability
}
Performance ||--|| FireResistance : has
FireResistance {
string reactionToFireClassification
string fireResistanceDuration
}
Performance ||--|| AcousticProperties : has
AcousticProperties {
float weightedSoundReductionIndex
float spectrumAdaptationTerm
}
PrefabElement ||--|| Sustainability : has
Sustainability {
}
Sustainability ||--|| EnvironmentalImpact : has
EnvironmentalImpact {
string classification
string VOCEmissions
float recyclability
string energyEfficiency
}
Sustainability ||--|| Circularity : has
Circularity {
string disassemblyRating
string reusePotential
string refurbishmentScope
string circularityCertification
}
Sustainability ||--|| Origin : has
Origin {
string countryOfManufacturing
}
PrefabElement ||--|| DocumentationCompliance : has
DocumentationCompliance {
string technicalSpecifications
}
DocumentationCompliance ||--|| Certifications : has
Certifications {
string[] certificationTypes
string[] regulatoryApprovals
}
PrefabElement ||--|| InstallationConnectivity : has
InstallationConnectivity {
string connectionType
int installationTime
string compatibility
}
PrefabElement ||--|| LifecycleMaintenance : has
LifecycleMaintenance {
int expectedLifespan
string maintenanceRequirements
string warranty
}
PrefabElement ||--|| AestheticCustomization : has
AestheticCustomization {
string[] colorOptions
string texture
string modularAdaptability
}
PrefabElement ||--|| EconomicFactors : has
EconomicFactors {
float costPerUnit
string currency
int manufacturingLeadTime
}Getting Started
For a complete starter guide, see Hello Prefab Project
Prerequisites
Make sure you have the following installed:
- Node.js (version 16 or later)
- npm (comes with Node.js)
Installation
npm install @mod-construction/mod-dlm@latest -DUsage
You can use mod-dlm in different scenarios.
1. Defining a New Element
import {
PrefabElement,
PrefabElementSchema,
IfcBuildingElementEnum,
ConnectionType,
CompatibilityEnum,
ReusePotentialEnum,
CircularityCertificationEnum,
VOCEmissions,
EnergyEfficiency,
FireResistanceDurationEnum,
ReactionToFireClassificationEnum
} from '@mod-construction/mod-dlm';
const examplePrefabElement: PrefabElement = {
id: '8be9e7b3-de6c-4621-8751-3a1b12d71f94',
name: 'Insulated Concrete Wall Panel',
description: 'A high-performance insulated concrete wall panel suitable for residential and commercial buildings.',
boundingBox: {
width: 3000,
height: 6000,
depth: 200
},
images: [
'https://example.com/images/panel-front.jpg',
'https://example.com/images/panel-back.jpg'
],
ifcType: IfcBuildingElementEnum.IfcWall,
bimModelUrl: 'https://example.com/bim-model.ifc',
productCategory: {
category: 'Insulated Concrete Panels',
buildingSystem: 'Wall'
},
material: {
finishMaterial: 'Concrete',
structuralMaterial: 'Concrete'
},
dimensional: {
width: { min: 1000, max: 4000 },
height: { min: 2000, max: 8000 },
length: { min: 100, max: 300 }
},
structuralProperties: {
safetyFactor: 1.2,
loadBearingCapacity: {
maximumLoad: 5000,
forceUnit: 'kN',
loadDistribution: 'Uniform',
testStandard: 'EN 1990'
}
},
performance: {
fireResistance: {
reactionToFireClassification: ReactionToFireClassificationEnum.A2,
fireResistanceDuration: FireResistanceDurationEnum.REI_60
},
thermalTransmittance: 0.25,
airTightness: 0.8,
vaporPermeability: 90,
acousticProperties: {
weightedSoundReductionIndex: 55,
spectrumAdaptationTerm: 2
}
},
sustainability: {
origin: {
countryOfManufacturing: 'DE'
},
environmentalImpact: {
classification: 'A',
VOCEmissions: VOCEmissions.Low,
recyclability: 75,
energyEfficiency: EnergyEfficiency.LEED_Gold
},
circularity: {
disassemblyRating: 'Moderate',
reusePotential: ReusePotentialEnum.High,
refurbishmentScope: 'Surface treatments only',
circularityCertification: CircularityCertificationEnum.CradleToCradleCertified
}
},
documentationAndCompliance: {
technicalSpecifications: 'https://example.com/specifications/panel-001.pdf',
certifications: {
certificationTypes: ['ISO 9001', 'CE Marking'],
regulatoryApprovals: ['EN 14992', 'DIN 4102']
}
},
installationAndConnectivity: {
connectionType: ConnectionType.BoltOn,
installationTime: 120,
compatibility: CompatibilityEnum.ConcreteStructure
},
lifecycleAndMaintenance: {
expectedLifespan: 50,
maintenanceRequirements: 'Periodic inspection every 5 years',
warranty: '10-year manufacturer warranty'
},
aestheticAndCustomizationOptions: {
colorOptions: ['Gray', 'White', 'Beige'],
texture: 'Smooth',
modularAdaptability: 'Compatible with modular building systems'
},
economicFactors: {
costPerUnit: 1500,
currency: 'EUR',
manufacturingLeadTime: 28
}
};
// Validate the element using the schema
const result = PrefabElementSchema.safeParse(examplePrefabElement);
console.log(result.success ? '✅ Prefab element is valid' : result.error);2. Validating an Element Using Zod and PrefabElementSchema
// Validate the element using the schema
const result = PrefabElementSchema.safeParse(examplePrefabElement);
console.log(result.success ? '✅ Prefab element is valid' : result.error);Hello Prefab Project
This is a short guide to get you up and running in no time, even if you are not familiar with setting up a typescript project.
Make sure you have the following installed:
- Node.js (version 16 or later)
- npm (comes with Node.js)
Steps
1. Initialize a New Project
Open your terminal and create a new directory for your project:
mkdir mod-dlm-project cd mod-dlm-projectInitialize a new Node.js project:
npm init -y
2. Install Dependencies
Install TypeScript and the required types.
npm install typescript @types/node --save-devInitialize a
TypeScriptconfiguration file.npx tsc --initTo auto-restart your project when you make changes, install
nodemon.npm install nodemon --save-devInstall
mod-dlm.npm install @mod-construction/mod-dlm@latest -D
3. Configure your project
Update the scripts section in your package.json:
"scripts": {
"start": "tsc && node index.js",
"dev": "nodemon --watch src --ext ts --exec \"ts-node index.ts\""
},4. Start coding
- Create an
index.tsfile in the root and paste the following code in it:
import {
PrefabElement,
PrefabElementSchema,
IfcBuildingElementEnum,
ConnectionType,
CompatibilityEnum,
ReusePotentialEnum,
CircularityCertificationEnum,
VOCEmissions,
EnergyEfficiency,
FireResistanceDurationEnum,
ReactionToFireClassificationEnum
} from '@mod-construction/mod-dlm';
const examplePrefabElement: PrefabElement = {
id: '8be9e7b3-de6c-4621-8751-3a1b12d71f94',
name: 'Insulated Concrete Wall Panel',
description: 'A high-performance insulated concrete wall panel suitable for residential and commercial buildings.',
boundingBox: {
width: 3000,
height: 6000,
depth: 200
},
images: [
'https://example.com/images/panel-front.jpg',
'https://example.com/images/panel-back.jpg'
],
ifcType: IfcBuildingElementEnum.IfcWall,
bimModelUrl: 'https://example.com/bim-model.ifc',
productCategory: {
category: 'Insulated Concrete Panels',
buildingSystem: 'Wall'
},
material: {
finishMaterial: 'Concrete',
structuralMaterial: 'Concrete'
},
dimensional: {
width: { min: 1000, max: 4000 },
height: { min: 2000, max: 8000 },
length: { min: 100, max: 300 }
},
structuralProperties: {
safetyFactor: 1.2,
loadBearingCapacity: {
maximumLoad: 5000,
forceUnit: 'kN',
loadDistribution: 'Uniform',
testStandard: 'EN 1990'
}
},
performance: {
fireResistance: {
reactionToFireClassification: ReactionToFireClassificationEnum.A2,
fireResistanceDuration: FireResistanceDurationEnum.REI_60
},
thermalTransmittance: 0.25,
airTightness: 0.8,
vaporPermeability: 90,
acousticProperties: {
weightedSoundReductionIndex: 55,
spectrumAdaptationTerm: 2
}
},
sustainability: {
origin: {
countryOfManufacturing: 'DE'
},
environmentalImpact: {
classification: 'A',
VOCEmissions: VOCEmissions.Low,
recyclability: 75,
energyEfficiency: EnergyEfficiency.LEED_Gold
},
circularity: {
disassemblyRating: 'Moderate',
reusePotential: ReusePotentialEnum.High,
refurbishmentScope: 'Surface treatments only',
circularityCertification: CircularityCertificationEnum.CradleToCradleCertified
}
},
documentationAndCompliance: {
technicalSpecifications: 'https://example.com/specifications/panel-001.pdf',
certifications: {
certificationTypes: ['ISO 9001', 'CE Marking'],
regulatoryApprovals: ['EN 14992', 'DIN 4102']
}
},
installationAndConnectivity: {
connectionType: ConnectionType.BoltOn,
installationTime: 120,
compatibility: CompatibilityEnum.ConcreteStructure
},
lifecycleAndMaintenance: {
expectedLifespan: 50,
maintenanceRequirements: 'Periodic inspection every 5 years',
warranty: '10-year manufacturer warranty'
},
aestheticAndCustomizationOptions: {
colorOptions: ['Gray', 'White', 'Beige'],
texture: 'Smooth',
modularAdaptability: 'Compatible with modular building systems'
},
economicFactors: {
costPerUnit: 1500,
currency: 'EUR',
manufacturingLeadTime: 28
}
};
// Validate the element using the schema
const result = PrefabElementSchema.safeParse(examplePrefabElement);
console.log(result.success ? '✅ Prefab element is valid' : result.error);5. Run your code
To tun your code, simply run the following command in your terminal:
npm run devContributing
We appreciate feedback and contribution to this project! Before you get started, please see the following:
🙌 Thanks to Our Contributors
A huge thank you to all the amazing contributors who have helped make this project better. You can find the full list of contributors here.