{"action":"created","comment":{"url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/comments/329814323","pull_request_review_id":295286562,"id":329814323,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyOTgxNDMyMw==","diff_hunk":"@@ -7,13 +7,46 @@\n import logging\n import pandas as pd\n \n-url = \"https://www.hops.hr/Home/PowerExchange\"\n+from datetime import datetime\n+\n+URL = \"https://www.hops.hr/Home/PowerExchange\"\n+\n+\n+def fetch_solar_production(feed_date, session=None, logger=logging.getLogger(__name__)):\n+    \"\"\"\n+    Calls extra resource at https://files.hrote.hr/files/EKO_BG/FORECAST/SOLAR/FTP/TEST_DRIVE/<dd.m.yyyy>.json\n+    to get Solar power production in MW.\n+    :param feed_date: date_time string from the original HOPS feed\n+    :return: Float\n+    \"\"\"\n+    r = session or requests.session()\n+\n+    dt = datetime.strptime(feed_date, '%Y-%m-%d %H:%M:%S')\n+    url_date = '{dt.day}.{dt.month}.{dt.year}'.format(dt=dt)\n+    solar_url = 'https://files.hrote.hr/files/EKO_BG/FORECAST/SOLAR/FTP/TEST_DRIVE/{0}.json'.format(url_date)\n+    response = r.get(solar_url)\n+    obj = response.json()\n+\n+    df = pd.DataFrame.from_dict(obj['FullPower']).set_index('Timestamp')\n+    solar_production_dt = datetime.strftime(dt, '%Y-%m-%d %H:00:00')\n+    try:\n+        solar = df['Value'].loc[solar_production_dt]\n+        # Value is in string format and needs to be converted to float\n+        solar = float(solar.replace(\",\", \".\"))\n+        # Converting to MW\n+        solar *= 0.001\n+    except KeyError:\n+        logger.info(\"No value for Solar power production on {0}\".format(solar_production_dt))","path":"parsers/HOPS.py","position":34,"original_position":34,"commit_id":"5632018a43f51d41c9ec0b612503be8af603ca1d","original_commit_id":"5632018a43f51d41c9ec0b612503be8af603ca1d","user":{"login":"corradio","id":1655848,"node_id":"MDQ6VXNlcjE2NTU4NDg=","avatar_url":"https://avatars3.githubusercontent.com/u/1655848?v=4","gravatar_id":"","url":"https://api.github.com/users/corradio","html_url":"https://github.com/corradio","followers_url":"https://api.github.com/users/corradio/followers","following_url":"https://api.github.com/users/corradio/following{/other_user}","gists_url":"https://api.github.com/users/corradio/gists{/gist_id}","starred_url":"https://api.github.com/users/corradio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corradio/subscriptions","organizations_url":"https://api.github.com/users/corradio/orgs","repos_url":"https://api.github.com/users/corradio/repos","events_url":"https://api.github.com/users/corradio/events{/privacy}","received_events_url":"https://api.github.com/users/corradio/received_events","type":"User","site_admin":false},"body":"should probably be a warning instead?","created_at":"2019-09-30T22:30:35Z","updated_at":"2019-09-30T22:32:08Z","html_url":"https://github.com/tmrowco/electricitymap-contrib/pull/1987#discussion_r329814323","pull_request_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/1987","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/comments/329814323"},"html":{"href":"https://github.com/tmrowco/electricitymap-contrib/pull/1987#discussion_r329814323"},"pull_request":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/1987"}}},"pull_request":{"url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/1987","id":322954427,"node_id":"MDExOlB1bGxSZXF1ZXN0MzIyOTU0NDI3","html_url":"https://github.com/tmrowco/electricitymap-contrib/pull/1987","diff_url":"https://github.com/tmrowco/electricitymap-contrib/pull/1987.diff","patch_url":"https://github.com/tmrowco/electricitymap-contrib/pull/1987.patch","issue_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/issues/1987","number":1987,"state":"open","locked":false,"title":"Add solar production data for Croatia","user":{"login":"OlgaCh","id":2905081,"node_id":"MDQ6VXNlcjI5MDUwODE=","avatar_url":"https://avatars1.githubusercontent.com/u/2905081?v=4","gravatar_id":"","url":"https://api.github.com/users/OlgaCh","html_url":"https://github.com/OlgaCh","followers_url":"https://api.github.com/users/OlgaCh/followers","following_url":"https://api.github.com/users/OlgaCh/following{/other_user}","gists_url":"https://api.github.com/users/OlgaCh/gists{/gist_id}","starred_url":"https://api.github.com/users/OlgaCh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlgaCh/subscriptions","organizations_url":"https://api.github.com/users/OlgaCh/orgs","repos_url":"https://api.github.com/users/OlgaCh/repos","events_url":"https://api.github.com/users/OlgaCh/events{/privacy}","received_events_url":"https://api.github.com/users/OlgaCh/received_events","type":"User","site_admin":false},"body":"Closes https://github.com/tmrowco/electricitymap-contrib/issues/1966\r\n\r\nUpdates HOPS parser with the additional data source with the estimated power production by solar panels: https://www.hrote.hr/planning-electricity-production-for-the-eco-balance-group","created_at":"2019-09-30T20:13:00Z","updated_at":"2019-09-30T22:32:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c5e025a1db5cdc7179579e5ae2d76761974014e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/1987/commits","review_comments_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/1987/comments","review_comment_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/issues/1987/comments","statuses_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/statuses/5632018a43f51d41c9ec0b612503be8af603ca1d","head":{"label":"OlgaCh:issue-1966","ref":"issue-1966","sha":"5632018a43f51d41c9ec0b612503be8af603ca1d","user":{"login":"OlgaCh","id":2905081,"node_id":"MDQ6VXNlcjI5MDUwODE=","avatar_url":"https://avatars1.githubusercontent.com/u/2905081?v=4","gravatar_id":"","url":"https://api.github.com/users/OlgaCh","html_url":"https://github.com/OlgaCh","followers_url":"https://api.github.com/users/OlgaCh/followers","following_url":"https://api.github.com/users/OlgaCh/following{/other_user}","gists_url":"https://api.github.com/users/OlgaCh/gists{/gist_id}","starred_url":"https://api.github.com/users/OlgaCh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlgaCh/subscriptions","organizations_url":"https://api.github.com/users/OlgaCh/orgs","repos_url":"https://api.github.com/users/OlgaCh/repos","events_url":"https://api.github.com/users/OlgaCh/events{/privacy}","received_events_url":"https://api.github.com/users/OlgaCh/received_events","type":"User","site_admin":false},"repo":{"id":211536846,"node_id":"MDEwOlJlcG9zaXRvcnkyMTE1MzY4NDY=","name":"electricitymap-contrib","full_name":"OlgaCh/electricitymap-contrib","private":false,"owner":{"login":"OlgaCh","id":2905081,"node_id":"MDQ6VXNlcjI5MDUwODE=","avatar_url":"https://avatars1.githubusercontent.com/u/2905081?v=4","gravatar_id":"","url":"https://api.github.com/users/OlgaCh","html_url":"https://github.com/OlgaCh","followers_url":"https://api.github.com/users/OlgaCh/followers","following_url":"https://api.github.com/users/OlgaCh/following{/other_user}","gists_url":"https://api.github.com/users/OlgaCh/gists{/gist_id}","starred_url":"https://api.github.com/users/OlgaCh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlgaCh/subscriptions","organizations_url":"https://api.github.com/users/OlgaCh/orgs","repos_url":"https://api.github.com/users/OlgaCh/repos","events_url":"https://api.github.com/users/OlgaCh/events{/privacy}","received_events_url":"https://api.github.com/users/OlgaCh/received_events","type":"User","site_admin":false},"html_url":"https://github.com/OlgaCh/electricitymap-contrib","description":"A real-time visualisation of the CO2 emissions of electricity consumption","fork":true,"url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib","forks_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/forks","keys_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/teams","hooks_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/hooks","issue_events_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/issues/events{/number}","events_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/events","assignees_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/assignees{/user}","branches_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/branches{/branch}","tags_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/tags","blobs_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/languages","stargazers_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/stargazers","contributors_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/contributors","subscribers_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/subscribers","subscription_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/subscription","commits_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/contents/{+path}","compare_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/merges","archive_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/downloads","issues_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/issues{/number}","pulls_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/labels{/name}","releases_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/releases{/id}","deployments_url":"https://api.github.com/repos/OlgaCh/electricitymap-contrib/deployments","created_at":"2019-09-28T17:25:24Z","updated_at":"2019-09-28T17:25:26Z","pushed_at":"2019-09-30T20:29:46Z","git_url":"git://github.com/OlgaCh/electricitymap-contrib.git","ssh_url":"git@github.com:OlgaCh/electricitymap-contrib.git","clone_url":"https://github.com/OlgaCh/electricitymap-contrib.git","svn_url":"https://github.com/OlgaCh/electricitymap-contrib","homepage":"https://www.electricitymap.org","size":42464,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tmrowco:master","ref":"master","sha":"6c4a19dc2170745a83a4b9748e5f9fe626f35589","user":{"login":"tmrowco","id":24733017,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0NzMzMDE3","avatar_url":"https://avatars3.githubusercontent.com/u/24733017?v=4","gravatar_id":"","url":"https://api.github.com/users/tmrowco","html_url":"https://github.com/tmrowco","followers_url":"https://api.github.com/users/tmrowco/followers","following_url":"https://api.github.com/users/tmrowco/following{/other_user}","gists_url":"https://api.github.com/users/tmrowco/gists{/gist_id}","starred_url":"https://api.github.com/users/tmrowco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmrowco/subscriptions","organizations_url":"https://api.github.com/users/tmrowco/orgs","repos_url":"https://api.github.com/users/tmrowco/repos","events_url":"https://api.github.com/users/tmrowco/events{/privacy}","received_events_url":"https://api.github.com/users/tmrowco/received_events","type":"Organization","site_admin":false},"repo":{"id":59370571,"node_id":"MDEwOlJlcG9zaXRvcnk1OTM3MDU3MQ==","name":"electricitymap-contrib","full_name":"tmrowco/electricitymap-contrib","private":false,"owner":{"login":"tmrowco","id":24733017,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0NzMzMDE3","avatar_url":"https://avatars3.githubusercontent.com/u/24733017?v=4","gravatar_id":"","url":"https://api.github.com/users/tmrowco","html_url":"https://github.com/tmrowco","followers_url":"https://api.github.com/users/tmrowco/followers","following_url":"https://api.github.com/users/tmrowco/following{/other_user}","gists_url":"https://api.github.com/users/tmrowco/gists{/gist_id}","starred_url":"https://api.github.com/users/tmrowco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmrowco/subscriptions","organizations_url":"https://api.github.com/users/tmrowco/orgs","repos_url":"https://api.github.com/users/tmrowco/repos","events_url":"https://api.github.com/users/tmrowco/events{/privacy}","received_events_url":"https://api.github.com/users/tmrowco/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/tmrowco/electricitymap-contrib","description":"A real-time visualisation of the CO2 emissions of electricity consumption","fork":false,"url":"https://api.github.com/repos/tmrowco/electricitymap-contrib","forks_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/forks","keys_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/teams","hooks_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/hooks","issue_events_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/issues/events{/number}","events_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/events","assignees_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/assignees{/user}","branches_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/branches{/branch}","tags_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/tags","blobs_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/languages","stargazers_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/stargazers","contributors_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/contributors","subscribers_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/subscribers","subscription_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/subscription","commits_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/contents/{+path}","compare_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/merges","archive_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/downloads","issues_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/issues{/number}","pulls_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/labels{/name}","releases_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/releases{/id}","deployments_url":"https://api.github.com/repos/tmrowco/electricitymap-contrib/deployments","created_at":"2016-05-21T16:36:17Z","updated_at":"2019-09-30T21:10:46Z","pushed_at":"2019-09-30T21:10:44Z","git_url":"git://github.com/tmrowco/electricitymap-contrib.git","ssh_url":"git@github.com:tmrowco/electricitymap-contrib.git","clone_url":"https://github.com/tmrowco/electricitymap-contrib.git","svn_url":"https://github.com/tmrowco/electricitymap-contrib","homepage":"https://www.electricitymap.org","size":45473,"stargazers_count":1174,"watchers_count":1174,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":261,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":111,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":261,"open_issues":111,"watchers":1174,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/1987"},"html":{"href":"https://github.com/tmrowco/electricitymap-contrib/pull/1987"},"issue":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/issues/1987"},"comments":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/issues/1987/comments"},"review_comments":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/1987/comments"},"review_comment":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/pulls/1987/commits"},"statuses":{"href":"https://api.github.com/repos/tmrowco/electricitymap-contrib/statuses/5632018a43f51d41c9ec0b612503be8af603ca1d"}},"author_association":"NONE"}}
{"actor":{"display_login":"corradio"}}