Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP read sequential files 1

Status
Not open for further replies.

Jan Flikweert

Programmer
Mar 20, 2022
85
NL
Hi all,

I hope I spelled the word sequential files correct.

I attached an example of this kind of files. How to read this in VFP? Line by line filetostr seems not to be the option. wscript.shell stdin read is also not clear and not well documented.

This is a file from the open source program OSCAR. And it contains data from my personal CPAP device regarding sleep apnea.

Kind regards,

Jan Flikweert




 
 https://files.engineering.com/getfile.aspx?folder=99ef7206-de79-45a4-ab27-e21f4e3de1e2&file=65690040.001
The .001 and .000 are no EDF+ format.
No idea what you talk about, but as you found a way to convert to csv without needing to dig into the details of file formats: Congratulations.

If you wanted to write a software usable not only for your specific brand of Medrec device, then I can only comment that it's already astonishing at least one such general file format for medical data series exists. By the name it's limited to europe, unless it has been adopted to other regions as well.

Regarding "For me this will do" on the topic of making such a feature available to a more general audience having same type of files, you can of course program a RUN statement or ShellExecute with parameters to use a command line tool and therefore include that "automation" insode a VFP application. That's not a problem, unless the software license wouldn#t allow to use it as a component in a software package. Well, the problem seems there are some standards, but they still are no general CPAP standards you can base a software on.

Well, would it be that much of a hurdle? If you would start programming yet another image processing software you'd also need to support many image file formats, not just JPG or PNG.

Chriss
 
I think he is talking about the file extensions

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
Plausible, the only thing I'm reminded of is split zip archives with extensions of .z01, .z02, etc. when creating archives larger than a floppy disk - so in short for spanning. That plays almost no role in todays world, but if this is about spanning, then I would also not expect a .000 or .0001 file to have their own header, they are just continuations of an EDF file. It would rather be more data that wasn't stored in the first edf file of the series.

Chriss
 
It's quite common to use a file naming convention like this on dashcams and security video recorders - where disk space
concerns mean the earliest records are overwritten on a daily basis... maybe

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
In todays file systems for Windows NTFS is available also for SD cards or USB thumb drives, so usually there is no need for splitting up a file into mutiple files, but it may be this SD card still uses FAT32 or the firmware of the divice splits up files. If the edf file and the .000 file have the same large filke size, that would point to that reasoning. To not overwrite previous day/night data, well, that could at least be solved just like cameras number there photos in the first part of the file name, not in the extension.

I would expect the first edf file to point out it has further files belonging to it. At least the number of files.

Chriss
 
OSCAR stores binary data files in this place. Ready to read.....
Untitled_liqcbm.jpg

On the SD card of the CPAP device are the edf files located.

Kind regards,

Jan Flikweert
 
Okay, there are a lot more not in sight.

Maybe your device doesn't store in EDF format, then. Any documentation about the device?

What strikes out to me is all these files are from the same mniute, except two of a minute before the other files. And the name "Events" of the folder, I don't really know what to make out of this, but maybe each file is about a different event, i.e. it stores a different data series, different measurements.

Well, and let us understand this. I thought OSCAR is a software to process data generated by devices like smart watches about your sleep, not the software on the smartwatch itself. So the original device files would be somewhere else, wouldn't they? The whole plethora of website links were all about the original files from devices that can be found on the SD card, which would originate from the device in EDF format, beswides perhaps other formats. If you say this is OSCAR [highlight #FCE94F]output[/highlight], specifically, not the input data, then this is preprocessed data, whatever, maybe even images generated by OSCAR. You should be interested in getting the original measurements from the device, not from OSCAR, shouldn't you? Or am I getting this totally wrong?

I mean, does it even still matter? Didn't you say you managed to get csv from some edf file?

Chriss
 
Hi all,

Just forget everything written in this thread. Keep it easy.

The question is: How to read a binary file like f.e. attached?
The answer is: There is a header detected and further solving this files is a hard work.

Kind regards,

Jan Flikweert
 
 https://files.engineering.com/getfile.aspx?folder=2652c3f7-82ac-439e-aff0-583edb10ac63&file=65690040.000
If that's the summary of what you take away from this thread, then yoiu overlook a lot of things:

1. You show you see this files in a directory of the OSCAR software. And as far as I understand it that's a software exctrcting the sleep data from an external device, like a smart watch.
The external links I visited talked of the source of sleep data from edf files that are stored on the sd card of the smart watch or other external device.

The .000 and .001 files might be what Oscar generates as step 1 from reading out the measurementsw of sleep apps or other firmware originally recording the time series, but this, as yoiu said yourself is neither edf format nor may it be the data you actually need at all, it may be results OSCAR created from the actual sleep data.

Ao in short: Start from scratch and look at the SD card yourself, not into OSCAR directories. Even if this is preprocesses sleep data you have no idea in what format they are. Your only source of information about these OSCAR files would be the source code of the OSCAR software, which
And the simpler technical aspect is reqading a file is simple that even only takess FILETOSTR(), knowing it's structure and interpreting it correctly is the difficulty.

Your next step should be looking for sleep data on the sd card of your device, before diving into OSCAR source code to understand how the .000 files are generated by OSCAR.

Chriss
 
Chriss,

That should be some new topics. When I wish to explain how why and what I do I can open some new topics. There are no further questions.

Kind regards,

Jan Flikweert
 
Just a heads up: You haven't started a new thread on this.

I'd be there to help, no problem.

I just noticed you contradict yourself in many aspects within this thread, like whether the files you found are edf format or not, once saying .000 and .001 filoes are not EDF files and then you show a directory of .000 and .001 files being edf files.

It's easy enough to figure out whether the first 8 bytes look like an ASCII version number or not, there's no need to try to riddle about the rest of the file, if that first aspect alone doesn't match the file specification.

It's also not helpful if you say you manage to get CSV out with something, but don't refer to what you used for that. You're stepping on your own feet in trying to get forward with this. Which easily explains why you stumble forward, at best.

I can imagine many reasons for why you didn't yet have more time for this, all the best for whatever other things more important currently.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top