{"id":22326017,"url":"https://github.com/solarnetwork/sn-agg-query","last_synced_at":"2025-03-26T06:11:44.797Z","repository":{"id":57364427,"uuid":"58167092","full_name":"SolarNetwork/sn-agg-query","owner":"SolarNetwork","description":"Small node utility to export SolarNetwork data as CSV, aggregated by date.","archived":false,"fork":false,"pushed_at":"2017-08-02T02:11:41.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-02T01:07:49.770Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/SolarNetwork.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}},"created_at":"2016-05-05T23:32:41.000Z","updated_at":"2016-05-05T23:35:11.000Z","dependencies_parsed_at":"2022-09-13T21:11:05.607Z","dependency_job_id":null,"html_url":"https://github.com/SolarNetwork/sn-agg-query","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolarNetwork%2Fsn-agg-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolarNetwork%2Fsn-agg-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolarNetwork%2Fsn-agg-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolarNetwork%2Fsn-agg-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SolarNetwork","download_url":"https://codeload.github.com/SolarNetwork/sn-agg-query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245598320,"owners_count":20641884,"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-12-04T02:15:04.480Z","updated_at":"2025-03-26T06:11:44.775Z","avatar_url":"https://github.com/SolarNetwork.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SolarNetwork Aggregate Query Tool\n\nThis is a small node utility that can export SolarNetwork data as CSV,\naggregated by date. The tool will query SolarNetwork for data based\non the provided arguments, and then combine all result rows that \noccur on the same date into a single aggregate sum result for that\ndate.\n\nFor example, if a raw query were to return data like\n\n```csv\ncreated,nodeId,sourceId,wattHours\n\"2017-01-01 00:00:00.000Z\",123,\"A\",1000.0\n\"2017-01-01 00:00:00.000Z\",123,\"B\",555.0\n```\n\nthis tool would combine those two rows because they have the same\n`created` value into a single row like this:\n\n```csv\ncreated,nodeId,wattHours\n\"2017-01-01 00:00:00.000Z\",123,1555.0\n```\n\nNotice the `wattHours` value is the aggregate sum of the two raw\nrecords.\n\n# Usage\n\n```\nUsage: node sn-agg-query.js [OPTION] [query]\n\nCombine query results by date, adding their values together.\nAlternatively, can output the raw data without aggregation.\n\n  -r, --raw              output raw, unaggregated results\n  -n, --node=ID          the node ID\n  -p, --source=ID+       a source ID (can be provided more than once)\n  -s, --start=DATE       the starting date, as yyyy-MM-dd HH:mm\n  -e, --end=DATE         the ending date, as yyyy-MM-dd HH:mm\n  -a, --aggregation=AGG  the aggregate level, e.g. Hour\n  -h, --help             show this help\n```\n\nNote that multiple `source` arguments may be provided, for example\n\n    node sn-agg-query.js --node=123 --source=A --source=B ...\n\n# Development\n\nThis tool was created as a demonstration of using the [SolarNetwork API\nCore][core] and [SolarNetwork Datum Loader][loader] packages.\n\n [core]: https://github.com/SolarNetwork/sn-api-core-js\n [loader]: https://github.com/SolarNetwork/sn-datum-loader-js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolarnetwork%2Fsn-agg-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolarnetwork%2Fsn-agg-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolarnetwork%2Fsn-agg-query/lists"}