Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tripsit/drugs and combine with PW #735

Merged
merged 1 commit into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
- tripbot_website-net
- moodle_data-net
volumes:
- ./assets:/usr/src/app/assets # Needed for hot-reloading of source code
- ./src/global/assets:/usr/src/app/src/global/assets # For viewing downloaded assets in development
- ./src:/usr/src/app/src # Needed for hot-reloading of source code
- ./.env:/usr/src/app/.env # Needed for hot-reloading the .env
labels:
Expand Down
2 changes: 1 addition & 1 deletion src/api/v1/drugs/drugs.queries.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Category, Drug } from 'tripsit_drug_db';
import drugJsonData from '../../../global/assets/data/drug_db_tripsit.json';
import drugJsonData from '../../../global/assets/data/tripsitDB.json';
import { combo } from '../../../global/commands/g.combo';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
2 changes: 1 addition & 1 deletion src/dbscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Category, Drug } from 'tripsit_drug_db';
import fs from 'fs';
import path from 'path';
import drugs from './global/assets/data/drug_db_tripsit.json';
import drugs from './global/assets/data/tripsitDB.json';
import combos from './global/assets/data/combo.json';
import { Combos } from './global/@types/tripsitCombos';

Expand Down Expand Up @@ -170,7 +170,7 @@
}
});

console.log(`${JSON.stringify(categoryData, null, 2)}`);

Check warning on line 173 in src/dbscan.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
}

expandCategories();
3 changes: 3 additions & 0 deletions src/discord/commands/global/d.drug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ async function addDurations(
let columns = 0;
roaNames.forEach(roaName => {
if (columns < 3) {
if (!drugData.roas) {
return;
}
const roaInfo = drugData.roas.find(r => r.name === roaName);
if (roaInfo && roaInfo.duration) {
let durationString = '';
Expand Down
2 changes: 1 addition & 1 deletion src/discord/commands/guild/d.bottest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { embedTemplate } from '../../utils/embedTemplate';
import commandContext from '../../utils/context';
// import fs from 'fs/promises'; // eslint-disable-line
const F = f(__filename);
// import drugDataAll from '../../../global/assets/data/drug_db_combined.json';
// import drugDataAll from '../../../../assets/data/tripsitDB.json';
// const drugNames = drugDataAll.map((d) => d.name);
type ResultsObject = {
total: string[]
Expand Down
12 changes: 10 additions & 2 deletions src/discord/events/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ import {
import Fuse from 'fuse.js';

import { PrismaClient, ai_model } from '@prisma/client';
import { Drug } from 'tripsit_drug_db';
import pillColors from '../../global/assets/data/pill_colors.json';
import pillShapes from '../../global/assets/data/pill_shapes.json';
import drugDataAll from '../../global/assets/data/drug_db_combined.json';
import drugDataTripsit from '../../global/assets/data/drug_db_tripsit.json';
import cbData from '../../global/assets/data/combinedDB.json';
import tsData from '../../global/assets/data/tripsitDB.json';
import timezones from '../../global/assets/data/timezones.json';
import unitsOfMeasurement from '../../global/assets/data/units_of_measurement.json';
import { CbSubstance } from '../../global/@types/combined';

const drugDataTripsit = tsData as {
[key: string]: Drug;
};

const drugDataAll = cbData as CbSubstance[];

const db = new PrismaClient({ log: ['error'] });

Expand Down
163 changes: 131 additions & 32 deletions src/global/@types/combined.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,132 @@

export interface CbSubstance {
url: string;
experiencesUrl: null | string;
experiencesUrl?: string;
name: string;
aliases: string[];
aliasesStr: string;
summary: null | string;
reagents: null | string;
classes: Classes | null;
toxicity: string[] | null;
addictionPotential: null | string;
tolerance: Tolerance | null;
crossTolerances: string[] | null;
roas: Roa[];
interactions: Interaction[] | null;
aliases?: string[];
aliasesStr?: string;
summary?: string;
reagents?: string;
classes?: Classes;
toxicity?: string[] ;
addictionPotential?: string;
tolerance?: Tolerance;
crossTolerances?: string[];
roas?: Roa[];
interactions?: Interaction[];
}

export interface Classes {
chemical: string[] | null;
psychoactive: Psychoactive[] | null;
chemical?: [Chemical];
psychoactive?: [Psychoactive];
}

export enum Psychoactive {
Antidepressants = 'Antidepressants',
Antidepressant = 'Antidepressant',
Antipsychotic = 'Antipsychotic',
'Atypical neuroleptic' = 'Atypical neuroleptic',
Cannabinoid = 'Cannabinoid',
Deliriant = 'Deliriant',
Depressant = 'Depressant',
Dissociatives = 'Dissociatives',
Entactogens = 'Entactogens',
Eugeroics = 'Eugeroics',
Hallucinogens = 'Hallucinogens',
Dissociative = 'Dissociative',
Empathogen = 'Empathogen',
Entactogen = 'Entactogen',
Eugeroic = 'Eugeroic',
'Habit Forming' = 'Habit Forming',
Hallucinogen = 'Hallucinogen',
Hypnotic = 'Hypnotic',
Inactive = 'Inactive',
Nootropic = 'Nootropic',
Oneirogen = 'Oneirogen',
Opioids = 'Opioids',
Psychedelics = 'Psychedelics',
Sedative = 'Sedative',
Stimulants = 'Stimulants',
Opioid = 'Opioid',
Psychedelic = 'Psychedelic',
'Research Chemical' = 'Research Chemical',
SSRI = 'SSRI',
Stimulant = 'Stimulant',
Supplement = 'Supplement',
Tentative = 'Tentative',
}

export enum Chemical {
'4-oxazolidinone' = '4-oxazolidinone',
'Amino acid' = 'Amino acid',
'Amino acid analogue' = 'Amino acid analogue',
'Ammonium salt' = 'Ammonium salt',
Amine = 'Amine',
Aminoindane = 'Aminoindane',
Amphetamine = 'Amphetamine',
Adamantanes = 'Adamantanes',
Alcohol = 'Alcohol',
Alkanediol = 'Alkanediol',
Anilidopiperidine = 'Anilidopiperidine',
Arylcyclohexylamines = 'Arylcyclohexylamines',
Barbiturates = 'Barbiturates',
Benzamide = 'Benzamide',
Benzazepine = 'Benzazepine',
Benzhydryl = 'Benzhydryl',
Benzisoxazole = 'Benzisoxazole',
Benzodiazepines = 'Benzodiazepines',
Butyrophenone = 'Butyrophenone',
'Butyric acid' = 'Butyric acid',
Cannabinoid = 'Cannabinoid',
Carbamate = 'Carbamate',
Common = 'Common',
'Choline derivative' = 'Choline derivative',
Cysteine = 'Cysteine',
Cycloalkylamines = 'Cycloalkylamines',
Cyclopyrrolone = 'Cyclopyrrolone',
Diarylethylamines = 'Diarylethylamines',
Diol = 'Diol',
Diphenylpropylamine = 'Diphenylpropylamine',
Dibenzothiazepine = 'Dibenzothiazepine',
'Ethanolamine#1#' = 'Ethanolamine#1#',
Gabapentinoids = 'Gabapentinoids',
Imidazoline = 'Imidazoline',
Imidazopyridine = 'Imidazopyridine',
Indazole = 'Indazole',
Indazolecarboxamide = 'Indazolecarboxamide',
Indolecarboxamide = 'Indolecarboxamide',
Indolecarboxylate = 'Indolecarboxylate',
'Indole alkaloids' = 'Indole alkaloids',
'Indole cannabinoid' = 'Indole cannabinoid',
Khat = 'Khat#1#',
Lactone = 'Lactone',
Lysergamides = 'Lysergamides',
MDxx = 'MDxx',
Naphthoylindole = 'Naphthoylindole',
Naphthoylindazole = 'Naphthoylindazole',
'Nitrogenous organic acid' = 'Nitrogenous organic acid',
Peptide = 'Peptide',
Phenothiazine = 'Phenothiazine',
Phenylmorpholine = 'Phenylmorpholine',
Phenylpropenes = 'Phenylpropenes',
Phenylpropylamine = 'Phenylpropylamine',
Piperazinoazepine = 'Piperazinoazepine',
Poppers = 'Poppers',
Pyridine = 'Pyridine',
Quinazolinone = 'Quinazolinone',
Racetams = 'Racetams',
Salvinorin = 'Salvinorin',
'Substituted aminorexes' = 'Substituted aminorexes',
'Substituted amphetamines' = 'Substituted amphetamines',
'Substituted benzofurans' = 'Substituted benzofurans',
'Substituted cathinones' = 'Substituted cathinones',
'Substituted morphinans' = 'Substituted morphinans',
'Substituted phenethylamines' = 'Substituted phenethylamines',
'Substituted phenidates' = 'Substituted phenidates',
'Substituted piperazines' = 'Substituted piperazines',
'Substituted piperidines' = 'Substituted piperidines',
'Substituted pyrrolidines' = 'Substituted pyrrolidines',
'Substituted tropanes' = 'Substituted tropanes',
'Substituted tryptamines' = 'Substituted tryptamines',
Terpenoid = 'Terpenoid',
Tetrahydroisoxazole = 'Tetrahydroisoxazole',
Tetrahydroisoxazolopyridine = 'Tetrahydroisoxazolopyridine',
Thienodiazepines = 'Thienodiazepines',
Thiophene = 'Thiophene',
'Tricyclic antidepressant' = 'Tricyclic antidepressant',
'Purine alkaloid' = 'Purine alkaloid',
Xanthines = 'Xanthines',
}

export interface Interaction {
Expand All @@ -57,29 +147,38 @@ export enum Status {

export interface Roa {
name: string;
dosage?: Dosage[] | null;
duration?: Dosage[] | null;
dosage?: Dosage[];
duration?: Duration[];
bioavailability?: string;
}

export interface Dosage {
name: Name;
name: Strength;
value: string;
note?: string;
}

export interface Duration {
name: Period;
value: null | string;
note?: string;
}

export enum Name {
AfterEffects = 'After effects',
ComeUp = 'Come up',
export enum Strength {
Common = 'Common',
Duration = 'Duration',
Heavy = 'Heavy',
Light = 'Light',
Strong = 'Strong',
Threshold = 'Threshold',
}

export enum Period {
AfterEffects = 'After effects',
ComeUp = 'Come up',
Duration = 'Duration',
Offset = 'Offset',
Onset = 'Onset',
Peak = 'Peak',
Strong = 'Strong',
Threshold = 'Threshold',
Total = 'Total',
}

Expand Down
Loading
Loading