public static DiagnosisProblem GetDiagnosisProblemFromDiagnosisProblemAct(this HtmlNode diagnosisProblemAct, Client client) { //TODO: Can there be many observations under an act? The schema definition says there can, but I can't find any examples? var diagnosisProblemObservation = diagnosisProblemAct.SelectSingleNode(@"entryrelationship[@typecode='SUBJ']/observation[@classcode='OBS']"); var diagnosisProblem = new DiagnosisProblem(client) { ProblemResult = diagnosisProblemObservation?.SelectSingleNode("value").GetResultValue(), DateRange = diagnosisProblemObservation?.GetDateRange(), //use the date on the observation (which is the date of biological onset), //NOT the date on the act (which is the date the concern was authored in the patient's chart) //TODO: but does that ^ make sense if there are multiple observations under the same concern act?? Status = diagnosisProblemAct.SelectSingleNode("statuscode").GetCode(), //use the status code on the act (which is the overall concern status), //NOT the statusCode on the observation TargetSite = diagnosisProblemAct.SelectSingleNode(".//targetsitecode/qualifier/value").GetCode(), Severity = diagnosisProblemAct .SelectSingleNode( @".//entryrelationship[@typecode='SUBJ' and @inversionind='true']/observation[@classcode='OBS' and code[@code='SEV']]/value") .GetCode() }; var negationInd = diagnosisProblemObservation?.Attributes["negationind"]?.Value; if (bool.TryParse(negationInd, out var notPresent)) { diagnosisProblem.NotPresent = notPresent; } return(diagnosisProblem); }
public void GetDynamicParametersReturnsCorrectPropertyValuesForDiagnosisProblem(string testName, DiagnosisProblem diagnosisProblem) { var dynamicParameters = diagnosisProblem.GetDynamicParameters(); Assert.Equal(diagnosisProblem.ProblemResult?.Code?.Value, dynamicParameters["D001"]); Assert.Equal(diagnosisProblem.ProblemResult?.Code?.DisplayName, dynamicParameters["D002"]); Assert.Equal(diagnosisProblem.DateRange?.DateLow?.Value, dynamicParameters["D003"]); Assert.Equal(diagnosisProblem.DateRange?.DateHigh?.Value, dynamicParameters["D004"]); Assert.Equal(diagnosisProblem.DataSubType, dynamicParameters["D005"]); Assert.Equal(diagnosisProblem.ProblemResult?.Code?.CodeSystem?.Value, dynamicParameters["D011"]); Assert.Equal(diagnosisProblem.ProblemResult?.Code?.CodeSystemName, dynamicParameters["D012"]); Assert.Equal(diagnosisProblem.Severity?.Value, dynamicParameters["D018"]); Assert.Equal(diagnosisProblem.Severity?.DisplayName, dynamicParameters["D019"]); Assert.Equal(diagnosisProblem.Severity?.CodeSystem?.Value, dynamicParameters["D020"]); Assert.Equal(diagnosisProblem.ProblemResult?.Type.ToString(), dynamicParameters["D031"]); Assert.Equal(diagnosisProblem.Status?.Value, dynamicParameters["D032"]); Assert.Equal(diagnosisProblem.TargetSite?.Value, dynamicParameters["D033"]); Assert.Equal(diagnosisProblem.TargetSite?.DisplayName, dynamicParameters["D034"]); Assert.Equal(diagnosisProblem.TargetSite?.CodeSystem?.Value, dynamicParameters["D035"]); Assert.Equal(diagnosisProblem.TargetSite?.SdtcValueSet?.Value, dynamicParameters["D036"]); }