当前位置: 首页>>代码示例>>C++>>正文


C++ Patient::isValid方法代码示例

本文整理汇总了C++中Patient::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ Patient::isValid方法的具体用法?C++ Patient::isValid怎么用?C++ Patient::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Patient的用法示例。


在下文中一共展示了Patient::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: convertBestRx

void CSVConverter::convertBestRx(const QString& filename)
{
    CSVFile file;
    if (!file.read(filename))
    {
        return;
    }

    // skip header line
    file.parseNextLine();
    while (!file.atEnd())
    {
        QList<QVariant> data = file.parseNextLine();
        if (data.size() < 40 || data.first().toString().isEmpty())
            continue;
        Patient pat;
        QStringList names = data[0].toString().split(',', QString::SkipEmptyParts);
        if (names.size() != 2)
        {
            qDebug() << "Failed to parse" << data[0];
            continue;
        }
        pat.surname = names.first().trimmed();
        pat.firstName = names.last().trimmed();
        pat.dateOfBirth = data[5].toDate();
        pat.gender = (data[10].toString() == "M") ? Patient::Male : Patient::Female;
        if (!pat.isValid())
        {
            qDebug() << "invalid patient" << pat.surname;
            continue;
        }

        QString entity = data[7].toString();
        Pathology path;

        path.context = PathologyContextInfo(PathologyContextInfo::BestRx).id;
        path.entity  = Pathology::Breast;
        QDate date;
        QList<int> fields;
        fields << 17 << 21 << 25;
        foreach (int f, fields)
        {
            if (data[f].isValid() && data[f].type() == QVariant::Date)
            {
                path.date = data[f].toDate();
                break;
            }
        }
        if (!path.date.isValid())
        {
            qDebug() << "Pathology date not available" << pat.surname;
            //continue;
        }

        QString sampleOrigin = data[35].toString();
        if (sampleOrigin.contains("Primär") || sampleOrigin.contains("Zytologie"))
        {
            path.sampleOrigin = Pathology::Primary;
        }
        else if (sampleOrigin == "LK")
        {
            path.sampleOrigin = Pathology::LocalLymphNode;
        }
        else if (sampleOrigin.contains("Metastase"))
        {
            path.sampleOrigin = Pathology::Metastasis;
        }
        else
        {
            qDebug() << "Unhandled sampleOrigin" << sampleOrigin;
        }

        // FGFR1
        if (data[23].toString().contains("amplified", Qt::CaseInsensitive))
        {
            bool fgfr1Amplified = data[18].toString() == "Amplified";
            path.properties << toProperty(PathologyPropertyInfo::Fish_FGFR1, fgfr1Amplified);
        }

        // PIK3Ca mut.
        if (data[22].toString().contains("Wild Type") || data[22].toString().contains("Mutant"))
        {
            bool pik3mutant = data[22].toString().contains("Mutant");
            QString mutation;
            if (pik3mutant)
            {
                mutation = data[22].toString().remove("Mutant").trimmed();
            }
            path.properties << toProperty(PathologyPropertyInfo::Mut_PIK3CA_10_21, pik3mutant, mutation);
        }

        // PIK3ca Ampl.
        if (data[23].toString().contains("Amplified", Qt::CaseInsensitive))
        {
            bool pik3Amplified = data[23].toString() == "Amplified";
            path.properties << toProperty(PathologyPropertyInfo::Fish_PIK3CA, pik3Amplified);
        }

        // PTEN
        if (data[29].toString().contains("PTEN staining", Qt::CaseInsensitive))
//.........这里部分代码省略.........
开发者ID:veaceslav,项目名称:TumorProfil,代码行数:101,代码来源:csvconverter.cpp

示例2: if

void CSVConverter::convertBGJ389(const QString& filename)
{
    CSVFile file;
    if (!file.read(filename))
    {
        return;
    }

    // skip header line
    file.parseNextLine();
    while (!file.atEnd())
    {
        QList<QVariant> data = file.parseNextLine();
        if (data.size() < 10 || data.first().type() != QVariant::Int)
            continue;
        Patient pat;
        pat.surname = data[2].toString();
        pat.firstName = data[3].toString();
        pat.dateOfBirth = data[5].toDate();
        pat.gender = (data[4].toString() == "m") ? Patient::Male : Patient::Female;
        if (!pat.isValid())
        {
            qDebug() << "invalid patient" << pat.surname;
            continue;
        }

        QString entity = data[7].toString();
        Pathology path;

        path.context = PathologyContextInfo(PathologyContextInfo::ScreeningBGJ398).id;

        if (entity == "NSCLC")
            path.entity = Pathology::PulmonarySquamous;
        else if (entity == "Mamma")
            path.entity = Pathology::Breast;
        else if (entity == "Bladder")
            path.entity = Pathology::TransitionalCell;
        else
        {
            qDebug() << "Unhandled entity" << entity;
            continue;
        }

        QString sampleOrigin = data[10].toString();
        if (sampleOrigin == "Primär")
        {
            path.sampleOrigin = Pathology::Primary;
        }
        else if (sampleOrigin == "LK")
        {
            path.sampleOrigin = Pathology::LocalLymphNode;
        }
        else if (sampleOrigin.contains("Metastase"))
        {
            path.sampleOrigin = Pathology::Metastasis;
        }
        else
        {
            qDebug() << "Unhandled sampleOrigin" << sampleOrigin;
            continue;
        }

        QString result = data[15].toString();

        bool hasAmplification;
        if (result.contains("neg"))
        {
            hasAmplification = false;
        }
        else if (result.contains("pos"))
        {
            hasAmplification = true;
        }
        else // "NA"
        {
            qDebug() << "invalid result" << result;
            continue;
        }

        Property prop;
        PathologyPropertyInfo info(PathologyPropertyInfo::Fish_FGFR1);
        ValueTypeCategoryInfo catInfo(info.valueType);
        prop.property = info.id;
        prop.value = catInfo.toPropertyValue(hasAmplification);
        path.properties << prop;

        //qDebug() << pat.surname << path.entity << path.sampleOrigin << hasAmplification;

        QList<Patient::Ptr> ps = PatientManager::instance()->findPatients(pat);
        Patient::Ptr p;
        if (ps.isEmpty())
        {
            p = PatientManager::instance()->addPatient(pat);
        }
        else
        {
            p = ps.first();
        }

        if (!p->hasDisease())
//.........这里部分代码省略.........
开发者ID:veaceslav,项目名称:TumorProfil,代码行数:101,代码来源:csvconverter.cpp


注:本文中的Patient::isValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。