Skip to content

Commit 63a3886

Browse files
authored
Merge pull request #584 from IN-CORE/release-1.19.0
Release 1.19.0
2 parents 0cf327a + a41de0a commit 63a3886

File tree

95 files changed

+5399
-2292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+5399
-2292
lines changed

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [1.19.0] - 2024-06-12
9+
10+
### Changed
11+
- Rename Social Vulnerability Analysis to Social Vulnerability Index Analysis [#556](https://github.com/IN-CORE/pyincore/issues/556)
12+
- Join dataset has an option for only keeping the table dataset fields [#299](https://github.com/IN-CORE/pyincore/issues/299)
13+
- Update Non-structural Building Damage to support flood [#562](https://github.com/IN-CORE/pyincore/issues/562)
14+
- Update flood input to non-structural building damage for combined wind-wave-surge building [#566](https://github.com/IN-CORE/pyincore/issues/566)
15+
- Rename transportation recovery analysis to traffic flow recovery analysis [#558](https://github.com/IN-CORE/pyincore/issues/558)
16+
- Rename Monte Carlo Failure Probability to Monte Carlo Limit State Probability [#557](https://github.com/IN-CORE/pyincore/issues/557)
17+
- Rename Housing Recovery to Housing Valuation Recovery Analysis [#560](https://github.com/IN-CORE/pyincore/issues/560)
18+
- Rename Building Portfolio Analysis to Building Cluster Recovery Analysis [#559](https://github.com/IN-CORE/pyincore/issues/559)
19+
- Rename nonstructural building damage [#537](https://github.com/IN-CORE/pyincore/issues/537)
20+
- Rename building damage to building structural damage [#561](https://github.com/IN-CORE/pyincore/issues/561)
21+
22+
### Added
23+
- Gas Facility Damage Analysis [#568](https://github.com/IN-CORE/pyincore/issues/568)
24+
- Copyrights to transportation recovery analysis [#579](https://github.com/IN-CORE/pyincore/issues/579)
25+
- Buyout Model Analyses [#539](https://github.com/IN-CORE/pyincore/issues/539)
26+
- Google Analytics to the documentation site [#547](https://github.com/IN-CORE/pyincore/issues/547)
27+
28+
### Fixed
29+
- Permission error in clearing cache process [#563](https://github.com/IN-CORE/pyincore/issues/563)
30+
- Out of index error in dfr3 service's property conversion when the rule is not found [#555](https://github.com/IN-CORE/pyincore/issues/555)
31+
832

933
## [1.18.1] - 2024-04-30
1034

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ COPY requirements.txt .
1111

1212
ENV PATH "$MAMBA_ROOT_PREFIX/bin:$PATH"
1313
RUN micromamba install -y -n base -c conda-forge \
14+
beautifulsoup4 \
1415
sphinx sphinx_rtd_theme \
1516
-f requirements.txt
1617

1718
# copy code and generate documentation
1819
COPY . ./
1920
RUN sphinx-build -v -b html docs/source docs/build
2021

22+
# Run the insert_ga_to_header.py script to insert Google Analytics code
23+
RUN python /src/docs/source/insert_ga_to_header.py
24+
2125
# ----------------------------------------------------------------------
2226
# Building actual container
2327
# ----------------------------------------------------------------------
2428
FROM nginx
2529

2630
COPY --from=builder /src/docs/build/ /usr/share/nginx/html/doc/pyincore/
31+
COPY config /usr/share/nginx/html/doc/pyincore/config

config/config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"GA_KEY": "Test-Google-Analytics-Key-Replace-Me"
3+
}

config/googleAnalytics.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// analytics.js
2+
(function() {
3+
// Fetch the runtime configuration
4+
fetch('config/config.json')
5+
.then(response => {
6+
if (!response.ok) {
7+
throw new Error('Configuration file not found');
8+
}
9+
return response.json();
10+
})
11+
.then(config => {
12+
if (!config.GA_KEY) {
13+
throw new Error('GA_KEY is missing in the configuration');
14+
}
15+
16+
// Create the script tag for Google Tag Manager
17+
const scriptTag = document.createElement('script');
18+
scriptTag.async = true;
19+
scriptTag.src = `https://www.googletagmanager.com/gtag/js?id=${config.GA_KEY}`;
20+
document.head.appendChild(scriptTag);
21+
22+
// Initialize Google Analytics
23+
window.dataLayer = window.dataLayer || [];
24+
25+
function gtag() { dataLayer.push(arguments); }
26+
27+
gtag('js', new Date());
28+
gtag('config', config.GA_KEY);
29+
})
30+
.catch(error => console.warn('GA setup skipped:', error.message));
31+
})();

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
author = ''
3434

3535
# The short X.Y version
36-
version = '1.18'
36+
version = '1.19'
3737
# The full version, including alpha/beta/rc tags
38-
release = '1.18.1'
38+
release = '1.19.0'
3939

4040
# -- General configuration ---------------------------------------------------
4141

docs/source/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ To **update** pyIncore run the following command:
1818
:name: mastertoc
1919

2020
mod_top
21-
refs
21+
refs
22+

docs/source/insert_ga_to_header.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import os
2+
from bs4 import BeautifulSoup
3+
4+
# Directory containing the built HTML files
5+
build_dir = "docs/build"
6+
7+
# Google Analytics code snippet to insert into the HTML files
8+
ga_code = f"""
9+
<script>
10+
// Fetch and execute the analytics script
11+
fetch('config/googleAnalytics.js')
12+
.then(response => response.text())
13+
.then(scriptContent => {{
14+
const scriptTag = document.createElement('script');
15+
scriptTag.textContent = scriptContent;
16+
document.head.appendChild(scriptTag);
17+
}})
18+
.catch(error => console.error('Failed to load analytics script:', error));
19+
</script>
20+
"""
21+
22+
# Loop through each HTML file in the build directory
23+
for filename in os.listdir(build_dir):
24+
if filename.endswith(".html"):
25+
filepath = os.path.join(build_dir, filename)
26+
print(f"Processing file: {filepath}")
27+
28+
# Read the content of the HTML file
29+
with open(filepath, "r", encoding="utf-8") as file:
30+
html_content = file.read()
31+
32+
# Parse HTML content using BeautifulSoup
33+
soup = BeautifulSoup(html_content, "html.parser")
34+
35+
# Find the <head> tag and insert the Google Analytics code before it
36+
head_tag = soup.find("head")
37+
if head_tag:
38+
print(f"Found <head> tag in {filename}:")
39+
print("Inserting Google Analytics code...")
40+
head_tag.insert(0, BeautifulSoup(ga_code, "html.parser"))
41+
42+
# Write the modified HTML content back to the file
43+
with open(filepath, "w", encoding="utf-8") as file:
44+
file.write(str(soup))
45+
46+
print("Google Analytics code insertion completed.")

0 commit comments

Comments
 (0)