Compare commits

...

44 Commits

Author SHA1 Message Date
Nemo 639b4141bc
Merge c6e522f685 into 64cdd1b9e7 2024-05-08 20:27:29 +05:30
github-actions[bot] 64cdd1b9e7 Update ISIN Data 2024-05-07 19:09:46 +00:00
github-actions[bot] 849a74dc61 Update ISIN Data 2024-05-06 19:07:34 +00:00
github-actions[bot] 9a09072393 Update ISIN Data 2024-05-04 19:19:46 +00:00
github-actions[bot] ba0f8e8014 Update ISIN Data 2024-05-03 19:08:29 +00:00
github-actions[bot] 97d83ba2ba Update ISIN Data 2024-05-02 19:11:17 +00:00
github-actions[bot] d8f91428f2 Update ISIN Data 2024-04-30 19:06:21 +00:00
github-actions[bot] 6d1b29a927 Update ISIN Data 2024-04-29 19:02:37 +00:00
github-actions[bot] 16c1d873cb Update ISIN Data 2024-04-27 19:03:34 +00:00
github-actions[bot] 1f20b05297 Update ISIN Data 2024-04-26 19:08:42 +00:00
github-actions[bot] 137ecfaec8 Update ISIN Data 2024-04-25 19:04:41 +00:00
github-actions[bot] 3307f8d89a Update ISIN Data 2024-04-24 19:05:19 +00:00
github-actions[bot] 0e5268f0a5 Update ISIN Data 2024-04-23 19:07:28 +00:00
github-actions[bot] eb27f8e70b Update ISIN Data 2024-04-22 19:03:57 +00:00
github-actions[bot] 9567ce4684 Update ISIN Data 2024-04-20 19:08:30 +00:00
github-actions[bot] 0c0bfef072 Update ISIN Data 2024-04-19 19:04:49 +00:00
github-actions[bot] 0c90cabff9 Update ISIN Data 2024-04-18 19:06:07 +00:00
github-actions[bot] 683084243f Update ISIN Data 2024-04-16 19:03:18 +00:00
github-actions[bot] 3c88c40c20 Update ISIN Data 2024-04-15 19:39:49 +00:00
github-actions[bot] 9ea79307ce Update ISIN Data 2024-04-14 21:55:18 +00:00
github-actions[bot] 23b32ae356 Update ISIN Data 2024-04-12 19:08:55 +00:00
github-actions[bot] 21d520dc4a Update ISIN Data 2024-04-10 19:21:20 +00:00
github-actions[bot] da42785fde Update ISIN Data 2024-04-09 19:05:19 +00:00
github-actions[bot] cddcd2839f Update ISIN Data 2024-04-08 19:07:47 +00:00
github-actions[bot] 431fff6d06 Update ISIN Data 2024-04-06 19:03:48 +00:00
github-actions[bot] a752b6e161 Update ISIN Data 2024-04-05 19:02:54 +00:00
github-actions[bot] 6b37e70c8e Update ISIN Data 2024-04-04 19:05:36 +00:00
github-actions[bot] da5efa7171 Update ISIN Data 2024-04-02 19:04:25 +00:00
github-actions[bot] a6b1e6b40b Update ISIN Data 2024-04-01 19:04:05 +00:00
github-actions[bot] 08b5531eea Update ISIN Data 2024-03-31 19:22:07 +00:00
github-actions[bot] 76be63ff62 Update ISIN Data 2024-03-30 19:06:52 +00:00
github-actions[bot] b3c2e4b95e Update ISIN Data 2024-03-28 19:04:10 +00:00
github-actions[bot] 82043909e2 Update ISIN Data 2024-03-27 19:09:17 +00:00
github-actions[bot] 95a167dea6 Update ISIN Data 2024-03-26 19:14:07 +00:00
github-actions[bot] 5b6bd2d391 Update ISIN Data 2024-03-23 19:02:08 +00:00
github-actions[bot] 42fc33b5e7 Update ISIN Data 2024-03-22 19:03:11 +00:00
github-actions[bot] 6d4e3669af Update ISIN Data 2024-03-21 19:09:18 +00:00
github-actions[bot] 7a1b86290d Update ISIN Data 2024-03-20 19:03:24 +00:00
github-actions[bot] 2201d155d6 Update ISIN Data 2024-03-18 19:02:38 +00:00
github-actions[bot] cee338f6b8 Update ISIN Data 2024-03-16 19:44:13 +00:00
github-actions[bot] bbfb830842 Update ISIN Data 2024-03-15 19:08:34 +00:00
github-actions[bot] dbdbf51f8c Update ISIN Data 2024-03-14 19:05:50 +00:00
github-actions[bot] 769349209f Update ISIN Data 2024-03-13 19:09:40 +00:00
Nemo c6e522f685 Fly API deployment 2022-05-25 20:55:12 +05:30
13 changed files with 13151 additions and 4424 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
*
!ISIN.db
!main.ts
!deps.ts

15
.github/workflows/api.yml vendored Normal file
View File

@ -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

View File

@ -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 }}

5
.gitignore vendored
View File

@ -2,4 +2,7 @@ pup
release.md
pup.zip
IN*.csv
notes.md
notes.md
ISIN.db
ISIN.sqbpro
scratchpad.txt

View File

@ -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

19
Dockerfile Normal file
View File

@ -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"]

17433
ISIN.csv

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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"
}

8
deps.ts Normal file
View File

@ -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";

39
fly.toml Normal file
View File

@ -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"

27
main.ts Normal file
View File

@ -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"]
}
})
);

5
src/setup.sql Normal file
View File

@ -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