GithubHelp home page GithubHelp logo

wp-xyz / corona Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 9.0 18.19 MB

Plots and analyzes daily data of the Covid-19 pandemic

License: MIT License

Pascal 100.00%
coronavirus coronavirus-tracking covid covid-19 data-analysis data-visualization freepascal lazarus pascal

corona's People

Contributors

dioannidis avatar gcarreno avatar wp-xyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

corona's Issues

A humble suggestion, since you're on prettyfying mode :)

Hi there,

This is just something I do for Windows/Linux UX and I don't mind if you ignore me ;)

uses
  {...}LCLType,{...}

implementation

procedure MainForm.FormCreate(Sender: TObject);
begin
  InitShortCuts;
end;

procedure MainForm.InitShortcuts;
begin
  {$IFDEF LINUX}
    acFileExit.ShortCut := KeyToShortCut(VK_Q, [ssCtrl]);
  {$ENDIF}
  {$IFDEF WINDOWS}
    acFileExit.ShortCut := KeyToShortCut(VK_X, [ssAlt]);
  {$ENDIF}
  { TODO : Implement the equivalent for MacOS }
end;

Cheers,
Gus

P.S.: I've been greeting you with "Hi there" and don't even know your name :-)

OpenSSL API issues with fpcsrc/packages/openssl/src/openssl.pas

Hi there,

If anyone is compiling this on a box that has OpenSSL 1.1 and above but using the stable version of both FPC(3.0.4) and Lazarus(2.0.6) and below, they will invariably get a:

ESSL: failed to create ssl context.

This is due to the fact that the OpenSSL API has changed from 1.0.x to 1.1.x.

I would advise you opt for Synapse(40.1) that you can install from the Online Package Manager and instead of the TfpHTTPClient, use THTTPSend. This makes it work regardless of the FPC version on the users computer.

I understand that you want to keep it to a bare minimum and not install external stuff. I've tried to solve this within the code itself and it can't be done. The file on the subject line has to be updated, but it is inside the FPC distribution, so outside of this code.

This applies, mainly, to Linux users since the latest symlink on the libssl.so points to libssl.so.1.1. I'm guessing that any updated Debian-based Linux distribution will have this issue, since the results of a Google search about this error are dated to 2018.

Windows users usually install their own ssl DLLs and avoid this issue.

Thanks in advance,
Gus

With large country names, hint value dissapears on `StatusPanel[0]`

Hi there,

As you can see from the image, with large country names, the hint value is truncated when hovering on the graph's data point.

You have StatusPanel[0].Width=300 and StatusPanel[1].Width=50.
I've tried StatusPanel[0].Width=500 and it works.

Or you could make Panel[1] dynamically expand the remaining width of the StatusBar and put the hover data point info on it.

Cheers,
Gus

corona-missing-value

Hint remains once you exit a country

Hi Werner(@wp-xyz),

It appears you're not clearing the Hint when you exit a country into an area that doesn't have a country.
Example:

  1. Hover over US
  2. Hover over Atlantic Ocean
  3. Status panel still showing Hint for US

Cheers,
Gus

Overlaping buttons and treeview

Hi there,

corona-ovelap

As you can see btnUpdate and btnClear are overlapping the TreeView.

And the MinWidth for the LeftPanel is eating up on the text on rgDataType.

I'm not completely sure that this is your fault, I think Lazarus behaves a bit diff in Windows and Linux in terms of the grid, I think. And I'm not sure I haven't messed with the grid defaults myself.
Shouldn't make any diff, but hey, who knows?!?!?

Could you, please, post an image of how it looks when your first run it? Pls delete corona.cfg first :)

Many thanks in advance,
Gus

If you click on a country(second time) and the date indicator is on, corona closes

Hey Werner(@wp-xyz),

When I was facepalming while trying to see what you mentioned on #41, I bumped into this sequence:

  1. Open corona
  2. Turn Date Indicator ON
  3. Click on any country
  4. Corona exits

Then I tried some other stuff and also got abrupt close on this sequence:

  1. Open corona
  2. Select country from tree
  3. Turn Date Indicator ON
  4. Move map slider somewhere that is not max date
  5. Select another country on the tree
  6. Corona exits

Another way of reproducing it:

  1. Open corona
  2. Click on country
  3. Turn Date Indicator ON
  4. Click on another country
  5. Corona exits

So, in conclusion, when you turn Date Indicator ON and you select another country, ๐Ÿ’ฃ BOOM ๐Ÿ’ฃ

Here's the heaptrace:

WARNING: TChartListbox.Destroy with LCLRefCount>0. Hint: Maybe the component is processing an event?
WARNING: TTreeView.Destroy with LCLRefCount>0. Hint: Maybe the component is processing an event?
[TGtk2WidgetSet.Destroy] WARNING: There are 1 unreleased DCs, a detailed dump follows:
[TGtk2WidgetSet.Destroy]  DCs:   00007F2AA694FC40
[TGtk2WidgetSet.Destroy] WARNING: There are 1 unreleased GDIObjects, a detailed dump follows:
[TGtk2WidgetSet.Destroy]   GDIOs: 00007F2AA67AE6C0
[TGtk2WidgetSet.Destroy]   gdiBrush: 1

Here's my corona.cfg:
corona.cfg.zip

Hope it helps!

Cheers,
Gus

A small Ooops...

Hi there,

During your revamping and the very good call on icons, you misplaced some buttons (1) and the default With value for the LeftPanel (2):

corona-placement-issue

Oh BTW, I also welcome, VERY much, the persistence of the Application values :)

Cheers,
Gus

About a CONTRIBUTING.md

Hi Werner(@wp-xyz),

If we gonna do it right, might as well include a CONTRIBUTING.md.

Would you be up to download on of my own and then edit it so that it's good with your style?
That way we can agree on code styling and I don't mess your style.

I also like the Commit Messages section because, later we can automate creating a changes file on the command line.

On my laz-JSON-Viewer: CONTRIBUTING.md

If nothing in there is to your liking, just ditch it.

We will also have to discuss issue templates, but one thing at a time. Well apart from the n balls in the air right now about versioning and the bloody platform diffs in widget, eheheh

Cheers,
Gus

If download of data files fail, they get zeroed out.

Hi there,

Your file download function DownloadFile() returns a boolean that you do not check and blindly update the data files.

I've noticed that the files get truncated to 0 bytes due to Issue #1. But any other network issue could blank the files and the data is gone. The site could be down: github does have had issues before. If someone is on a mobile connection and it fails. And you can imagine some other issues...

Thanks in advance,
Gus

Decide where to have the data folder once we release setup packages

Hey Werner(@wp-xyz),

You've never answered me on this comment, so I'm now making it an issue on it's own for Milestone 1.1(Mapping).

I suggest:

var
  DataFolder: String;
begin
{$IFDEF WINDOWS}
  DataFolder:= GetUserDir+'CoronaData';
{$ELSE}
  DataFolder:= GetUserDir+'.coronadata';
{$ENDIF}
end;

What do you think?
This still leaves the corona.cfg under Linux:.config/corona.cfg and Windows:%%APPDATA%%\corona.cfg or is it %%USER%%\corona.cfg? Only sure of linux placement. Well what ever GetAppConfigDir() / GetAppConfigFile() returns in Windows.

Cheers,
Gus

[Suggestion] Better error handling on data files download

Hey @wp-xyz ,

Like I mentioned on one of my comments in #14 my internet connection is really bad, to the point where sometimes even DNS calls fail.

When testing your last fix I ran into DNS fails and the way your dealing with it is a bit lax, sorry for saying it.

I have some suggestions, and they are just suggestions, you can send me packing if you want:

  • If you are downloading files only from your repo, add a file with the CRC or SHA(something) of the data files so you don't have to download equal files on the hard drive.
    • This is also good security practice since you can validate a successful download with said CRC or SHA(something).
  • If any error occurs while downloading, don't load any of the new data and inform the user with an informative error message, not just the Exception.massage value on a Message Dialog.
  • OR When downloading, on the except of your try...except, increment an error counter and at the end of all files downloaded and if error_count <> 0 just inform user that a download error occurred.
    • If you want to be more informative, collect a list of Exception.messages for each download error and present the user with the files and it's errors. That way, if anyone reports an issue with downloading, you have more info to debug on.

I think that's it. Thanks for reading.

Cheers,
Gus

Disable actions when running, enabling them at the end

Hey @wp-xyz,

Under Windows when you click a button on the tool bar, it remains depressed during long operations, like the download (Linux has another animation).

That does not mean that any subsequent click on the button is discarded. It just means that the messages are queued and then processed the next time the main loop can be run.

That means that a nervous user can click more than once on the button if he doesn't spot the messages or the progress bar on the bottom (That was kinda my aim with the Modal Form: a) User cannot miss it; b) Because the operation blocks, with a modal with no buttons, you can't do anything.)

I'm not sure where I picked this code up, but I do this for all my actions:

procedure TfrmMain.ActionSomethingExecute(Sender: TObject);
begin
  ActionSomething.Enabled:= False;
{$IFDEF LINUX}
  Application.ProcessMessages;
{$ENDIF}
  try
    try
       // Here you put your action code
    except
      // Always good to have one of these if the code above can generate any 
      // Exception, right?
      on E:Exception do
      begin
        // Replace this with the appropriate code to deal with an Exception
        ShowMessage('Error: ' + E.Message);
      end;
    end;
  finally
    // Use of try...finally because something can go wrong and if it does, the button 
    // would be greyed out until close/open cycle.
    ActionSomething.Enabled:= True;
    // No need to call ProcessMessages since we exit the action and the 
    // main loop will catch up
  end;
end;

Hope this helps!!

Cheers,
Gus

Not compiling under 2.0.10 and *.rc issue under *nix

Hey Werner(@wp-xyz),

Compile error under 2.0.10

As of

367ecd6 (HEAD -> mapping, origin/mapping) Plotting of world map. No connection to Covid data, yet.

Lazarus stable is complaining:

$ lazbuild source/corona.lpi
# ...
/home/gcarreno/Programming/corona/source/cpolygonseries.pas(188,43) Error: (3026) Wrong number of parameters specified for call to "GetLegendItemsRect"
/home/gcarreno/FreePascal_stable/lazarus/components/tachart/lib/x86_64-linux/gtk2/tacustomseries.ppu:tacustomseries.pas(1464,29) Error: (5088) Found declaration: GetLegendItemsRect(TChartLegendItems;TBrush);
cpolygonseries.pas(245) Fatal: (10026) There were 2 errors compiling module, stopping
# ...

The new corona_resources.rc

Lazarus uses windres to compile the *.rc files.
I found i686-w64-mingw32-windres on Ubuntu package binutils-mingw-w64-i686.
I installed it and then had to do a ln -s i686-w64-mingw32-windres windres for lazbuild trunk to compile with success.

I think we should consider .lrs. It's the same thing and, to be honest, no external dependencies in terms of resource compiler because Lazarus has all the tools to manipulate *.lrs.

Just my 2ยขs

EDIT: have a look at Lazarus resources

Cheers,
Gus

Proposition: Map chart in one window / full screen.

Hello Werner.

Your program is very useful and didactic.

If it is not too difficult, I would like to have the possibility to set the map tab to fit automatic all the screen (hide the tab and left panel and resize to fit all the screen).

Maybe a button or a key-command to switch map-tab full window without visible tab <> normal with tab visible.

This to use your map for presentation on other screen or with projector.

corona_map_fullscreen

Fre;D

Humble question: Why are you not using TIniPropStorage?

Hi Werner(@wp-xyz),

I'm not trying to be condescending AT ALL, but I've just noticed that you're using a TIniFile to save component state and doing all the the thing by hand like:

  1. read setting from ini section
  2. write value to component property
  3. read component property
  4. write value to ini section

I hope you are aware of TXMLPropStorage, TIniPropStorage and TJSONPropStorage(I'm rather proud of having done this last one and having it included in the main Lazarus repo ๐Ÿ˜„)
Once you drop one a those on a form and set the TForm.SessionProprties, the app takes care of all the read/load/save/write cycle.
And you can even add more stuff via TIniPropStorage.StoredValues for other config related stuff.

If it's by choice, I would love to hear what's your experience to not using them.

Cheers,
Gus

Title colour above Map graph

Hi Werner(@wp-xyz),

It may be my bad eye sight, I have a very crappy varifocal set of glasses and they need to be replaced, but does this colour look good to you on dark mode:

corona-map-title-bad-colour

Don't worry about the cropping, I did size the window really small to make the screenshot image small.

Cheers,
Gus

Global stat?

What a useful project!
Surely the most clear and easy to use that I know.

Could it be possible to have also a global result?
I mean for all the planet and by continent?

Thanks.

Fre;D

Please complete info under "About" and maybe license

Hi Werner(@wp-xyz),

I understand that when you created this repo you weren't planning on having someone like me nagging about completeness, but now that I've worked my magic in having you aboard with said completeness, could you address these info issues? (I would do it myself, but I can't change repo stuff)

  1. On the "About" section, please click on the gear symbol and fill out at least the description and some Topics:
  • freepascal
  • free-pascal
  • fpc
  • lazarus
  • lazarus-ide
  • covid-19
  • data
  • data-science
  • data-visualization
  • data-analysis
  • covid
  • covid-19
  • covid-data
  • And whatever more you think is necvessary
  1. I know you don't give a flying effe about licenses, but can you please select one? Suggestions since it's science related:
  • GPL v3
  • One of the CC ones, you choose the best one that fits
  • Or the Unlicense one if you really don't give a effe about copyright and stuff

This does not affect the release and we can discuss it with time to spare.

Cheers,
Gus

File Download using WinInet, source and win32 binary

Hey Werner(@wp-xyz),

Found the source I was looking for. I was clever, had it on a private repo on GitHub, ufff.

The only thing I need to suss out now, is how to hook up the download progress.

I'm including source and a i386-win32 cross-compile. Could you test the *.exe with your virus software? THANKS!!
lazHeidiSQL-UpdateCheck-i386-win32-source.zip

If using WinInet fools the anti-virus, I have a big fat rewrite ahead of me ๐Ÿ˜„

Cheers,
Gus

Sorry for intruding on your layout again...

Hi there,

To better manage what I've reported on Issue #8 I suggest the following:

  • Put cgCases, rgDataType, btnUpdate and btnClear inside a TPanel with Align=alTop
  • Make TreeView.Align=alClient and you can do away with all the Anchors you set up.

This way, no overlapping on the buttons and it's all contained.

Again, really sorry if it's too much intruding.

Cheers,
Gus

Do you want me to provide multiplatform binaries and/or an InnoSetup install binary?

Hey Werner (@wp-xyz),

I'm sure that your lack of GIT grasp includes creating tags. That's alright, no problems!

But it would be nice for people to have a pre-compiled binary they could download and run, instead of being savvy enough to download the source and compile it. That would reside on the Release area of GitHub.

On my rig I'm able to compile(Linux-x86_64, Linux-arm[RasPi 3]) and cross-compile(Linux-i386, Win64-x86_64, Win32-i386), and I have enough competence to create an Inno-Setup(GitHub) that can decide to install either a Windows 32b or a Windows 64b version depending on the users platform.
I'm still trying to automate the creation of *.deb packages with this and I'm not sure I would be inclined to do an *.rpm.
And finally, also provide a simple *.tar.gz and *.zip distribution for those that don't want to commit to a full install.
You can see an example of what I'm suggesting on my lazJSONViewer Releases under the assets. All my suggestions are there, apart from the *.deb, which I'm still trying to get my head around.

If you agree to this, let me warn you, I may need write access to the repo. I would never mess with the code, because to be quite honest I'm oblivious of the data math/maths you're performing. I would only mess about with a script for Inno-Setup and maybe one to automatically produce the *.zip/*.tar.gz files.

If you don't want me to have write access to your repo, you could provide a back channel for me to supply the binaries and I can try to help you do the versioning and the tagging. This could also work.

I do not intend to put any pressure on you. If you're not comfortable with any of my suggestions, just brush me off with any excuse, since it's your baby and I don't want to mess with that!!!

Cheers,
Gus

Inconsistencies detected when cross-compiling

Hey Werner(@wp-xyz),

I'm opening this issue primarily to list the inconsistencies and secondly for us to have a chat about it.

x86_64-linux:

  • Nothing to report here since it's what I'm testing on IDE

i386-linux:

  • TComboBox has very squary corners and the rest of the UI is also strange.
    corona-square-combobox
  • Does not update TProgressBar, only TLabel.
  • I still need to compare with lazbuild from trunk, as I'm building with stable 2.0.10 for releases. Maybe I have gremlins somewhere.

x86_64-win64:

  • Is misbehaving on downloads, but I'm aware that my wine install does not work well with HTTPS and win64.

i386-win32:

  • Does not have an issue with HTTPS. The initial code I sent you was doing well here.
  • Somehow it gets stuck. Dunno where though, need to investigate.

This is where I'm at.
I have to admit that my cross-compiling now seems to be less healthy than I thought. Maybe need to refresh my stuff with a full install from fpcupdeluxe on the cross-compile. Don has made some changes quite recently...

Cheers,
Gus

What's the version you want to give to current state of master?

Hey Werner(@wp-xyz)

You have to pay attention to the discussions and the issues. If you don't, after a few days, I'll consider your silence as yes and commit my work.

So what do you think is the code version of what is now in the master branch, before you embarked into branch mapping.

I wanna do a full release of corona before mapping is out.

Cheers,
Gus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.