{"id":42664630,"url":"https://github.com/code4romania/seismic-risc","last_synced_at":"2026-01-29T10:01:43.575Z","repository":{"id":36148692,"uuid":"199031769","full_name":"code4romania/seismic-risc","owner":"code4romania","description":"Web app for keeping track of buildings in danger of collapsing in the event of an earthquake","archived":false,"fork":false,"pushed_at":"2024-05-03T22:18:42.000Z","size":16009,"stargazers_count":34,"open_issues_count":11,"forks_count":67,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-05-03T23:27:11.850Z","etag":null,"topics":["civic-tech","code4ro","crowdsourcing","django","earthquakes","javascript","python","react"],"latest_commit_sha":null,"homepage":"https://seismic-risc.vercel.app/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code4romania.png","metadata":{"funding":{"github":"code4romania","custom":["https://code4.ro/en/donate/"]},"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":"2019-07-26T14:33:45.000Z","updated_at":"2024-05-03T23:27:13.301Z","dependencies_parsed_at":"2024-01-22T23:28:34.828Z","dependency_job_id":"c561686b-37c3-4737-8dda-c60263331d02","html_url":"https://github.com/code4romania/seismic-risc","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/code4romania/seismic-risc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4romania%2Fseismic-risc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4romania%2Fseismic-risc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4romania%2Fseismic-risc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4romania%2Fseismic-risc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code4romania","download_url":"https://codeload.github.com/code4romania/seismic-risc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4romania%2Fseismic-risc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28875445,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T09:47:23.353Z","status":"ssl_error","status_checked_at":"2026-01-29T09:47:19.357Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["civic-tech","code4ro","crowdsourcing","django","earthquakes","javascript","python","react"],"created_at":"2026-01-29T10:01:42.789Z","updated_at":"2026-01-29T10:01:43.563Z","avatar_url":"https://github.com/code4romania.png","language":"JavaScript","funding_links":["https://github.com/sponsors/code4romania","https://code4.ro/en/donate/"],"categories":[],"sub_categories":[],"readme":"# Acasă în Siguranță\n\n[![GitHub contributors](https://img.shields.io/github/contributors/code4romania/seismic-risc.svg)](https://github.com/code4romania/seismic-risc/graphs/contributors)\n[![GitHub last commit](https://img.shields.io/github/last-commit/code4romania/seismic-risc.svg)](https://github.com/code4romania/seismic-risc/commits/develop)\n[![License: MPL 2.0](https://img.shields.io/badge/license-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)\n\n\u003c!-- Social icons from https://github.com/konsav/social-icons --\u003e\n\n[![code for romania twitter][1.1]][1]\n[![code for romania facebook][2.1]][2]\n[![code for romania instagram][3.1]][3]\n[![code for romania linkedin][4.1]][4]\n\n\u003c!-- links to social media icons --\u003e\n\n[1.1]: https://raw.githubusercontent.com/code4romania/.github/main/social_icons/social_img_twitter.png\n\n[1]: https://twitter.com/Code4Romania\n\n[2.1]: https://raw.githubusercontent.com/code4romania/.github/main/social_icons/social_img_facebook.png\n\n[2]: https://facebook.com/code4romania/\n\n[3.1]: https://raw.githubusercontent.com/code4romania/.github/main/social_icons/social_img_instagram.png\n\n[3]: https://instagram.com/code4romania/\n\n[4.1]: https://raw.githubusercontent.com/code4romania/.github/main/social_icons/social_img_linkedin.png\n\n[4]: https://linkedin.com/in/code4romania/\n\n\u003c!-- social media icons section end --\u003e\n\n:romania: Un cutremur în București nu este o situație ipotetică. Este o certitudine că acest lucru se va întâmpla. În\nacest context, la mai bine de 40 de ani de la cutremurul din 1977, memoria colectivă a ascuns în profunzime amintirile\nacelui dezastru în încercarea de a-și înăbuși teama. Dar realitatea este că, patru decenii mai târziu, Bucureștiul, la\nfel ca restul orașelor cu risc seismic ridicat, nu ar face față unui asemenea eveniment, iar pierderile de vieți\nomenești ar fi uriașe.\n[Exercițiul Seism 2018](https://www.news.ro/social/exercitiul-seism-2018-cel-mai-recent-bilant-al-cutremurului-simulat-indica-peste-3-900-de-morti-peste-7-000-de-raniti-si-peste-2-300-de-persoane-disparute-1922405315222018102018579831)\nderulat de DSU arată că cel puţin 4.587 persoane şi-ar pierde viaţa, iar 8.585 ar fost rănite, 6 spitale vor fi\ndistruse, 23 de unităţi spitaliceşti distruse parţial, iar 9 avariate, dar funcţionale. O estimare, am spune noi, destul\nde optimistă.\n\nCe putem face pentru a deveni mai puțin vulnerabili? Să știm totul despre oraș, despre clădirile în care locuim astfel\nîncât să putem cere consolidarea lor. Acasă în Siguranță nu este doar \"un nou site de informare\", ci o platformă care\ncolectează și validează apoi cu experți date despre clădirile din România, la nivel național, ajută asociațiile de\nproprietari să își consolideze clădirile, te ține la curent cu legislația și ți-o explică și are grijă să ai la îndemână\ninformații utile la orice moment.\n\n:gb: An earthquake in Bucharest is not a hypothetical situation. It is certain that this will happen. In this context,\nafter more than 40 years from the 1977 earthquake, the collective memory has hidden deep the memories of that disaster\nin its attempt of stifling its fear. The reality is that, four decades later, Bucharest, as well as the rest of the\ncities with a high seismic risk, would not stand up tu such an event, and the loss of life would be tremendous.\n[The Earthquake 2018 Exercise](https://www.romania-insider.com/seism-2018-exercise-bucharest) conducted by the DSU shows\nthat at least 4,587 people would have died and 8,585 would have been injured, 6 hospitals would be destroyed, 23 more\nwould be partially destroyed, and 9 would be damaged, though still functional. An estimation that we would consider\nquite optimistic.\n\nWhat can we do to become less vulnerable? Find out everything about the city, about the buildings in which we live so\nthat we can ask for their consolidation. Home Safe is not just \"a new information site\", but a platform that collects\nand then validates with the help of experts data about the buildings in Romania, at a national level, it helps owners\nassociations to consolidate their buildings, it keeps you in touch with the current legislation and explains it to you,\nand it makes sure that you have useful information at your disposal at all times.\n\n**Let's save lives together.**\n\n\u003cdetails\u003e\n  \u003csummary\u003e \u003cb\u003e TABLE OF CONTENTS\u003c/b\u003e \u003ci\u003e(click to expand)\u003c/i\u003e \u003c/summary\u003e\n\n\u003c!-- TOC --\u003e\n* [Acasă în Siguranță](#acasă-în-siguranță)\n  * [Contributing](#contributing)\n  * [Built With](#built-with)\n    * [Programming languages](#programming-languages)\n    * [Frameworks](#frameworks)\n    * [Package managers](#package-managers)\n    * [Code styling](#code-styling)\n    * [Database technology \u0026 provider](#database-technology--provider)\n  * [Getting started](#getting-started)\n    * [Pre-requisites](#pre-requisites)\n    * [Initial set-up](#initial-set-up)\n      * [Initialising all the services](#initialising-all-the-services)\n      * [Backing up and restoring the database in case of an upgrade](#backing-up-and-restoring-the-database-in-case-of-an-upgrade)\n    * [Environment variables](#environment-variables)\n      * [Deployment variables](#deployment-variables)\n      * [External services API keys](#external-services-api-keys)\n        * [HERE Maps API Key](#here-maps-api-key)\n        * [hCAPTCHA API Key](#hcaptcha-api-key)\n    * [Starting the project](#starting-the-project)\n    * [Starting the project without docker](#starting-the-project-without-docker)\n      * [Windows platform](#windows-platform)\n        * [Prerequisites](#prerequisites)\n        * [Steps to set your environment](#steps-to-set-your-environment)\n      * [Steps needed to start development servers](#steps-needed-to-start-development-servers)\n    * [Development](#development)\n    * [Known Issues](#known-issues)\n      * [Client hot-reload on Windows Docker is not working](#client-hot-reload-on-windows-docker-is-not-working)\n      * [In VS Code, ESLint fails to load the Prettier plugin](#in-vs-code-eslint-fails-to-load-the-prettier-plugin)\n  * [Management Commands](#management-commands)\n  * [Testing](#testing)\n  * [Production](#production)\n  * [Client Deployment](#client-deployment)\n  * [Feedback](#feedback)\n  * [License](#license)\n  * [About Code4Ro](#about-code4ro)\n\u003c!-- TOC --\u003e\n\n\u003c/details\u003e\n\n## Contributing\n\nIf you would like to contribute to one of our repositories, first identify the scale of what you would like to\ncontribute. If it is small (grammar/spelling, or a bug fix) feel free to start working on a fix. If you are submitting a\nfeature or substantial code contribution, please discuss it with the team and ensure it follows the product roadmap.\n\nOur collaboration model [is described here](https://github.com/code4romania/.github/blob/main/CONTRIBUTING.md).\n**And make sure you check the [workflow document](https://github.com/code4romania/.github/blob/main/WORKFLOW.md)**;\nit helps you keep your environment in a good shape, and it helps everyone move faster with code reviews.\nIf you want to make any change to this repository, please **make a fork first**.\n\nWe don't have a specific set of coding guidelines, so just follow the way the code was written until now, if in doubt,\nyou can use [Google's style guide](http://google.github.io/styleguide/pyguide.html).\n\n## Built With\n\n### Programming languages\n\n[Python 3](https://www.python.org)\n[JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)\n\n### Frameworks\n\n**Backend:** [Django](https://www.djangoproject.com)\n**Client:** [React](https://reactjs.org/)\n\n### Package managers\n\n**Backend:** [pip](https://pypi.org/)\n**Client:** [npm](https://www.npmjs.com/)\n\n### Code styling\n\n**Backend:** [Black](https://black.readthedocs.io/en/stable/)\n**Client:** [Prettier](https://prettier.io/) + [ESLint](https://eslint.org/) + [Airbnb style guide](https://github.com/airbnb/javascript)\n\n### Database technology \u0026 provider\n\n[PostgreSQL](https://www.postgresql.org)\n\n## Getting started\n\nRisc Seismic backend is a Django application, built on top of Python 3.9+ with a PostgreSQL database. The Client is a React\nsingle page application.\n\n### Pre-requisites\n\nIn order to run the project locally, you need to have [Docker](https://docs.docker.com/install/)\nand [docker-compose](https://docs.docker.com/compose/overview/) installed.\n\nYou can install the above-mentioned packages manually, or you can use our helper commands.\n\nOn `Ubuntu` run:\n\n```shell\nmake install-docker-ubuntu\n```\n\nOn `MacOS` run:\n\n```shell\nmake install-docker-osx\n```\n\nOn other platforms please follow the instructions described here:\n\n- \u003chttps://docs.docker.com/install/\u003e\n- \u003chttps://docs.docker.com/compose/install/\u003e\n\n### Initial set-up\n\n#### Initialising all the services\n\nMake sure to check the [Environment variables](#environment-variables)\nsection for info on how to set up the keys before you run the following commands:\n\n```shell\ncp .env.example.dev .env.dev\n# build the development container\nmake build-dev\n```\n\nIf you didn't set up the `RUN_LOAD_INITIAL_DATA` variable, you can add dummy data to the database with the following command:\n\n```shell\nmake build-dev\n```\n\nIf the `RUN_LOAD_INITIAL_DATA` was `yes`, then you should have dummy data but will have to create a superuser:\n\n```shell\ndocker-compose exec api ./manage.py createsuperuser\n```\n\n#### Backing up and restoring the database in case of an upgrade\n\n1. Create a back-up of the data\n   (the `build` folder is ignored by git)\n\n    ```shell\n    docker-compose exec db pg_dumpall -U postgres \u003e ./build/backup.sql\n    ```\n\n2. Run the database upgrade or just get the latest version of the code from git if it upgrades the database\n\n    ```shell\n    git pull upstream develop\n    ```\n\n3. Remove the current database and start-up the environment\n   (remove the `-dev` part if you don't want the development mode)\n\n    ```shell\n    make drop-db \u0026\u0026 make build-dev\n    ```\n\n4. Restore the backed-up data to the new database\n\n    ```shell\n    docker-compose exec db psql -U postgres \u003c ./build/backup.sql\n    ```\n\n5. Check the API endpoints and that you can log in the admin interface with the same users as before\n\n### Environment variables\n\n#### Deployment variables\n\nThe following variables change the way the backend is deployed.\n\n`RUN_MIGRATIONS`\nRun the initial migrations (sets up the data models from the database).\n\n`RUN_LOAD_INITIAL_DATA`\nAdds real \u0026 dummy data to the database (adds buildings, datafiles, and statistics).\n\n`RUN_COLLECT_STATIC`\nCollects static files so that they can be easily served to production.\n\n`RUN_DEV_SERVER`\nRuns the application in the development mode.\n\n#### External services API keys\n\nTo have a fully functional project, you have to get two API keys: HERE Maps API Key and hCAPTCHA API Key.\n\n##### HERE Maps API Key\n\nTutorial: [https://developer.here.com/tutorials/getting-here-credentials/](https://developer.here.com/tutorials/getting-here-credentials/)\n\nKeys added to the `.env` file:\n\n```shell\n# the same key can be used for both variables\nHERE_MAPS_API_KEY\nREACT_APP_HERE_MAPS_API_KEY\n```\n\n##### hCAPTCHA API Key\n\n1. [Create a hCAPTCHA account](https://dashboard.hcaptcha.com/signup)\n2. Go to [your settings page](https://dashboard.hcaptcha.com/settings)\n3. Create a New Site, copy the Site Key and add it to the environment variables list\n\nKeys added to the `.env` file:\n\n```shell\nREACT_APP_CAPTCHA_API_KEY\n```\n\n### Starting the project\n\nFirst check the `.env` file created by the init command and see if there are any environment variables that you might\nneed to provide or change. This file is used by `docker-compose` to pass the environment variables to the container it\ncreates.\n\nGet the project up and running:\n\n```shell\ndocker-compose up\n```\n\nYou should be able to access the local environment site and admin at the following URLs:\n\n- \u003chttp://localhost:8030/api/v1/\u003e\n- \u003chttp://localhost:8030/\u003e\n\nIf you have problems starting the project, first check out\nthe [FAQ](https://github.com/code4romania/seismic-risc/wiki/FAQ) and if that doesn't work, ask someone from the\nproject's channel. Maybe the issue you just had is worth adding to\nthe [FAQ](https://github.com/code4romania/seismic-risc/wiki/FAQ), wouldn't it?\n\nTo work on running containers that were started using `docker-compose up`, open another terminal and:\n\n```shell\ncd path/to/repo\ndocker-compose exec api some_container_command\n# or\ndocker-compose exec client some_container_command\n```\n\nTo see all available commands, run:\n\n```shell\nmake help\n```\n\n### Starting the project without Docker\n\n#### Windows platform\n\n##### Prerequisites\n\n1. [PostgreSQL](https://www.enterprisedb.com/postgresql-tutorial-resources-training?cid=55)\n2. [Python 3.9](https://www.python.org/downloads/release/python-399/)\n3. [Node.js](https://nodejs.org/dist/v14.16.0/node-v14.16.0-x64.msi)\n\n##### Steps to set your environment\n\n1. In project directory run:\n\n    ```shell\n    python -m venv .venv\n    .venv\\Scripts\\activate.bat\n    pip install -r ./backend/requirements-dev.txt\n    copy .env.dev .env\n    ```\n\n2. Check the .env file created by the copy command and see if there are any environment variables that you might need to\n   provide or change. Double check database config line in .env. It has to follow this\n   pattern: `postgres://USER:PASSWORD@HOST:PORT/NAME`\n\n3. Run following to set the needed environment variables:\n\n    ```shell\n    activate_dev_env.bat\n    ```\n\n4. Check database connection. If this fails double check database configuration.\n\n    ```shell\n    python backend/wait_for_db.py\n    ```\n\n5. Run migrations:\n\n    ```shell\n    python backend/manage.py migrate --no-input\n    ```\n\n6. Create admin user (user to login into admin panel):\n\n    ```shell\n    python backend/manage.py createsuperuser\n    ```\n\n7. Load dummy data in database:\n\n    ```shell\n    python backend/manage.py loaddata statistics\n    python backend/manage.py loaddata buildings\n    python backend/manage.py loaddata pages\n    ```\n\n8. Install node modules.\n\n    ```shell\n    cd client\n    npm install\n    ```\n\n#### Steps needed to start development servers\n\n*1. Start backend server.*\n\nOpen terminal in the project directory and run environment activation script, then start the server.\n\n```shell\n.venv\\Scripts\\activate.bat\nactivate_dev_env.bat\npython backend\\manage.py runserver 0.0.0.0:8030\n```\n\nCheck functionality at http://localhost:8030 you should get a 404 page.\n\n*2. Start front-end server.*\n\nOpen terminal in the project directory and run environment activation script, then start the server.\n\n```shell\nactivate_dev_env.bat\ncd client\nnpm start\n```\n\nCheck functionality at http://localhost:3000.\n\n### Development\n\nWhen creating new models in Django, to make sure they are generated in a clean environment, it is recommended\nto generate the migration files using the `make` command:\n\n```shell\nmake makemigrations \u0026\u0026 make migrate\n```\n\nWhen you need to add/remove requirements or restrict the version of a requirement, edit the `requirements.in` (prod) and\nthe `requirements-dev.in` (dev) files accordingly. After doing this run:\n\n```shell\nmake update-requirements\n```\n\nThis will create a clean environment where it uses the [pip-tools](https://github.com/jazzband/pip-tools/) library to\ncompile the corresponding `requirements.txt` files with the versions of the packages pinned. This is important as it\nguarantees that every environment this service runs in, has the same dependencies installed and minimizes the risk\nof `works on my machine`.\n\n### Known Issues\n\n#### Client hot-reload on Windows Docker is not working\n\nTry following these steps:\n\n1. open up a terminal in **seismic-risc_client** container\n2. `cd ./node_modules/react-scripts/config/`\n3. `vi webpackDevServer.config.js`\n4. on the exported config object, update the value of `watchOptions` to include the following properties:\n\n    ```shell\n    aggregateTimeout: 100,\n    poll: 500\n    ```\n\n5. save the file and restart the client container\n\nThis way, webpack-dev-server should be watching files in polling mode, instead of listening for file change events.\n\n#### In VS Code, ESLint fails to load the Prettier plugin\n\nAdd the following option to user settings in VS Code if ESLint fails to load the Prettier plugin.\n\n```json\n{\n    \"eslint.workingDirectories\": [\n        {\n            \"mode\": \"auto\"\n        }\n    ]\n}\n```\n\n## Management Commands\n\nThe new custom command can be called using\n`python manage.py buildings \u003cnumber\u003e`\nrequired arguments:\n\n- --delete\n- --create\n\n```shell\ncd path/to/repo\ndocker-compose exec api bash\nroot@ba4fd81f9023:/code# python manage.py buildings 30 --create\n100% |███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 30/30 [00:00\u003c00:00, 37.89it/s]\nSuccessfully created 30 buildings.\nroot@ba4fd81f9023:/code# python manage.py buildings 25 --delete\nSuccessfully deleted 25 buildings.\n```\n\n## Testing\n\nLocal development testing:\n\n```shell\ncd path/to/repo\ndocker-compose exec api bash\nroot@3c5df91778ad:/code# pytest\n```\n\nPipeline testing:\n\n```shell\nmake test\n```\n\n## Production\n\nTo get the container ready for production use, we need to first build it:\n\n```shell\ndocker build -t seismic-risc:latest ./backend\n```\n\nUse the `prod.env.dist` template file and create a `prod.env` file with the correct environment variables and run like\nso:\n\n```shell\ndocker run --env-file prod.env -p HOST_PORT:GUNICORN_PORT seismic-risc:latest\n```\n\nOr, you can provide all the environment variables at runtime:\n\n```shell\ndocker run -e DJANGO_CONFIGURATION=Prod -e DJANGO_SECRET_KEY= -e DATABASE_URL=postgres://USER:PASSWORD@HOST:PORT/NAME -e GUNICORN_PORT=5000 -e GUNICORN_WORKERS_COUNT=2 -p HOST_PORT:GUNICORN_PORT seismic-risc:latest\n```\n\nAfter testing the container runs properly, tag and upload the self to Docker hub:\n\n```shell\ndocker tag seismic-risc:latest code4romania/seismic-risc:latest\ndocker push code4romania/seismic-risc:latest\n```\n\n## Client Deployment\n\n- Change directory to `./client`\n- Build the solution `npm install`\n- Start a development server `npm start`\n- Run the tests `npm test`\n- Build the solution `npm run build`\n\n## Feedback\n\n- Request a new feature on GitHub.\n- Vote for popular feature requests.\n- File a bug in GitHub Issues.\n- Email us with other feedback contact@code4.ro\n\n## License\n\nThis project is licensed under the MPL 2.0 License — see the [LICENSE](LICENSE) file for details\n\n## About Code4Ro\n\nStarted in 2016, Code for Romania is a civic tech NGO, official member of the Code for All network. We have a community\nof over 500 volunteers (developers, UX/UI, communications, data scientists, graphic designers, devops, IT security, and\nmore) who work pro bono for developing digital solutions to solve social problems. #techforsocialgood. If you want to\nlearn more details about our projects [visit our site](https://www.code4.ro/en/) or if you want to talk to one of our\nstaff members, please e-mail us at contact@code4.ro.\n\nLast, but not least, we rely on donations to ensure the infrastructure, logistics and management of our community that\nis widely spread across 11 timezones, coding for social change to make Romania and the world a better place. If you want\nto support us, [you can do it here](https://code4.ro/en/donate/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode4romania%2Fseismic-risc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode4romania%2Fseismic-risc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode4romania%2Fseismic-risc/lists"}