{"id":14225492,"url":"https://github.com/tedpearson/edf-importer","last_synced_at":"2025-08-02T10:30:39.982Z","repository":{"id":221920488,"uuid":"755776002","full_name":"tedpearson/edf-importer","owner":"tedpearson","description":"Tool to import .edf files (particularly from CPAP machines) to influxdb or victoriametrics.","archived":false,"fork":false,"pushed_at":"2025-05-06T00:57:25.000Z","size":9248,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-06T01:37:57.638Z","etag":null,"topics":["apnea","cpap","edf","grafana-dashboard","influxdb","resmed","sleep-apnea","victoriametrics"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tedpearson.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2024-02-11T02:28:56.000Z","updated_at":"2025-05-06T00:57:28.000Z","dependencies_parsed_at":"2024-04-19T14:31:36.234Z","dependency_job_id":"1b9518b6-5501-470c-b4a1-3dd648d4acfb","html_url":"https://github.com/tedpearson/edf-importer","commit_stats":null,"previous_names":["tedpearson/edf-importer"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tedpearson/edf-importer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedpearson%2Fedf-importer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedpearson%2Fedf-importer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedpearson%2Fedf-importer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedpearson%2Fedf-importer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tedpearson","download_url":"https://codeload.github.com/tedpearson/edf-importer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tedpearson%2Fedf-importer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268370670,"owners_count":24239777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"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":["apnea","cpap","edf","grafana-dashboard","influxdb","resmed","sleep-apnea","victoriametrics"],"created_at":"2024-08-20T01:01:01.012Z","updated_at":"2025-08-02T10:30:38.320Z","avatar_url":"https://github.com/tedpearson.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# edf-importer\nTool to import .edf files to influxdb or victoriametrics.\nI created this tool to import data from my ResMed AirSense 11 AutoSet CPAP machine into VictoriaMetrics.\nIt may not necessarily correctly import data from other models or brands yet. \nIt does support both timeseries metrics and annotations (events).\n\n## Caveats\n- The path is expected to be a directory filled with datestamped dirs in `YYYYmmdd` format.\n- The filenames to read are currently requiring to end in BRP.edf, EVE.edf, or PLD.edf.\n- EDF / CPAP data is usually sampled at a very high rate. Make sure your database is configured\nto allow this. For Victoriametrics, for example, make sure the flag `-dedup.minScrapeInterval` is\nset to a low value, in my case less than 40ms.\n- The data is read with your computer's local timezone, as EDF files do not necessarily have a timezone\nassociated with their data.\n- Zero-duration events from EDF+ annotations are automatically given a 10 second duration.\nThis was done to allow easier graphing of ResMed Hypopnea events.\n\n## Running\n\nCopy `edf-importer.example.yaml` to `edf-importer.yaml` and fill in your database config.\n\nEdf-importer will continue to run and watch the specified path, importing new data the next time\nyou insert your SD card.\n\n    ./edf-importer --config edf-importer.yaml --path /Volumes/\u003cdrivename\u003e/folder    \n\n    Usage of ./edf-importer:\n      -config string\n        \tConfig file (default \"edf-importer.yaml\")\n      -dry-run\n        \tDon't insert into the database\n      -path string\n        \tPath to data directory (default \"/Volumes/NO NAME/DATALOG\")\n      -state-file string\n        \tState file (default \"edf-importer.state.yaml\")\n      -v\tShow version and exit\n\n## Running as a macOS LaunchAgent\n\n- Create a directory for edf-importer to live in. I chose `/Users/me/Documents/edf-importer`.\n- Copy to the directory:\n  - The `edf-importer` binary\n  - Download `edf-importer.example.yaml`, rename to `edf-importer.yaml` and fill in your values\n  - Download `com.github.tedpearson.edf-importer.plist.example`, rename to \n  `com.github.tedpearson.edf-importer.plist`, and modify the paths to point to the directory\n  you chose above, and change the `--path` argument to point to your SD card volume.\n  - Move `com.github.tedpearson.edf-importer.plist` to `~/Library/LaunchAgents`\n  - Start edf-importer with `launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.github.tedpearson.edf-importer.plist`\n  - Stop edf-importer with `launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.github.tedpearson.edf-importer.plist`\n\n## Details\n\nInfo about exported data:\n\nMetric name: **cpap**\n- fields:\n  - \"edf supplied name\"\n    - name will be whatever the EDF label name is from the EDF file.\n    - contains the raw data from the EDF file\n  - annotation\n    - value of 1 during the event\n    - value of 0 before and after the event\n- tags\n  - event\n    - contains the EDF+ annotation name\n    - only on annotation events, not raw data\n\n## Dashboard\n\nI have included my [Grafana dashboard definition](dashboard/dashboard.json) in the repo.\nI based it heavily on the graphs in OSCAR (see [Other Resources](#other-resources)).\n\nNote that the dashboard as exported uses a VictoriaMetrics (Prometheus-like) datasource,\nnot an InfluxDB datasource.\n\nFeatures:\n- Annotation/Events, large leak, and flow limit color block display, which are toggleable\n- Graphs of Flow Rate, Pressure, AHI, Snore Index, Flow Limit index, Leak Rate,\n  Respiration Rate, Minute Ventilation, and Tidal Volume.\n- Last Night singlestat view. Reports midnight-midnight values only. Only valid when the end of your time range\n  falls during an awake period.\n- AHI/Event daily bar charts. Report midnight-midnight values only.\n\nHere are a few screenshots of the dashboards:\n- A week, currently the default view, showing off AHI/Events per day views\n- An entire night\n- A zoomed in view so you can really see the details of the annotations and individual breaths.\n\n### Dashboard - Week\n![Weekly Dashboard](dashboard/dashboard-week.png)\n\n### Dashboard - Full Night\n![Nightly Dashboard](dashboard/dashboard-night.png)\n\n### Dashboard - Zoomed\n![Zoomed Dashboard](dashboard/dashboard-zoomed.png)\n\n## Other Resources\n\nEdf-importer was heavily influence by and my dashboards were inspired by\n[OSCAR, the Open Source CPAP Analysis Reporter](https://www.sleepfiles.com/OSCAR/).\nOSCAR allows you to import and view all the same data, see overviews and summary reports,\nand also has some additional calculated metrics including inpiration time, expiration time, and\ntime at pressure. I will note that its AHI graph resets every time there is a data gap (when\nyou take off the mask), so my dashboard is more accurate in this one case.\n\nFor many people, OSCAR is probably all you need. For the nerds, this project is for you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftedpearson%2Fedf-importer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftedpearson%2Fedf-importer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftedpearson%2Fedf-importer/lists"}