Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ sed -i -e 's/xmlns.*="[^"]*"//' $TARGET
sed -i -e 's/xsi:.*="[^"]*"//' $TARGET

rm Refdata.Articles.xml
rm $TARGET-e
rm temp.zip

rm -rf Refdata-AllHtml

Expand Down
8 changes: 6 additions & 2 deletions src/c2s/aips.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ MedicineList & parseXML(const std::string &filename,

// Mapping: https://github.com/zdavatz/cpp2sqlite/issues/252
// For --pinfo, Add both fi and pi: https://github.com/zdavatz/cpp2sqlite/issues/271
if (!(type == "fi" && v.second.get("Type", "") == "SmPC") &&
!(type == "pi" && (v.second.get("Type", "") == "SmPC" || v.second.get("Type", "") == "PIL"))
std::string medType = v.second.get("Type", "");
if (!(type == "fi" && medType == "SmPC") &&
!(type == "pi" && (medType == "SmPC" || medType == "PIL"))
) {
continue;
}
Expand All @@ -183,6 +184,9 @@ MedicineList & parseXML(const std::string &filename,
}

Medicine Med;
Med.type = medType == "SmPC" ? "FI"
: medType == "PIL" ? "PI"
: "";
Med.title = attachedDocument.second.get("Description", "");
boost::replace_all(Med.title, "&", "&"); // Issue #49

Expand Down
5 changes: 3 additions & 2 deletions src/c2s/cpp2sqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,10 @@ void openDB(const std::string &filename)

sqlDb.openDB(filename);

sqlDb.createTable(TABLE_NAME_AMIKO, "_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, auth TEXT, atc TEXT, substances TEXT, regnrs TEXT, atc_class TEXT, tindex_str TEXT, application_str TEXT, indications_str TEXT, customer_id INTEGER, pack_info_str TEXT, add_info_str TEXT, ids_str TEXT, titles_str TEXT, content TEXT, style_str TEXT, packages TEXT");
sqlDb.createTable(TABLE_NAME_AMIKO, "_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, auth TEXT, atc TEXT, substances TEXT, regnrs TEXT, atc_class TEXT, tindex_str TEXT, application_str TEXT, indications_str TEXT, customer_id INTEGER, pack_info_str TEXT, add_info_str TEXT, ids_str TEXT, titles_str TEXT, content TEXT, style_str TEXT, packages TEXT, type TEXT");
sqlDb.createIndex(TABLE_NAME_AMIKO, "idx_", {"title", "auth", "atc", "substances", "regnrs", "atc_class"});
sqlDb.prepareStatement(TABLE_NAME_AMIKO,
"null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?");
"null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?");

sqlDb.createTable(TABLE_NAME_PRODUCT, "_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, author TEXT, eancodes TEXT, pack_info_str TEXT, packages TEXT");
sqlDb.createIndex(TABLE_NAME_PRODUCT, "idx_prod_", {"title", "author", "eancodes"});
Expand Down Expand Up @@ -1176,6 +1176,7 @@ int main(int argc, char **argv)
rowToInsert.atc = m.atc;
rowToInsert.substances = m.subst;
rowToInsert.regnrs = m.regnrs;
rowToInsert.type = m.type;

// atc_class
std::string atcClass = ATC::getClassByAtcColumn(m.atc);
Expand Down
1 change: 1 addition & 0 deletions src/c2s/medicine.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct Medicine {
std::string style;
std::string contentHTMLPath; // Path to the XHTML file
std::string sections;
std::string type; // "FI" for type=SmPC, "PI" for type=PIL
};

typedef std::vector<Medicine> MedicineList;
Expand Down
1 change: 1 addition & 0 deletions src/sqlDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ void Sql::insertRow(const std::string_view &tableName, DB::RowToInsert row) {
// TODO:
bindText(16, row.style_str);
bindText(17, row.packages);
bindText(18, row.type);
runStatement(tableName);
}

Expand Down
1 change: 1 addition & 0 deletions src/sqlDatabase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct RowToInsert {
std::string content;
std::string style_str;
std::string packages;
std::string type; // "FI" for Fachinfo or "PI" for Patinfo
};

struct Sql
Expand Down