Sha256: a95a514ce8f838cf6881e91e0473bf823df906decd636c2c1d3d87e3da0ee9c5

Contents?: true

Size: 1.84 KB

Versions: 23

Compression:

Stored size: 1.84 KB

Contents

# frozen_string_literal: true

# https://github.com/renalreg/ukrdc/blob/6d95e364dd8de857839fe6cdbd4e7fc3fb4c1d42/Schema/Diagnoses/Diagnosis.xsd
xml = builder
xml.Diagnoses do
  patient.yes_comorbidities.each do |comorb|
    xml.Diagnosis do
      xml.Diagnosis do
        xml.CodingStandard "SNOMED"
        xml.Code comorb.code
        xml.Description comorb.name
      end

      # See email from GS to TC 23/5/18 regarding dates.
      # UKRDC would like to receive a date so if no onset date stored in RW for the comorbidity,
      # send the esrf date as the identification date
      if comorb.date.present?
        xml.OnsetTime comorb.date
      elsif patient.esrf_on.present?
        xml.IdentificationTime patient.esrf_on
      end
    end
  end

  if patient.smoking_history?
    xml.Diagnosis do
      xml.Diagnosis do
        xml.CodingStandard "SNOMED"
        xml.Code patient.snomed_smoking_history.code
        xml.Description "Smoking history: #{patient.snomed_smoking_history.description}"
      end
      # We don't store a smoking date (it doesn't make much sense to) but UKRDC
      # would like a date so send th ESRF date. See email from GS to TC 23/5/18.
      xml.IdentificationTime(patient.esrf_on) if patient.esrf_on.present?
    end
  end

  if patient.dead? && patient.first_cause.present?
    # Only 1 CauseOfDeath element is allowed so we ignore patient.second_cause
    render(
      "renalware/api/ukrdc/patients/diagnoses/cause_of_death",
      builder: xml,
      cause: patient.first_cause
    )
  end

  if patient.prd_description_code.present?
    xml.RenalDiagnosis do
      xml.Diagnosis do
        xml.CodingStandard "EDTA2"
        xml.Code patient.prd_description_code
        xml.Description patient.prd_description_term
      end
      xml.IdentificationTime(patient.first_seen_on) if patient.first_seen_on.present?
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
renalware-core-2.0.102 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.101 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.100 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.99 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.98 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.97 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.96 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.95 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.94 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.93 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.92 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.91 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.90 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.89 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.88 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.87 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.86 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.85 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.84 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder
renalware-core-2.0.83 app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder