How to integrate a PACS server (DCM4CHE) with personal database - database

Hi i am a newbie to programming. I have 100 or so CT scans stored on a PACS (dcm4che). I am trying to link all patients to a teaching file database (simple django application) which will have teaching points on each case. Can someone direct me to a tutorial or a brief direction to what sort of programming will integrate the two? i do realise the generic nature of the question. I have 20 days to work on this so am willing to start from scratch
Thanks

I would recommend against anything specific as diving into dcm4che. Instead if you would like to use standard API, you should use the QIDO-RS/WADO API provided by dcm4chee.
One of the main author did also document how to install such instance here

I would suggest to bind yiur django app or project to the appropriate dcm4chee databese. Since you have all priviliges just create a new table within dcm4chee database which has a simple foreign key column named SOPinstanceUid. In this column you just store the SOPinstanceUId of your preferred images. Then of course you can additionally provide all columns you need for your teaching problem.
You can of course also create a seperate database and bind your django app to both databases and use the SOPInstance uid also as main key to establish the relationship between dcm4chee db and teaching db.
Within your django app you can then of course manage your teaching table or db and query the filenames of the images which you have selected for teaching.The key of this relationship is the SOPInstanceUID of the dicom image.
This approach just needs some expertise in SQL, some knowledge of the preconfigured database and of course django and DICOM.

Related

Best way to save objects in database

The Story:
I’m trying to develop a big application in PHP. The main problem is that I have to deal with the objects and I need to apply CRUD operations. Ex: Suppose we have class diagram (Compiler):
Project { name:string, statements:list …}
Statement{ type:string }
IfStatement exend Statement { condition:Exp, …}
…
The question (What is the best design for ERD or database)
as I know I’ve two solutions:
Serialize the main object and save it in the DB
Make a table for each class in the class diagram and linking by foreign keys
Note: I’ve read about ORM but I think it’s similar to 1st solution
Serializing your objects in your database is in my opinion not a good solution.
You must be able to find and edit each object properties in your database.
It requires a simple logic structure, with relations and keys.
This way you'll be able to build a CRUD Admin Dashboard, read and edit all your data in a logical and reliable way.
MySQL Workbench is a real good starting point, it communicates with PhpMyAdmin, you can use it to build your database and create shemas.
Then if you're looking for a professional CRUD Generator I suggest this one: https://www.phpcrudgenerator.com/
[Disclaimer: I'm the author]
It can build your CRUD admin dashboard in a very simple way within a few minutes, and comes with many advanced features.
The Admin dashboard generated by the CRUD Generator is powered with Bootstrap 4, jQuery, PHP objects and TWIG templates.

Laravel - Migrate database from other frameworks

I was working on a project which is already advanced, specially the database, that has been filled by someone from my team, even though part of it has not been used yet. Some tables can be emptied and refilled as it's sample data, however most of them contains data which will be actually used or it's been used in the parts we're doing now.
The project started in CodeIgniter, by we've realized that Laravel can save us hours of work, so we're planning to migrate it. The point is that we didn't use the CodeIgniter's migration system, and we've seen in the Laravel documentation that only the table structure will be migrated, plus we have to create every migration.
The question here is if there's a way to both, create the migratinos files automatically, and to keep the relevant data that will be used in the application so we don't need to refill the database again (yep, there are kind of big tables). We thought on the seeders, but what we've seen is that they only store sample data...
You can use Laravel migration generator. It will simply help you to generate migrations from your
existing database. Check it out below. You will find in readme how to use it. Good luck.
https://github.com/Xethron/migrations-generator
Hope , it helps. Thanks. Cheers. -_-

Newbie looking for simple example of connecting to SQL using asp.net MVC with VB.net

So I am looking to freshen up my dev skills. I come from a classic ASP background using VB, so this new .net and Model concept is very foreign to me. I cant seem to get my head wrapped around it yet. I have tried going through the tutorials, but most are C# and I plan to use VB.net.
My needs at the moment are very simple (or at least i thought they were) Does anyone have a simple example or explanation of how I can create a simple page that pulls data from a local SQL Express DB?
I understand how the Controllers and Views work(mostly), but the Models just make zero sense to me
I created a new Model for a very simple database called Test. It has only 5 columns. (Username, Password, Email_Address, Text_number, and UserID (UID). It created a Model1.edmx, but that's it. Nothing else below it. Where the heck do I go from here?
Uggghhh I feel so dumb!! I used to be OK at this, now it's SOOO different!! I miss my T-SQL, Recordsets, and Loops.
If you want db first you should create a new .edmx Model using "generate from database".
When you have created an .edmx model then you usually create your Entity Classes (see tutorials below) with the "add code generation item". You can read about this in one of the linked tutorials, under "Generating Strongly Typed Entity Classes". After that you're ready to go the controller and create your first query to return some data.
I suggest you start watching these free tutorials about MVC3/4, even if they are in C# and you want to use vb.net, I'm sure you can easily understand what's going on since it's clearly explained
http://www.asp.net/mvc/pluralsight
also read these tutorials that show database first approaches
http://msdn.microsoft.com/en-US/data/jj206878
http://msdn.microsoft.com/en-us/data/gg685489.aspx - VB.net project
To connect to your database, you might want to consider an ORM, like one of the following:
Entity Framework
NHibernate
Linq2Sql (built-in/already installed)
Each of these are very popular and make it easy to quickly snap a code-wrapper around your DB. Then, in your model, you use the ORM objects(wrapping your DB) to call through to the DB.

Move Django model from one app to another [duplicate]

This question already has answers here:
How do I migrate a model out of one django app and into a new one?
(7 answers)
Closed 9 years ago.
I made the stupid mistake of creating too many models in the same Django app, now I want to split it into 3 distinct ones. Problem is: there's already data in production in two customers' sites, so I need to carefully plan any schema/data migration to be done (I'm using django-south). I'm unsure on how to proceed, any advice would be greatly appreciated.
(I'm using PostgreSQL on a Ubuntu server 12.4 LTS, if that's of any relevance)
I thought about using db.rename_table, but can't figure out how to correctly update the foreign keys to those models (old to new) - irrelevant at the database level (since the table renaming already got that covered), but not so at the ORM level.
Update: after thinking about it, and after asking this question on programmmers.SE, I decided to keep things simple and don't worry about migrations between major versions of the product. Short term, I'll just use db.rename_table to match the new name, while also using db_table as Daniel Roseman suggested, all the while keeping the models in the old app. When upgrading to a major version, I swith to the new app and ditch all migrations altogether (so fresh installs of the new version will create the database "as-is" instead of going through all historical migrations).
I don't see why you need any data migration at all.
Just move the models to the new app, and add a db_table setting in the inner Meta classes to point to the old table names.
I did something similar on a smaller scale recently and this was my process:
Create new app and corresponding models
Update views to use new models
Update unit/systems tests to make sure nothing broke (important!)
Write a management command that populates the new models based on the old models
Deploy code
Run migration for new models
Run management command script to update new models
Leave old app for 1-2 weeks and when you think its all good, drop them.
The reasons why I didnt use data migration:
Not familiar -- felt the task was too important to use a process I wasn't familiar with
More comfortable moving data with python code then with South magic
Ran into south migration issues with dependencies. Didn't want to further complicate the migrations with a data migration. This could will be a mis-founded assumption due to my unfamiliarity with the mechanics of a data migration
Perhaps as a bias from point 3, I convinced myself using South purely as a schema management tool is the 'right' way to do. Creation/updating of data should be done in the Django layer using either fixtures or custom management commands
The simplest solution I could think of:
Create a SchemaMigration changing the type of every foreign key to models in the old app to a primitive type (including ones internal to it);
Create the new apps and their models normally;
Do a data migration from the old tables to the new ones;
Create another SchemaMigration, changing every primitive type to a foreign key again, now pointing to the new tables;
Remove the old app from settings and drop its tables.
Laborious, yes, but would do the trick. I'd hope for a better solution though.

Getting Started With Lift, Using Databases to Build Dynamic Sites

So I have been looking around the internet for a good explanation of how lift works concerning databases. I have not found anything very helpful yet. What I am looking for is a simple explanation or code example that can show how lift connects to its databases to perform transactions and how to use this to create new tables, models or update and edit existing tables.
For example: with django i fairly easily figured out how it generated database tables from model classes and executed updates on them through methods it inherited from the framework.
I am trying to create a simple app at the moment that would have users, information about them, posts on a website, etc.
I am currently reading through the available Lift books and would greatly appreciate more help in learning how to use lift.
Lift configures it's data source in Boot.scala.
if (!DB.jndiJdbcConnAvailable_?) {
val vendor =
new StandardDBVendor(Props.get("db.driver") openOr "org.h2.Driver",
Props.get("db.url") openOr
"jdbc:h2:lift_proto.db;AUTO_SERVER=TRUE",
Props.get("db.user"), Props.get("db.password"))
LiftRules.unloadHooks.append(vendor.closeAllConnections_! _)
DB.defineConnectionManager(DefaultConnectionIdentifier, vendor)
}
It can generate table schemas for you using Schemifier:
Schemifier.schemify(true, Schemifier.infoF _, User,Post,Tag,PostTags)
For general Lift project, you can just use Lift Mapper as an ORM tool, it's not complete but works for most of the cases.
You can refer to Lift WIKI and Simply Lift(Written by the Author) or Explore Lift.
From my perspective, the documents available so far are rather disappointing.
It's said the Lift in Action is very well written, but won't come out till this summer, you can read it from MEAP.
In the Exploring Lift book, the PocketChange example contains code showing how to define a User using MetaProtoUser and other features. I would start there for a better understanding of Lift, model and the built-in CRUD and User prototype objects.
http://exploring.liftweb.net/master/index-2.html#toc-Chapter-2
Keep in mind that the 'new' approach to DB integration will be via the Record. This is very much a work in progress, so I wouldn't rush to start learning it.
You can also look at the source for Lift in Action to get some ideas. Here's a link to the travel app built in the first couple chapters
https://github.com/timperrett/lift-travel
And to the source code for the entire book. Chapter 10 is the Mapper chapter.
https://github.com/timperrett/lift-in-action
The default ORM in Lift is Mapper which gives you among other things a quick path to CRUD functionality for your DB entities.
However if you would like a more traditional JPA persistence approach (or rather SPA since entities would in that case be written in scala), i usually find very useful the JPA-like sample application that is part of the Lift distribution. To try it out, assuming maven is installed, just type:
mvn archetype:generate -DarchetypeRepository=http://scala-tools.org/repo-snapshots -DarchetypeGroupId=net.liftweb -DarchetypeArtifactId=lift-archetype-jpa-basic_2.8.1 -DarchetypeVersion=2.3-SNAPSHOT -DgroupId=org.mycompany.myproject -DartifactId=MyProject -Dversion=1.0
This will create a MyProject Lift project, containing a simple library application with 2 entities (Author and Book) having a one-to-many relationship as well as CRUD snippets showing how you can create and edit such entities in a jdbc compliant database.

Resources