Skip to content

Commit

Permalink
Merge pull request #9 from ShabadOS/dev-1.0
Browse files Browse the repository at this point in the history
merge `dev/1.0`
  • Loading branch information
Harjot1Singh authored Jan 3, 2018
2 parents f983969 + d9b932c commit e368080
Show file tree
Hide file tree
Showing 3,733 changed files with 1,152,658 additions and 10 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
24 changes: 24 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 2
jobs:
build:
docker:
- image: circleci/node:8.9.2
steps:
- checkout
- run: npm install
- run:
name: Build database
command: npm run build
- store_artifacts:
path: build/database.sqlite
- add_ssh_keys:
fingerprints:
- "e5:71:50:86:4f:6c:3e:f6:8b:f2:d5:45:ec:f0:9a:f1"
- deploy:
name: Release database on Github
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
git config --global push.default current
echo "Releasing on Github"
npm run release
fi
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
seeds/
57 changes: 57 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"extends": "airbnb",
"rules": {
"func-names": [
"error",
"never"
],
"space-in-parens": [
"error",
"always"
],
"array-bracket-spacing": [
"error",
"always"
],
"semi": [
"error",
"never"
],
"import/extensions": 0,
"import/no-unresolved": 0,
"import/prefer-default-export": 0,
"object-curly-newline": [
"error",
{
"consistent": true
}
],
"arrow-parens": [
"error",
"as-needed",
{
"requireForBlockBody": false
}
],
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "(res|next)"
}
],
"react/jsx-filename-extension": 0,
"linebreak-style": 0,
"no-shadow": 0,
"no-await-in-loop": 0,
"no-loop-func": 0,
"no-restricted-syntax": 0,
"semi-style": [
"error",
"first"
],
"computed-property-spacing": [
"error",
"always"
]
}
}
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/
*.iml

### App Output
build/
*.sqlite
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dockerfile to build database
FROM node:8

WORKDIR /usr/src/app

# Deal with dependencies first to improve docker caching
COPY package*.json ./
RUN npm install

# Copy sources into current dir
COPY . .

# Run the build defined in package.json
CMD ["npm", "run", "build"]
72 changes: 62 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,71 @@

# Database
The open gurbani database containing an evolving set of corrections. Used in Shabad OS software.
An open gurbani database containing an evolving set of corrections. Used in Shabad OS software.

## Schema

![schema](schema.png)

## Building

You can use docker, or node.

### Docker

Install [docker](http://docker.com). You won't need to install anything else.

Run `docker-compose up build` to generate the SQLite3 DB in the `build` folder.

### Node

Install [node](https://nodejs.org/).

Run `npm install` inside the project directory to install dependencies.

Run `npm run build` to build the database.

## Installation
## Contributing

* Download the SQLite db "data" from the release page
* Move it to our [Golang App](https://github.com/ShabadOS/core)'s includes folder:
The schema can be modified in the `migrations/schema.js` file.

cp data $GOPATH/src/shabadOS/includes/data
### Structure

JSON files for `Raags`, `Sources`, `Writers`, and `Line_Types` can be found in the `seeds` folder.
Changing a value here will be reflected everwhere else. The `array index + 1` represents the id used
for each relation in other tables.

Lines are split by `sources/source name/first ang in batch/ang number.json`.

Banis can be added in `banis.json`. To define the lines a bani contains,
add a `start_banis` key with an array of the index of the banis that start there,
and a corresponding `end_banis` with the same in the ending line's definition in
the corresponding ang file.


Shabads are split by `shabads/source name/writer name.json`.


### Single line changes
The content for each ang can be found in the corresponding js file.
Simply change any values as desired.

### Large/batch changes

To modify large parts of the database, based on some rule:
- Build a local copy of the database, following the instructions in the Building section
- Modify the database file in `builds/database.sqlite` as you see fit
- Run `docker-compose up generate` or `npm run generate` to regenerate the seed files with your changes

## Releases

The builds for any of branches can be found on [CircleCI](https://circleci.com/gh/ShabadOS).

Compiled databases are available via the release page.

## Viewing

Alternately, you can use an application like [DBeaver](https://dbeaver.jkiss.org/) to view the SQLite file.

## Future
You can use an application like [DBeaver](https://dbeaver.jkiss.org/) to view the SQLite file.

Main priorities are to (1) shift to a method that allows tracking changes to the database and (2) re-do english translations under an open license.
## Todo

Secondary priority is to research licenses that disallow monetary gain and incorrect changes while also enforcing a requirement to share the database regardless of how it is being used (examples: cloud-service, desktop/mobile applications, or presentations). This may apply to the Gurbani data in the future.
- Redo English translations under an open license
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.3"

services:
build:
build: .
volumes:
- "/usr/src/app/node_modules"
- ".:/usr/src/app"
generate:
build: .
volumes:
- "/usr/src/app/node_modules"
- ".:/usr/src/app"
command: ["npm", "run", "generate"]
7 changes: 7 additions & 0 deletions knexfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const config = {
client: 'sqlite3',
connection: { filename: 'build/database.sqlite' },
useNullAsDefault: true,
}

module.exports = config
Loading

0 comments on commit e368080

Please sign in to comment.