{"id":16551427,"url":"https://github.com/blackode/atria_power","last_synced_at":"2025-07-24T20:05:21.594Z","repository":{"id":83816968,"uuid":"298365572","full_name":"blackode/atria_power","owner":"blackode","description":"A simple proof-of-concept application which can store sensor data (eg. temperature sensor data)","archived":false,"fork":false,"pushed_at":"2020-09-29T07:53:43.000Z","size":316,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T16:46:29.800Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blackode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2020-09-24T18:39:33.000Z","updated_at":"2020-09-29T07:53:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"72be383c-a989-4871-ac01-ba49388e427e","html_url":"https://github.com/blackode/atria_power","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blackode/atria_power","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackode%2Fatria_power","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackode%2Fatria_power/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackode%2Fatria_power/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackode%2Fatria_power/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blackode","download_url":"https://codeload.github.com/blackode/atria_power/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackode%2Fatria_power/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266897218,"owners_count":24002642,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-11T19:37:17.080Z","updated_at":"2025-07-24T20:05:21.536Z","avatar_url":"https://github.com/blackode.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Welcome AtriaPower\n\n![Project Out Line Image](AtriaPower.png)\n\n## Project Highlighted Module\n\n### AtriaPower.TempServer\nThis module simulates a sensor sending data using `GenServer` named as \n`AtriaPower.TempServer`.\n\nIt will start as soon as our phoenix app runs but it will be in a *disabled* \nstate by default. An option is provided to enable this sensor.\n\n### Note\nAfter enabled, It keeps posting data for every minute. Wait for couple of minutes to reflect the data into DataBase.\n\n## Development Technologies\nAt the moment of developing this project, I used the following versions of\nElixir and Erlang.\n\n```elixir\niex\u003e mix hex.info \n\nHex:    0.20.5\nElixir: 1.10.4\nOTP:    23.0.3\n\nBuilt with: Elixir 1.10.0 and OTP 21.3\n\n```\n## Starting Application\n\nTo start the Phoenix server:\n\n  * Install dependencies with `mix deps.get`\n  * Create and migrate your database with `mix ecto.setup`\n  * Install Node.js dependencies with `npm install` inside the `assets` directory\n  * Start Phoenix endpoint with `mix phx.server`\n\nNow you can visit [`localhost:4000`](http://localhost:4000) from your browser.\n\n## API EndPoints\n\n  * GET   `/` Basic index route to alll available routes\n  * GET   `/sensors/enable/:sensor_type` To enable specific sensor to send data ex.. `/sensors/enable/temparature`\n  * GET   `/sensors/disable/:sensor_type` To disable specific sensor from sending data ex.. `/sensors/disable/temparature`\n  * GET   `/data_packets` To list out all packets in the given date time range, default it uses present day\n  * POST  `/data_packets/search` A post request for filtering the datapackets based date and time including sensor\n  * POST  `/data_packets` Used to send the packet from server to db - A storing purpose of a packet. \n\n## Database Setup\nFor quick setup I used the default values of *Postgres* database.\n\nThe following configuration is used\n\n```elixir\n  username: \"postgres\",\n  password: \"postgres\",\n  database: \"atria_power_dev\",\n  hostname: \"localhost\",\n```\nMake sure to run a postgres server with above credentials. If not, then update \nthe config inside `config/dev.exs` under `config :atria_power, AtriaPower.Repo`\n\nA data migration file added to create a table named `data_packets`.\n\nThis table comprises the following schema\n\n```elixir\n  schema \"data_packets\" do\n    field :reading, :float\n    field :sensor_type, :string\n    field :timestamp, :integer #bigint\n\n    timestamps()\n  end\n```\n## External Modules used\n\n### [Timex](https://github.com/bitwalker/timex/)\nUsed for flexible timestamp values for conveting to datetime and to develop query filters based on.\n\n### [Chart.Js](https://www.chartjs.org/)\nNpm module for developing a LineChart.\n\n## Project Challenges\n  * Search Implementation (filters by datetime range)\n  * Sensor Server callbacks handling(It went on many iterations by updateing both client and server api handling funtions on requirement)\n  * Developing Charts (Making use of NodeModules inside the Phoenix)\n  \n## TIL\nLearned how to use `ChartJs` node package inside the Phoenix for developing charts over dynamic data.\nUnderstanding `Webpack.config.js` file in a deeper way like chaning paths adding entry points for new js files compilation and more.\n  \n## Overall Project Experience\nI felt it is a well framed to test core concepts of Elixir as project made me to code in all the core concepts of Elixir like `GenServers`, `Supervisors`, `Enumaration`, `Data Comprehension` and moreover it is outstanding on its own way covering the model, view, and Controller architecture concepts.\nEnjoyed in coding a `Genserver` that simulates sensor data to preserve and implementation of Data Charts using `Chart.Js` node library is a great experience.\n\nThank You :)\n\nBest Regards,\n\nAnkanna\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackode%2Fatria_power","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackode%2Fatria_power","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackode%2Fatria_power/lists"}