259 lines
14 KiB
SQL
259 lines
14 KiB
SQL
-- Database Structure and Sample Data for Environmental Noise Measurement
|
|
-- Based on PMK RI No.2 Tahun 2023
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- Master Tables - Noise Specific
|
|
-- ------------------------------------------------------------------------------
|
|
|
|
-- Master Area Types
|
|
CREATE TABLE IF NOT EXISTS master_area_types (
|
|
MasterAreaTypeID INT PRIMARY KEY,
|
|
MasterAreaTypeName VARCHAR(100) NOT NULL,
|
|
MasterAreaTypeDescription TEXT,
|
|
MasterAreaTypeIsActive BOOLEAN DEFAULT TRUE,
|
|
MasterAreaTypeCreatedUserID INT
|
|
);
|
|
|
|
-- Master Noise Quality Standards
|
|
CREATE TABLE IF NOT EXISTS master_noise_standards (
|
|
MasterNoiseStandardID INT PRIMARY KEY,
|
|
MasterRegulationID INT NOT NULL,
|
|
MasterAreaTypeID INT NOT NULL,
|
|
MasterNoiseStandardValue DECIMAL(5, 1) NOT NULL,
|
|
MasterNoiseStandardUnit VARCHAR(10) DEFAULT 'dB(A)',
|
|
MasterNoiseStandardMeasurementTime VARCHAR(50),
|
|
MasterNoiseStandardDescription TEXT,
|
|
MasterNoiseStandardIsActive BOOLEAN DEFAULT TRUE,
|
|
MasterNoiseStandardCreatedUserID INT,
|
|
FOREIGN KEY (MasterRegulationID) REFERENCES master_regulations(regulation_id),
|
|
FOREIGN KEY (MasterAreaTypeID) REFERENCES master_area_types(MasterAreaTypeID)
|
|
);
|
|
|
|
-- Master Noise Measurement Methods
|
|
CREATE TABLE IF NOT EXISTS master_noise_methods (
|
|
MasterNoiseMethodID INT PRIMARY KEY,
|
|
MasterNoiseMethodCode VARCHAR(50) NOT NULL,
|
|
MasterNoiseMethodName VARCHAR(255) NOT NULL,
|
|
MasterNoiseMethodDescription TEXT,
|
|
MasterNoiseMethodStandardReference VARCHAR(100),
|
|
MasterNoiseMethodIsActive BOOLEAN DEFAULT TRUE,
|
|
MasterNoiseMethodCreatedUserID INT
|
|
);
|
|
|
|
-- Master Noise Measurement Equipment
|
|
CREATE TABLE IF NOT EXISTS master_noise_equipment (
|
|
MasterNoiseEquipmentID INT PRIMARY KEY,
|
|
MasterNoiseEquipmentCode VARCHAR(20) NOT NULL,
|
|
MasterNoiseEquipmentName VARCHAR(100) NOT NULL,
|
|
MasterNoiseEquipmentType VARCHAR(50),
|
|
MasterNoiseEquipmentBrand VARCHAR(100),
|
|
MasterNoiseEquipmentModel VARCHAR(100),
|
|
MasterNoiseEquipmentSerialNumber VARCHAR(100),
|
|
MasterNoiseEquipmentAccuracyType VARCHAR(20), -- Type 0, 1, 2 for SLM
|
|
MasterNoiseEquipmentSpecifications TEXT,
|
|
MasterNoiseEquipmentCalibrationDate DATE,
|
|
MasterNoiseEquipmentNextCalibrationDate DATE,
|
|
MasterNoiseEquipmentCalibrationStatus VARCHAR(20),
|
|
MasterNoiseEquipmentCertificateFile VARCHAR(255),
|
|
MasterNoiseEquipmentIsActive BOOLEAN DEFAULT TRUE,
|
|
MasterNoiseEquipmentCreatedUserID INT
|
|
);
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- Transaction Tables - Noise Specific
|
|
-- ------------------------------------------------------------------------------
|
|
|
|
-- Noise Sampling Plan
|
|
CREATE TABLE IF NOT EXISTS trx_noise_sampling_plan (
|
|
sampling_plan_id INT PRIMARY KEY,
|
|
sampling_plan_code VARCHAR(50) NOT NULL,
|
|
project_name VARCHAR(255) NOT NULL,
|
|
client_id INT NOT NULL,
|
|
planned_sampling_date DATE NOT NULL,
|
|
sampling_location TEXT NOT NULL,
|
|
point_count INT,
|
|
approval_status VARCHAR(20) DEFAULT 'DRAFT',
|
|
notes TEXT,
|
|
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
input_user VARCHAR(50)
|
|
);
|
|
|
|
-- Noise Measurement Results
|
|
CREATE TABLE IF NOT EXISTS trx_noise_measurement_results (
|
|
measurement_id INT PRIMARY KEY,
|
|
sampling_plan_id INT NOT NULL,
|
|
report_code VARCHAR(50) NOT NULL,
|
|
sampling_date DATE NOT NULL,
|
|
start_time TIME,
|
|
end_time TIME,
|
|
weather_condition VARCHAR(100),
|
|
temperature DECIMAL(5, 2),
|
|
humidity DECIMAL(5, 2),
|
|
wind_speed DECIMAL(5, 2),
|
|
wind_direction VARCHAR(10),
|
|
sampling_officers VARCHAR(100),
|
|
report_status VARCHAR(20) DEFAULT 'DRAFT',
|
|
notes TEXT,
|
|
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
input_user VARCHAR(50),
|
|
FOREIGN KEY (sampling_plan_id) REFERENCES trx_noise_sampling_plan(sampling_plan_id)
|
|
);
|
|
|
|
-- Noise Measurement Details
|
|
CREATE TABLE IF NOT EXISTS trx_noise_measurement_details (
|
|
measurement_detail_id INT PRIMARY KEY,
|
|
measurement_id INT NOT NULL,
|
|
point_code VARCHAR(20) NOT NULL,
|
|
location_name VARCHAR(255) NOT NULL,
|
|
area_description TEXT,
|
|
area_type_id INT NOT NULL,
|
|
latitude DECIMAL(10, 6),
|
|
longitude DECIMAL(10, 6),
|
|
measurement_height DECIMAL(4, 2),
|
|
distance_from_source DECIMAL(6, 2),
|
|
noise_source TEXT,
|
|
noise_characteristics VARCHAR(50), -- Continuous, Intermittent, Impulsive, etc.
|
|
method_id INT NOT NULL,
|
|
equipment_id INT NOT NULL,
|
|
day_value DECIMAL(5, 1) NOT NULL, -- Ld (day)
|
|
evening_value DECIMAL(5, 1) NOT NULL, -- Le (evening)
|
|
night_value DECIMAL(5, 1) NOT NULL, -- Ln (night)
|
|
leq24_value DECIMAL(5, 1) NOT NULL, -- Leq 24 hours
|
|
standard_id INT NOT NULL,
|
|
compliance_status VARCHAR(20),
|
|
recommendations TEXT,
|
|
notes TEXT,
|
|
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
input_user VARCHAR(50),
|
|
FOREIGN KEY (measurement_id) REFERENCES trx_noise_measurement_results(measurement_id),
|
|
FOREIGN KEY (area_type_id) REFERENCES master_area_types(MasterAreaTypeID),
|
|
FOREIGN KEY (method_id) REFERENCES master_noise_methods(MasterNoiseMethodID),
|
|
FOREIGN KEY (equipment_id) REFERENCES master_noise_equipment(MasterNoiseEquipmentID),
|
|
FOREIGN KEY (standard_id) REFERENCES master_noise_standards(MasterNoiseStandardID)
|
|
);
|
|
|
|
-- Noise Control Recommendations
|
|
CREATE TABLE IF NOT EXISTS trx_noise_control_recommendations (
|
|
recommendation_id INT PRIMARY KEY,
|
|
measurement_detail_id INT NOT NULL,
|
|
control_type VARCHAR(50) NOT NULL, -- Engineering, Administrative, PPE
|
|
control_description TEXT NOT NULL,
|
|
priority INT,
|
|
estimated_cost DECIMAL(12, 2),
|
|
estimated_reduction DECIMAL(5, 1),
|
|
implementation_status VARCHAR(20) DEFAULT 'PLANNED',
|
|
input_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
input_user VARCHAR(50),
|
|
FOREIGN KEY (measurement_detail_id) REFERENCES trx_noise_measurement_details(measurement_detail_id)
|
|
);
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- Sample Data Insertion - Master Tables
|
|
-- ------------------------------------------------------------------------------
|
|
|
|
-- Insert Data Master Area Types
|
|
INSERT INTO master_area_types (
|
|
MasterAreaTypeID, MasterAreaTypeName, MasterAreaTypeDescription,
|
|
MasterAreaTypeIsActive, MasterAreaTypeCreatedUserID
|
|
) VALUES
|
|
(1, 'Residential Areas', 'Residential housing and settlements',
|
|
TRUE, 1),
|
|
(2, 'Commercial and Trade Areas', 'Commercial and service areas, including offices',
|
|
TRUE, 1),
|
|
(3, 'Office and Commercial Areas', 'Office and commercial areas',
|
|
TRUE, 1);
|
|
|
|
-- Insert Data Master Noise Standards
|
|
INSERT INTO master_noise_standards (
|
|
MasterNoiseStandardID, MasterRegulationID, MasterAreaTypeID,
|
|
MasterNoiseStandardValue, MasterNoiseStandardUnit,
|
|
MasterNoiseStandardMeasurementTime, MasterNoiseStandardDescription,
|
|
MasterNoiseStandardIsActive, MasterNoiseStandardCreatedUserID
|
|
) VALUES
|
|
(1, 1, 1, 55.0, 'dB(A)', 'Leq 24 hours',
|
|
'Noise quality standard for residential areas', TRUE, 1),
|
|
(2, 1, 2, 70.0, 'dB(A)', 'Leq 24 hours',
|
|
'Noise quality standard for commercial and trade areas', TRUE, 1);
|
|
|
|
-- Insert Data Master Noise Measurement Methods
|
|
INSERT INTO master_noise_methods (
|
|
MasterNoiseMethodID, MasterNoiseMethodCode, MasterNoiseMethodName,
|
|
MasterNoiseMethodDescription, MasterNoiseMethodStandardReference,
|
|
MasterNoiseMethodIsActive, MasterNoiseMethodCreatedUserID
|
|
) VALUES
|
|
(1, 'SNI-7231-2009', 'SNI 7231:2009 - Environmental Noise Measurement Method',
|
|
'Method for measuring environmental noise levels using Sound Level Meter',
|
|
'SNI 7231:2009', TRUE, 1),
|
|
(2, 'KEPMEN-LH-48-1996', 'Ministry of Environment Decree No. 48 of 1996 - Appendix II',
|
|
'Noise level measurement method based on the Ministry of Environment Decree',
|
|
'Ministry of Environment Decree No.48 of 1996', TRUE, 1);
|
|
|
|
-- Insert Data Master Noise Measurement Equipment
|
|
INSERT INTO master_noise_equipment (
|
|
MasterNoiseEquipmentID, MasterNoiseEquipmentCode, MasterNoiseEquipmentName,
|
|
MasterNoiseEquipmentType, MasterNoiseEquipmentBrand,
|
|
MasterNoiseEquipmentModel, MasterNoiseEquipmentSerialNumber,
|
|
MasterNoiseEquipmentAccuracyType, MasterNoiseEquipmentSpecifications,
|
|
MasterNoiseEquipmentCalibrationDate, MasterNoiseEquipmentNextCalibrationDate,
|
|
MasterNoiseEquipmentCalibrationStatus, MasterNoiseEquipmentCertificateFile,
|
|
MasterNoiseEquipmentIsActive, MasterNoiseEquipmentCreatedUserID
|
|
) VALUES
|
|
(1, 'SLM-01', 'Sound Level Meter', 'SLM',
|
|
'RION', 'NL-52', '12345678', 'Type 1',
|
|
'Range: 20-130 dB, Accuracy: ±1.0 dB, Frequency range: 20 Hz - 20 kHz',
|
|
'2024-02-15', '2025-02-15', 'VALID',
|
|
'/documents/calibration/slm_rion_2024.pdf', TRUE, 1);
|
|
|
|
-- ------------------------------------------------------------------------------
|
|
-- Sample Data Insertion - Transaction Tables
|
|
-- ------------------------------------------------------------------------------
|
|
|
|
-- Sample Noise Sampling Plan
|
|
INSERT INTO trx_noise_sampling_plan (sampling_plan_id, sampling_plan_code, project_name, client_id, planned_sampling_date, sampling_location, point_count, approval_status, notes, input_date, input_user)
|
|
VALUES
|
|
(1, 'SP-NOISE-2024-001', 'Environmental Noise Measurement at PT. Integrated Manufacturing Industries', 201, '2024-06-10', 'PT. Integrated Manufacturing Industries, Industrial Zone Block C5, Karawang, West Java', 6, 'APPROVED', 'Environmental noise measurement for compliance with standards', '2024-06-01 09:00:00', 'supervisor');
|
|
|
|
-- Sample Noise Measurement Results
|
|
INSERT INTO trx_noise_measurement_results (measurement_id, sampling_plan_id, report_code, sampling_date, start_time, end_time, weather_condition, temperature, humidity, wind_speed, wind_direction, sampling_officers, report_status, notes, input_date, input_user)
|
|
VALUES
|
|
(1, 1, 'LHU/NOISE/06/2024/003', '2024-06-10', '08:00:00', '17:00:00', 'Sunny', 30.0, 65.0, 1.5, 'East', 'Agus Setiawan, Dina Wijaya', 'FINAL', 'Measurement proceeded smoothly as planned', '2024-06-10 17:30:00', 'analyst');
|
|
|
|
-- Sample Noise Measurement Details
|
|
INSERT INTO trx_noise_measurement_details (measurement_detail_id, measurement_id, point_code, location_name, area_description, area_type_id, latitude, longitude, measurement_height, distance_from_source, noise_source, noise_characteristics, method_id, equipment_id, day_value, evening_value, night_value, leq24_value, standard_id, compliance_status, recommendations, notes, input_date, input_user)
|
|
VALUES
|
|
-- Main Factory Entrance
|
|
(1, 1, 'NL-1', 'Main Factory Entrance', 'Main factory gate area, moderate traffic level', 4, -6.372500, 107.524167, 1.5, 3.0, 'Vehicle traffic, loading/unloading activities', 'Intermittent', 1, 1, 67.8, 65.2, 62.1, 66.3, 4, 'COMPLY', '', 'Noise is quite high during morning and evening peak hours', '2024-06-10 17:35:00', 'analyst'),
|
|
|
|
-- Production Building
|
|
(2, 1, 'NL-2', 'Production Building', 'Main production building area, high activity level', 4, -6.372778, 107.524444, 1.5, 1.0, 'Production machinery, stamping, air compressors', 'Continuous, Impulsive', 1, 1, 73.4, 72.1, 68.5, 72.2, 4, 'NOT_COMPLY', 'Install sound absorbers, check machine maintenance', 'High noise from stamping machines and compressors', '2024-06-10 17:40:00', 'analyst'),
|
|
|
|
-- Office Building
|
|
(3, 1, 'NL-3', 'Office Building', 'Administrative office area, active HVAC system', 3, -6.372944, 107.525000, 1.5, 5.0, 'HVAC system, general office activities', 'Continuous, Low Frequency', 1, 1, 64.5, 62.3, 58.7, 63.2, 3, 'COMPLY', '', 'Noise primarily from air conditioning system', '2024-06-10 17:45:00', 'analyst'),
|
|
|
|
-- Facility Boundary (East)
|
|
(4, 1, 'NL-4', 'Facility Boundary (East)', 'Eastern factory boundary, close to public road', 4, -6.373111, 107.526111, 1.5, 10.0, 'Factory operations, public road traffic', 'Intermittent', 1, 1, 68.9, 67.2, 65.6, 67.8, 4, 'COMPLY', '', 'Highest noise from road traffic', '2024-06-10 17:50:00', 'analyst'),
|
|
|
|
-- Power Generator Area
|
|
(5, 1, 'NL-5', 'Power Generator Area', 'Generator area, very high noise level', 4, -6.373278, 107.524722, 1.5, 1.0, 'Power generators, cooling systems', 'Continuous, Tonal', 1, 1, 78.6, 77.5, 76.3, 77.9, 4, 'NOT_COMPLY', 'Install enclosure, add acoustic insulation', 'Noise very high even outside generator area', '2024-06-10 17:55:00', 'analyst'),
|
|
|
|
-- Nearest Residential Area
|
|
(6, 1, 'NL-6', 'Nearest Residential Area', 'Nearest residential area to factory', 1, -6.374167, 107.527222, 1.5, 300.0, 'Factory noise, general traffic', 'Intermittent, Background', 1, 1, 57.3, 55.6, 52.1, 55.9, 1, 'NOT_COMPLY', 'Install sound barriers, limit night operations', 'Factory noise still audible in residential area', '2024-06-10 18:00:00', 'analyst');
|
|
|
|
-- Sample Noise Control Recommendations
|
|
INSERT INTO trx_noise_control_recommendations (recommendation_id, measurement_detail_id, control_type, control_description, priority, estimated_cost, estimated_reduction, implementation_status, input_date, input_user)
|
|
VALUES
|
|
-- Recommendations for Production Building
|
|
(1, 2, 'Engineering Control', 'Installation of sound absorbers on walls and ceiling of production area', 1, 75000000.00, 3.5, 'PLANNED', '2024-06-15 09:00:00', 'analyst'),
|
|
(2, 2, 'Engineering Control', 'Installation of enclosure for stamping machines', 1, 120000000.00, 8.0, 'PLANNED', '2024-06-15 09:05:00', 'analyst'),
|
|
(3, 2, 'Administrative Control', 'Preventive maintenance program for production machinery', 2, 0.00, 2.0, 'PLANNED', '2024-06-15 09:10:00', 'analyst'),
|
|
(4, 2, 'PPE', 'Provision of ear muffs for workers in production area', 1, 15000000.00, 0.0, 'PLANNED', '2024-06-15 09:15:00', 'analyst'),
|
|
|
|
-- Recommendations for Power Generator Area
|
|
(5, 5, 'Engineering Control', 'Installation of acoustic enclosure for generators', 1, 200000000.00, 15.0, 'PLANNED', '2024-06-15 09:20:00', 'analyst'),
|
|
(6, 5, 'Engineering Control', 'Installation of silencers on air intake and exhaust', 1, 85000000.00, 6.0, 'PLANNED', '2024-06-15 09:25:00', 'analyst'),
|
|
(7, 5, 'Administrative Control', 'Relocate generators further from office areas and property boundaries', 2, 350000000.00, 10.0, 'PLANNED', '2024-06-15 09:30:00', 'analyst'),
|
|
|
|
-- Recommendations for Nearest Residential Area
|
|
(8, 6, 'Engineering Control', 'Installation of noise barrier along factory boundary facing residential area', 1, 180000000.00, 5.0, 'PLANNED', '2024-06-15 09:35:00', 'analyst'),
|
|
(9, 6, 'Administrative Control', 'Restriction of noisy equipment operation during night time', 1, 0.00, 3.0, 'PLANNED', '2024-06-15 09:40:00', 'analyst'),
|
|
(10, 6, 'Administrative Control', 'Regular noise monitoring program at residential boundary', 2, 30000000.00, 0.0, 'PLANNED', '2024-06-15 09:45:00', 'analyst'); |