Compare commits
44 Commits
4dcffabc65
...
639b4141bc
Author | SHA1 | Date |
---|---|---|
Nemo | 639b4141bc | |
github-actions[bot] | 64cdd1b9e7 | |
github-actions[bot] | 849a74dc61 | |
github-actions[bot] | 9a09072393 | |
github-actions[bot] | ba0f8e8014 | |
github-actions[bot] | 97d83ba2ba | |
github-actions[bot] | d8f91428f2 | |
github-actions[bot] | 6d1b29a927 | |
github-actions[bot] | 16c1d873cb | |
github-actions[bot] | 1f20b05297 | |
github-actions[bot] | 137ecfaec8 | |
github-actions[bot] | 3307f8d89a | |
github-actions[bot] | 0e5268f0a5 | |
github-actions[bot] | eb27f8e70b | |
github-actions[bot] | 9567ce4684 | |
github-actions[bot] | 0c0bfef072 | |
github-actions[bot] | 0c90cabff9 | |
github-actions[bot] | 683084243f | |
github-actions[bot] | 3c88c40c20 | |
github-actions[bot] | 9ea79307ce | |
github-actions[bot] | 23b32ae356 | |
github-actions[bot] | 21d520dc4a | |
github-actions[bot] | da42785fde | |
github-actions[bot] | cddcd2839f | |
github-actions[bot] | 431fff6d06 | |
github-actions[bot] | a752b6e161 | |
github-actions[bot] | 6b37e70c8e | |
github-actions[bot] | da5efa7171 | |
github-actions[bot] | a6b1e6b40b | |
github-actions[bot] | 08b5531eea | |
github-actions[bot] | 76be63ff62 | |
github-actions[bot] | b3c2e4b95e | |
github-actions[bot] | 82043909e2 | |
github-actions[bot] | 95a167dea6 | |
github-actions[bot] | 5b6bd2d391 | |
github-actions[bot] | 42fc33b5e7 | |
github-actions[bot] | 6d4e3669af | |
github-actions[bot] | 7a1b86290d | |
github-actions[bot] | 2201d155d6 | |
github-actions[bot] | cee338f6b8 | |
github-actions[bot] | bbfb830842 | |
github-actions[bot] | dbdbf51f8c | |
github-actions[bot] | 769349209f | |
Nemo | c6e522f685 |
|
@ -0,0 +1,4 @@
|
|||
*
|
||||
!ISIN.db
|
||||
!main.ts
|
||||
!deps.ts
|
|
@ -0,0 +1,15 @@
|
|||
name: API Deploy
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
env:
|
||||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy app
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: superfly/flyctl-actions/setup-flyctl@master
|
||||
- run: make db && flyctl deploy --remote-only
|
|
@ -1,7 +1,6 @@
|
|||
name: Update Data
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
schedule:
|
||||
# 18:07 UTC every day
|
||||
# 23:37 IST every day
|
||||
|
@ -32,4 +31,4 @@ jobs:
|
|||
pip install -r src/requirements.txt
|
||||
make release "version=v${{ steps.update_data.outputs.version }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -2,4 +2,7 @@ pup
|
|||
release.md
|
||||
pup.zip
|
||||
IN*.csv
|
||||
notes.md
|
||||
notes.md
|
||||
ISIN.db
|
||||
ISIN.sqbpro
|
||||
scratchpad.txt
|
|
@ -5,9 +5,9 @@ authors:
|
|||
given-names: "Abhay"
|
||||
orcid: https://orcid.org/0000-0002-7993-1363
|
||||
title: "India ISIN Database, by Nemo"
|
||||
version: 2024.3.12
|
||||
version: 2024.5.7
|
||||
url: "https://github.com/captn3m0/india-isin-data"
|
||||
date-released: 2024-03-12
|
||||
date-released: 2024-05-07
|
||||
preferred-citation:
|
||||
url: "https://github.com/captn3m0/india-isin-data"
|
||||
type: data
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
FROM denoland/deno:1.22.0
|
||||
|
||||
# The port that your application listens to.
|
||||
EXPOSE 8080
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Prefer not to run as root.
|
||||
USER deno
|
||||
|
||||
# Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified).
|
||||
# Ideally cache deps.ts will download and compile _all_ external files used in main.ts.
|
||||
COPY deps.ts .
|
||||
RUN deno cache deps.ts
|
||||
|
||||
# These steps will be re-run upon each file change in your working directory:
|
||||
ADD . .
|
||||
|
||||
CMD ["run", "--cached-only", "--allow-net", "--allow-read", "main.ts"]
|
9
Makefile
9
Makefile
|
@ -33,5 +33,10 @@ old:
|
|||
release-notes: old
|
||||
python3 src/diff.py
|
||||
|
||||
release: release-notes
|
||||
gh release create "$(version)" --notes-file notes.md ISIN.csv release.md
|
||||
release: release-notes db
|
||||
gh release create "$(version)" --notes-file notes.md ISIN.csv release.md ISIN.db
|
||||
|
||||
db:
|
||||
cat ISIN.csv | tail -n +2 > /tmp/ISIN-no-headers.csv
|
||||
rm -f ISIN.db
|
||||
cat src/setup.sql | sqlite3 ISIN.db
|
|
@ -78,6 +78,6 @@
|
|||
}
|
||||
],
|
||||
"title": "India ISIN Database",
|
||||
"version": "2024.3.12",
|
||||
"created": "2024-03-12 19:04:58+00:00"
|
||||
"version": "2024.5.7",
|
||||
"created": "2024-05-07 19:09:43+00:00"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import { DB } from "https://deno.land/x/sqlite/mod.ts";
|
||||
import {
|
||||
app,
|
||||
get,
|
||||
post,
|
||||
redirect,
|
||||
contentType,
|
||||
} from "https://denopkg.com/syumai/dinatra@0.15.0/mod.ts";
|
|
@ -0,0 +1,39 @@
|
|||
app = "isin"
|
||||
|
||||
kill_signal = "SIGINT"
|
||||
kill_timeout = 5
|
||||
|
||||
[env]
|
||||
PORT = "8080"
|
||||
|
||||
[experimental]
|
||||
allowed_public_ports = []
|
||||
auto_rollback = true
|
||||
|
||||
|
||||
[[services]]
|
||||
http_checks = []
|
||||
internal_port = 8080
|
||||
processes = ["app"]
|
||||
protocol = "tcp"
|
||||
script_checks = []
|
||||
|
||||
[services.concurrency]
|
||||
hard_limit = 25
|
||||
soft_limit = 20
|
||||
type = "connections"
|
||||
|
||||
[[services.ports]]
|
||||
force_https = true
|
||||
handlers = ["http"]
|
||||
port = 80
|
||||
|
||||
[[services.ports]]
|
||||
handlers = ["tls", "http"]
|
||||
port = 443
|
||||
|
||||
[[services.tcp_checks]]
|
||||
grace_period = "1s"
|
||||
interval = "15s"
|
||||
restart_limit = 0
|
||||
timeout = "2s"
|
|
@ -0,0 +1,27 @@
|
|||
import { DB } from "https://deno.land/x/sqlite/mod.ts";
|
||||
import {
|
||||
app,
|
||||
get,
|
||||
post,
|
||||
redirect,
|
||||
contentType,
|
||||
} from "https://denopkg.com/syumai/dinatra@0.15.0/mod.ts";
|
||||
|
||||
const db = new DB("ISIN.db", { mode: "read" });
|
||||
|
||||
app(
|
||||
get("/api/:isin", ({ params }) => {
|
||||
let query = `SELECT * from ISIN WHERE ISIN='${params.isin}'`
|
||||
let res = db.query(query);
|
||||
|
||||
if (res.length == 1) {
|
||||
let [isin,description,issuer,type,status] = res[0]
|
||||
if (issuer == "null") {
|
||||
issuer = null
|
||||
}
|
||||
return [200, contentType("json"), JSON.stringify({ isin,description,issuer,type,status })]
|
||||
} else {
|
||||
return[404, contentType("json"), "Invalid ISIN"]
|
||||
}
|
||||
})
|
||||
);
|
|
@ -0,0 +1,5 @@
|
|||
CREATE TABLE IF NOT EXISTS "ISIN"("ISIN" TEXT, "Description" TEXT, "Issuer" TEXT, "Type" TEXT COLLATE NOCASE, "Status" TEXT COLLATE NOCASE);
|
||||
CREATE UNIQUE INDEX isinidx on ISIN (ISIN);
|
||||
CREATE INDEX statusidx on ISIN (Status);
|
||||
CREATE INDEX typeidx on ISIN (Type);
|
||||
.import /tmp/ISIN-no-headers.csv ISIN --csv
|
Loading…
Reference in New Issue