[med-svn] [SCM] aghermann branch, master, updated. 551e213a23b59b71cba6a9c3a282d1b60e21b854

Andrei Zavada johnhommer at gmail.com
Sun Apr 21 23:18:15 UTC 2013


The following commit has been merged in the master branch:
commit 84680a5b730d97041cf0a7149c5fdf27b357510e
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sun Apr 21 00:21:40 2013 +0300

    less strict parsing of PatientId, just drop 5th and extra subfields

diff --git a/src/libsigfile/edf.cc b/src/libsigfile/edf.cc
index 60f4ef7..f0e1f34 100644
--- a/src/libsigfile/edf.cc
+++ b/src/libsigfile/edf.cc
@@ -585,10 +585,12 @@ _parse_header()
 			auto subfields = tokens( _patient_id, " ");
 			if ( unlikely (_patient_id.empty()) ) {
 				_status |= missing_patient_id;
-			} else if ( subfields.size() != 4 ) {
+			} else if ( subfields.size() < 4 ) {
 				_subject.id = subfields.front();
 				_status |= nonconforming_patient_id;
 			} else {
+				if ( subfields.size() > 4 )
+					_status |= extra_patientid_subfields;
 				auto i = subfields.begin();
 				_subject.id = *i++;
 				_subject.gender = agh::SSubjectId::char_to_gender((*i++)[0]);
@@ -1005,6 +1007,8 @@ explain_edf_status( int status)
 		recv.emplace_back( "* File truncated");
 	if ( status & trailing_junk )
 		recv.emplace_back( "* File has trailing junk");
+	if ( status & extra_patientid_subfields )
+		recv.emplace_back( "* Extra subfields in PatientId");
 	return join(recv, "\n");
 }
 
diff --git a/src/libsigfile/edf.hh b/src/libsigfile/edf.hh
index 573b261..154518f 100644
--- a/src/libsigfile/edf.hh
+++ b/src/libsigfile/edf.hh
@@ -497,26 +497,27 @@ class CEDFFile
 
 
 	enum TStatus : int_least32_t {
-		ok			 = 0,
-		bad_header		 = (1 <<  0),
-		bad_version		 = (1 <<  1),
-		bad_numfld		 = (1 <<  2),
-		bad_recording		 = (1 <<  3),
-		date_unparsable		 = (1 <<  4),
-		time_unparsable		 = (1 <<  5),
-		nosession		 = (1 <<  6),
-		noepisode		 = (1 <<  7),
-		nonkemp_signaltype	 = (1 <<  8),
-		non1020_channel		 = (1 <<  9),
-		dup_channels		 = (1 << 10),
-		nogain			 = (1 << 11),
-		sysfail			 = (1 << 12),
-		too_many_channels	 = (1 << 13),
-		nonconforming_patient_id = (1 << 14),
-		missing_patient_id       = (1 << 15),
-		invalid_subject_details  = (1 << 16),
-		file_truncated           = (1 << 17),
-		trailing_junk            = (1 << 18),
+		ok			  = 0,
+		bad_header		  = (1 <<  0),
+		bad_version		  = (1 <<  1),
+		bad_numfld		  = (1 <<  2),
+		bad_recording		  = (1 <<  3),
+		date_unparsable		  = (1 <<  4),
+		time_unparsable		  = (1 <<  5),
+		nosession		  = (1 <<  6),
+		noepisode		  = (1 <<  7),
+		nonkemp_signaltype	  = (1 <<  8),
+		non1020_channel		  = (1 <<  9),
+		dup_channels		  = (1 << 10),
+		nogain			  = (1 << 11),
+		sysfail			  = (1 << 12),
+		too_many_channels	  = (1 << 13),
+		nonconforming_patient_id  = (1 << 14),
+		missing_patient_id        = (1 << 15),
+		invalid_subject_details   = (1 << 16),
+		file_truncated            = (1 << 17),
+		trailing_junk             = (1 << 18),
+		extra_patientid_subfields = (1 << 19),
 
 		inoperable		 = (bad_header
 					   | bad_version

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list