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 |
| ------------------------- | ------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
| `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` |
| `aliases` | `string[]` | List of aliases (lowercase) | Both |
| `aliasesStr` | `string` | Comma-separated list of aliases (for fuzzy searching) | Both |
| `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.chemical` | `string[]` | Chemical classifications | PsychonautWiki |
| `classes.psychoactive` | `string[]` | Psychoactive classifications | PsychonautWiki |

View File

@ -357,6 +357,9 @@ for name in all_substance_names:
# url will always exist for psychonautwiki substance, so tripsit substance must exist if url is None
url = pw_substance.get(
'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
names = list(filter(lambda n: n is not None and len(n) > 0, [
@ -486,6 +489,7 @@ for name in all_substance_names:
substance_data.append({
'url': url,
'experiences_url': experiences_url,
'name': name,
'aliases': list(aliases),
'aliasesStr': ','.join(aliases),