internal Encounter getFromEncounterString(string encounterString)
{
string[] flds = StringUtils.split(encounterString, StringUtils.SEMICOLON);
if (flds.Length != 3)
{
throw new Exception("Invalid encounter string: does not contain 3 parts");
}
if (!StringUtils.isNumeric(flds[0]))
{
throw new Exception("Invalid encounter string: non-numeric location IEN");
}
//TBD: how to test for valid VistA timestamp (fld[1])
if (flds[2] != "A" && flds[2] != "H" && flds[2] != "E")
{
throw new Exception("Invalid encounter string: type must be A, H or E");
}
Encounter result = new Encounter();
result.LocationId = flds[0];
result.Timestamp = flds[1];
result.Type = flds[2];
return result;
}