Skip to content

Commit

Permalink
better file sorting after processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickbahson committed Jan 8, 2020
1 parent f125994 commit 21b2194
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 102 deletions.
84 changes: 7 additions & 77 deletions nodejsModule/anotherapp/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
========================================================
WHY THIS FOLDER AND SETUP
---------------------------------------------------------
============================
WHY THIS FOLDER AND SETUP
---------------------------
* Processing a folder with many csv files is hectic especially when files have
huge streams of data, some data is lost to memory, and some files are read
simultaneously before the first one is done with.
Expand All @@ -10,11 +10,10 @@ of nodes event (`https://electronjs.org/docs/api/ipc-main`), and react js becaus
it's easier to update it's (React js) states via events and also call or send data
to electron (back-end) via such events. Thus allowing simultaneous csv file processing.
Other alternatives are welcome for suggestions and discussions.

-------------------------------------------------
HOW IT WORKS
-------------------------------------------------


---------------
HOW IT WORKS
----------------
* In the root of this folder, fire up your favourite cli tool, make sure node is installed,
run `yarn install` OR `npm install` depending on your preferred package manager; to install
project dependencies.
Expand All @@ -29,72 +28,3 @@ as this app relies on that, check file name `institutions_latest.sql` in `SQLs`

* Now our app is fired up, click Process csv files button to load csv data into database.
* If you get an error on the console, click Process csv files button again to load another file.

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `yarn build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
69 changes: 69 additions & 0 deletions nodejsModule/anotherapp/ReactFront_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `yarn build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `yarn build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
57 changes: 32 additions & 25 deletions nodejsModule/anotherapp/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class App extends Component {

this.setState({
log: created,
currentProcess: 'Ready to load a new file......',
currentProcess: null,
})

setTimeout(() => {
Expand All @@ -169,7 +169,7 @@ class App extends Component {
}

ipcRenderer.send('get-csv', dt)
},1400)
},3400)

}
})
Expand Down Expand Up @@ -197,13 +197,15 @@ class App extends Component {
}

renderCurrentProcess = () => {
const { currentProcess } = this.state
const { currentProcess, totalItems } = this.state

return (
<div className="m-2 p-3 bg-info">
<div className="m-2 p-2">currentProcess : {currentProcess}</div>
</div>
)
if(!_.isEmpty(currentProcess) && totalItems === 0){
return (
<div className="m-5 p-5 bg-info shadow-lg rounded">
<div className="m-3 p-3"><strong>currentProcess : {currentProcess}</strong></div>
</div>
)
} else return null


}
Expand Down Expand Up @@ -251,16 +253,25 @@ class App extends Component {

}

renderProcedureData = () => {
const { procedureData } = this.state
renderInit = () => {
const { currentFile } = this.state

if(!_.isEmpty(procedureData)){
if(_.isEmpty(currentFile)){
return (
<div className="m-2">
<div className="m-2 p-2">procedureData : {/*procedureData*/}</div>
<div className="container text-center">
<small><strong>Make sure your database is set before clicking this button please...</strong></small>
<button
onClick={this.handleInit}
className="btn btn-primary m-3 p-2"
>
Process csv files

</button>
</div>
)
} else return null
} else return (
<small> Processing file : {currentFile}, check console terminal for process logs</small>
)


}
Expand Down Expand Up @@ -321,16 +332,7 @@ class App extends Component {
<div className="container-fluid text-center m-4 p-3">
<h4>Hello MedHack Tm</h4>
<hr/>
<div className="row text-center">
<small>Make sure your database is set before clicking below please...</small>
<button
onClick={this.handleInit}
className="btn btn-primary m-3 p-2"
>
Process csv files

</button>
</div>
{this.renderInit()}
<div className="shadow-lg">
{/*<ProgressMessage
message={message}
Expand All @@ -342,7 +344,6 @@ class App extends Component {
{this.renderCurrentFile()}
{this.renderCsvFiles()}
{this.renderCsvData()}
{this.renderProcedureData()}
{this.renderLog()}
<Spinner
currentFile={currentFile}
Expand All @@ -358,6 +359,12 @@ class App extends Component {

</div>
</div>
<footer className="fixed-bottom bg-dark text-white">
<div className="m-5">
Hey..!!! don't forget to check the logs table in your default database ; <br/>
That is, if you have already run the process through ..
</div>
</footer>
</div>
);
}
Expand Down

0 comments on commit 21b2194

Please sign in to comment.