added erowid experiences URL

This commit is contained in:
Noah Saso 2021-06-24 20:29:13 -07:00
parent c26210d0bf
commit 02fba0726b
2 changed files with 6 additions and 1 deletions

View File

@ -7,11 +7,12 @@ Script to merge data from PsychonautWiki API + pages and TripSit factsheets into
| Property | Type | Description | Source | | Property | Type | Description | Source |
| ------------------------- | ------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- | | ------------------------- | ------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| `url` | `string` | Substance page URL | PsychonautWiki if exists, TripSit factsheet otherwise | | `url` | `string` | Substance page URL | PsychonautWiki if exists, TripSit factsheet otherwise |
| `experiences_url` | `null` \| `string` | Erowid Experience Vault page URL | TripSit |
| `name` | `string` | Substance Name | shortest display name of PsychonautWiki page header and TripSit API's `pretty_name` | | `name` | `string` | Substance Name | shortest display name of PsychonautWiki page header and TripSit API's `pretty_name` |
| `aliases` | `string[]` | List of aliases (lowercase) | Both | | `aliases` | `string[]` | List of aliases (lowercase) | Both |
| `aliasesStr` | `string` | Comma-separated list of aliases (for fuzzy searching) | Both | | `aliasesStr` | `string` | Comma-separated list of aliases (for fuzzy searching) | Both |
| `summary` | `string` | Substance summary | TripSit | | `summary` | `string` | Substance summary | TripSit |
| `reagents` | `string` | Reagent test kit reactions | TripSit | | `reagents` | `null` \| `string` | Reagent test kit reactions | TripSit |
| `classes` | `null` \| `Dictionary` | Substance classifications | PsychonautWiki | | `classes` | `null` \| `Dictionary` | Substance classifications | PsychonautWiki |
| `classes.chemical` | `string[]` | Chemical classifications | PsychonautWiki | | `classes.chemical` | `string[]` | Chemical classifications | PsychonautWiki |
| `classes.psychoactive` | `string[]` | Psychoactive classifications | PsychonautWiki | | `classes.psychoactive` | `string[]` | Psychoactive classifications | PsychonautWiki |

View File

@ -358,6 +358,9 @@ for name in all_substance_names:
url = pw_substance.get( url = pw_substance.get(
'url') or f"https://drugs.tripsit.me/{ts_substance['name']}" 'url') or f"https://drugs.tripsit.me/{ts_substance['name']}"
ts_links = ts_substance.get('links', {})
experiences_url = ts_links.get('experiences')
# pick display name from available substances found from both datasets # pick display name from available substances found from both datasets
names = list(filter(lambda n: n is not None and len(n) > 0, [ names = list(filter(lambda n: n is not None and len(n) > 0, [
pw_substance.get('name'), ts_substance.get('pretty_name')])) pw_substance.get('name'), ts_substance.get('pretty_name')]))
@ -486,6 +489,7 @@ for name in all_substance_names:
substance_data.append({ substance_data.append({
'url': url, 'url': url,
'experiences_url': experiences_url,
'name': name, 'name': name,
'aliases': list(aliases), 'aliases': list(aliases),
'aliasesStr': ','.join(aliases), 'aliasesStr': ','.join(aliases),