{"id":50161830,"url":"https://github.com/kageroumado/piru","last_synced_at":"2026-05-28T20:00:37.942Z","repository":{"id":359454696,"uuid":"1246156319","full_name":"kageroumado/piru","owner":"kageroumado","description":"iOS substance dose tracker with pharmacokinetic timelines and interaction warnings","archived":false,"fork":false,"pushed_at":"2026-05-27T16:07:18.000Z","size":15846,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-27T19:27:53.044Z","etag":null,"topics":["ios","substance-tracking","swift","tracker-application"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kageroumado.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-21T23:41:44.000Z","updated_at":"2026-05-27T19:09:38.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/kageroumado/piru","commit_stats":null,"previous_names":["kageroumado/piru"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kageroumado/piru","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kageroumado%2Fpiru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kageroumado%2Fpiru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kageroumado%2Fpiru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kageroumado%2Fpiru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kageroumado","download_url":"https://codeload.github.com/kageroumado/piru/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kageroumado%2Fpiru/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33624221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","substance-tracking","swift","tracker-application"],"created_at":"2026-05-24T16:44:39.716Z","updated_at":"2026-05-28T20:00:37.896Z","avatar_url":"https://github.com/kageroumado.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Piru\n\nA substance dose tracker for iOS. Logs what you took, when, and at what\ndose; overlays pharmacokinetic curves so you can see what's still active;\nwarns about drug interactions before you stack them.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\".github/screenshot-journal.png\" alt=\"Piru Journal — days view grouped by date with category tags\" width=\"300\"\u003e\n  \u003cimg src=\".github/screenshot-day.png\" alt=\"Piru day detail with a pharmacokinetic timeline graph for an Alcohol dose\" width=\"300\"\u003e\n\u003c/p\u003e\n\nBuilt primarily for harm reduction: medication adherence, recreational\nsession tracking, and stack safety. Substance data is sourced from\n[TripSit][tripsit], [PsychonautWiki][pw], and the FDA's\n[DailyMed][dailymed] — merged and deduplicated into a single library of\n~1,100 substances with dose ranges, routes, durations, and half-lives.\n\n[tripsit]: https://tripsit.me\n[pw]: https://psychonautwiki.org\n[dailymed]: https://dailymed.nlm.nih.gov\n\n## Status\n\nPiru is **no longer actively maintained**. The original author\n([@yunaveth](https://github.com/yunaveth)) stepped back; the repository\nis open-sourced here so anyone who finds it useful can keep it running,\nfork it, or learn from it. Issues and PRs are welcome but response time\nis best-effort.\n\nIt shipped on TestFlight as **v1.2 (build 5)** and was never published\nto the App Store.\n\n## Features\n\n- **~1,100 substances** with dose ranges (threshold / light / common /\n  strong / heavy), administration routes, duration profiles, and\n  half-lives.\n- **Pharmacokinetic timeline.** A one-compartment oral PK model\n  estimates absorption rate from each route's onset and renders the\n  resulting concentration curve; doses scale the curve height by\n  amount-to-heavy ratio.\n- **Interaction warnings.** 59 class-based interaction rules covering\n  the common danger pairs (MAOI + stimulant, opioid + benzo, lithium +\n  NSAID, etc.). Warnings appear inline during logging and as a danger\n  window on the timeline.\n- **Live Activity.** Active doses appear on the Lock Screen and in the\n  Dynamic Island with their remaining duration.\n- **Harm-reduction notifications.** Optional ramp-down reminders\n  grouped into 6-hour sessions, so back-to-back doses don't fragment\n  into separate alert chains.\n- **Daily medication tracking.** Prescription / supplement adherence\n  with weekday-aware reminders, separate from the recreational journal.\n- **Insights.** Activity heatmap, usage stats, half-life calculator,\n  per-substance trend charts.\n- **Custom substances.** Add anything not in the merged library — name,\n  category, dose ranges, route, half-life — and it participates in\n  search, interactions, and PK.\n- **Export.** PsyLog-compatible JSON and PDF reports with PK charts.\n\n## Requirements\n\n- **iOS 26 or later.** The UI is built around Liquid Glass; older iOS\n  versions are not supported.\n- **Xcode 26 or later** with Swift 6.\n- Apple developer account for code signing (TestFlight only; not on the\n  App Store).\n\n## Building\n\n```bash\ngit clone https://github.com/kageroumado/piru.git\ncd piru\nopen Piru.xcodeproj\n```\n\nSelect the **Piru** scheme and Run. Code signing is configured for the\noriginal developer team; set your own `DEVELOPMENT_TEAM` and bundle\nidentifiers in Xcode's signing settings before building to a device.\n\nFor a headless compile check:\n\n```bash\nxcodebuild -scheme Piru \\\n  -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \\\n  build\n```\n\nTo run the test suite (387 tests, Apple Testing framework):\n\n```bash\nxcodebuild -scheme Piru \\\n  -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \\\n  test\n```\n\nThere is also a Swift Package Manager CLI in `Tools/SubstanceValidator`\nthat cross-checks the merged substance library against the upstream\nAPIs; useful when refreshing the cache.\n\n```bash\ncd Tools/SubstanceValidator\nswift run SubstanceValidator validate\n```\n\n## Architecture\n\n```\nPiru/\n├── Models/                 Substance, DoseRange, DurationProfile, units\n├── Views/                  SwiftUI tabs: Journal, Library, Tools, Insights\n├── Data/                   SubstanceLibrary, HalfLifeDatabase, Interactions\n├── Services/               TripSit, PsychonautWiki, DailyMed API clients\n└── Utilities/              PKModel, RampDownScheduler, exporters\n\nShared/                     Code shared with widgets + Live Activity\nPiruLiveActivityExtension/  Lock Screen / Dynamic Island widget\nPiruWidget/                 Home Screen widgets\nPiruTests/                  Swift Testing suites\nTools/SubstanceValidator/   CLI for validating substance data\n```\n\n- **SwiftUI + SwiftData.** `@Model` types are used directly in views;\n  there is no separate ViewModel layer. Managers (`SubstanceLibrary`,\n  `LiveActivityManager`, etc.) are `@Observable @MainActor` singletons.\n- **Swift 6 strict concurrency** with `@MainActor` default isolation.\n- **Substance data lifecycle.** Three API clients fetch in parallel,\n  results are merged with a name-normalising deduplicator, and the\n  combined library is cached to `substances_cache.json` with a 7-day\n  TTL.\n- **Search.** Ranked cascade — exact match → alias → prefix → substring\n  → fuzzy (Levenshtein) — so common names beat obscure ones even when\n  both match.\n- **PK model.** One-compartment oral with route-aware absorption.\n  `ka` is estimated from each route's onset time; `Cmax` and `Tmax`\n  are derived from the resulting curve and overlaid on the timeline.\n\n## Contributing\n\nIssues and PRs welcome, with the caveat above about maintenance pace.\nSubstance data corrections are especially useful — open an issue with\nthe substance name and the source you're using.\n\nIf you ship a fork, please don't call it \"Piru\" — the name and the pink\nflame icon were Yuna's. Pick your own.\n\n## License\n\nPiru is free software, licensed under the **GNU General Public\nLicense, version 3** — see [LICENSE](LICENSE).\n\n## Acknowledgements\n\nOriginally built by [Yuna](https://github.com/yunaveth). Pharmacology\ndata courtesy of [TripSit][tripsit], [PsychonautWiki][pw], and the\n[NIH's DailyMed][dailymed]. Half-life values are drawn from a hand-curated\ndatabase of ~1,100 entries; see `Piru/Data/HalfLifeDatabase.swift`.\n\n**Piru is not medical advice.** It will not stop you from making a bad\ndecision. Get a test kit, dose low, and have a sober friend.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkageroumado%2Fpiru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkageroumado%2Fpiru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkageroumado%2Fpiru/lists"}