{"id":18819008,"url":"https://github.com/geoscienceaustralia/sira","last_synced_at":"2025-04-13T23:32:59.790Z","repository":{"id":43386724,"uuid":"45427097","full_name":"GeoscienceAustralia/sira","owner":"GeoscienceAustralia","description":"Systemic Infrastructure Resilience Analysis","archived":false,"fork":false,"pushed_at":"2025-03-06T01:27:04.000Z","size":54899,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-03-27T13:46:10.135Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://geoscienceaustralia.github.io/sira/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GeoscienceAustralia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-02T22:46:27.000Z","updated_at":"2025-03-06T01:14:07.000Z","dependencies_parsed_at":"2025-03-06T02:23:17.251Z","dependency_job_id":"5fec509a-1ca9-4d5e-99cb-24e6e109dfd9","html_url":"https://github.com/GeoscienceAustralia/sira","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeoscienceAustralia%2Fsira","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeoscienceAustralia%2Fsira/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeoscienceAustralia%2Fsira/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GeoscienceAustralia%2Fsira/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GeoscienceAustralia","download_url":"https://codeload.github.com/GeoscienceAustralia/sira/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248797015,"owners_count":21163066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T00:19:48.331Z","updated_at":"2025-04-13T23:32:54.778Z","avatar_url":"https://github.com/GeoscienceAustralia.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":":toc: macro\n:toc-title:\n:toclevels: 4\n\n# SIRA\n\nimage:https://github.com/GeoscienceAustralia/sira/actions/workflows/build-test-linux.yml/badge.svg?branch=master[\"CI on Linux\", link=\"https://github.com/GeoscienceAustralia/sira/actions/workflows/build-test-linux.yml\"]\nimage:https://github.com/GeoscienceAustralia/sira/actions/workflows/build-test-win.yml/badge.svg?branch=master[\"CI on windows\", link=\"https://github.com/GeoscienceAustralia/sira/actions/workflows/build-test-win.yml\"]\nimage:https://codecov.io/gh/GeoscienceAustralia/sira/branch/master/graph/badge.svg[\"codecov\", link=\"https://codecov.io/gh/GeoscienceAustralia/sira\"]\n\ntoc::[]\n\n## Overview\n\nThe detailed documentation is at this https://geoscienceaustralia.github.io/sira/[link].\n\nSIRA stands for **Systemic Infrastructure Resilience Analysis**.\nIt represents a methodology and supporting code for systematising vulnerability\nanalysis of lifeline infrastructure to natural hazards (i.e. response of\ninfrastructure assets to environmental excitation). SIRA is open source.\n\nThe impact assessment is based on the fragilities and configuration of\ncomponents that comprise the infrastructure system under study. The analytical\nprocess is supplemented by an assessment of the system functionality through\nthe post-damage network flow analysis, and approximations for recovery\ntimeframes.\n\nThe current focus has been on studying responses of infrastructure facilities\n(e.g. power generation plants, high voltage substations). Considerable work\nhas been done in the code backend to extend the same methodology to modelling\nnetwork vulnerability as well (e.g. electricity transmission networks).\n\nSIRA models are based on graph theory. All infrastructure systems are\nrepresented as networks. This allows an user to develop arbitrarily complex\nmodels of a infrastructure facility or a network to be used in\nimpact simulation.\n\n\n## Setup Instructions\n\nIt is good practice to set up a virtual environment for working with\ndeveloping code. This gives us the tools to manage the package\ndependencies and requirements in a transparent manner, and impact of\ndependency changes on software behaviour.\n\nThe system is currently being designed as microservices implemented in\ndocker containers. If you have docker installed on your system it is\nprobably easiest to use the containers as described below.\n\n### Building the Run Environment Using Docker\n\nDocker configuration is the preferred way to deploy the application.\nThe process of building the docker images and container are outlined below:\n\nStep 1: Delete all containers\n\n    $ docker rm $(docker stop $(docker ps -aq))\n\nStep 2: Delete all images\n\n    $ docker rmi $(docker images --filter \"dangling=true\" -q)\n\nStep 3: Build the docker image\n\n    $ docker build -t siraimg . --build-arg CACHE_DATE=\"$(date)\"\n\n### Required Directory Structure\n\nTo set up a scenario or impact simulation project, SIRA expects the following\ndirectory structure:\n\n```\n    scenario_dir/\n    └── model_x\n        │\n        ├── input\n        │   ├── config_assetx.json\n        │   └── model_assetx.json\n        └── output\n            ├── ...\n            └── ...\n```\n\nExplanation of the required structure is as follows:\n\n    - 'scenario directory' - it can be named anything\n    - within the scenario directory, there must exist a uniquely named\n      'model directory' for each scenario or run event.\n    - within the 'model directory', the 'input' dir must have two files, in\n      specified format:\n\n        - a model file: it must have the term 'model' at the beginning or\n          end of the file name\n        - a config file: it must have the term 'config' at the beginning or\n          end of the file name\n\n    - the outputs are saved in the 'output' dir. If it does not exist, the code\n      will create it at the beginning of the simulation.\n\n\n## Running the Application\n\nThe application can be run in a number of modes. The relevant options are:\n\n  -d \u003cpath_to_input_dir\u003e, --input_directory \u003cpath_to_input_dir\u003e\n  -s, --simulation\n  -f, --fit\n  -l, --loss_analysis\n\nThe following code snippets assume that it is being run from the root\ndirectory of the SIRA code, and the model of interest is in the location\n`sira/scenario_dir/ci_model_x`.\n\nThe following code runs the simulation and the post processing simultanrously:\n\n    $ python sira -d scenario_dir/ci_model_x -sfl\n\nTo run only the Monte Carlo simulation without post-processing:\n\n    $ python sira -d scenario_dir/ci_model_x -s\n\nTo run both the model fitting and the loss analysis code:\n\n    $ python sira -d scenario_dir/ci_model_x -fl\n\nNote that the model fitting and loss analysis steps require that the\ninitial simulation be run first so that it has the initial output data\nto perform the analysis on.\n\n### Option #1: Run a simulation and destroy the container when done\n\nThe following command simulataneously does the following:\nbind mounts a volume in docker, creates a container in interactive mode,\nruns a simulation, then destroys the container after simulation ends.\n\n    $ docker run -it --rm -v /abs/local/path/\u003cscenario_dir\u003e:/\u003cscenario_dir\u003e \\\n      siraimg:latest \\\n      python sira -d \u003cscenario_dir\u003e -sfl --aws\n\n### Option #2: Build a container for reuse / experimentation\n\nFirst, build a docker container from the prebuilt image.\n\n    $ docker create --name=sira_x -it siraimg:latest\n\nThen start and attach the container:\n\n    $ docker start sira_x\n    $ docker attach sira_x\n\nIt is possible to combine the above steps in one:\n\n    $ docker start -a -i sira_x\n\nRun the sira code for the scenario in the specified directory:\n\n    $ python sira -d /path/to/scenario_dir -sfl\n\nThe process for accessing the required data for simulation from within\ndocker are discussed in the following sections.\n\n#### Copy data into the container\n\nFrom outside of docker, on a terminal, use the following command to\ncopy the project folder from container to host:\n\n    $ docker cp $(docker ps -alq):/from/path/in/container /to/path/in/host/\n\nThis keeps all data and code contained within the single container.\nBut it has the disadvantage that the data is not persistent -- if we\ndelete the container, we also lose the data and outputs.\n\n#### Bind a local directory to a path in Docker container\n\nWhen setting up to run a docker container, it might be useful to bind a\nlocal directory on the host (source) to a directory on the container\n(destination or target). This allows us to access data on the specified\nlocation on the local drive, and write outputs there, from within the\ncontainer. The generic command to achieve this is:\n\n    $ docker run -it \\\n      --name=docker_container_name \\\n      --mount source=/path/in/local/host/,\\\n      destination=/path/in/container,type=bind docker_image_name:latest\n\nA specific example might look like the following:\n    $ docker run -it \\\n      --name=sira_x \\\n      --mount source=/Users/x/code/models/,\\\n      destination=/models,type=bind sira_img:latest\n\nThis process maintains the separation of code and data. And data\npersistence is maintained -- we can build and delete a container\nwithout affecting the data.\n\n## Testing\n\nTo run the tests, user needs to be in the root directory of the code,\ne.g. `~/code/sira`. Then simply run:\n\n    $ pytest\n\nIf you want to explicitly ask `pytest` to run coverage reports, then run:\n\n    $ pytest --cov-report term --cov=sira tests/\n\nIf you are using docker as described above, you can do this from within the\nsira container.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeoscienceaustralia%2Fsira","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeoscienceaustralia%2Fsira","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeoscienceaustralia%2Fsira/lists"}