Skip to content

A program to create RDF and RDF* knowledge graphs from the ouput of a simulation model of patients movements inside a hospital. Since the simulation model has an incomplete hospital layout, HospitalGeneratorRDF also creates a complete hospital layout (rooms, corridors, areas, floors, etc.).

License

Notifications You must be signed in to change notification settings

LorenaPujante/HospitalGeneratorRDF

Repository files navigation

HospitalGeneratorRDF

HospitalGeneratorRDF is a program that based on the output of H-Outbreak, a simulation model of the movements of patients inside a hospital, creates a knowledge graph in RDF and RDF* according to a data model that is an extension to the used in MimicToRDF. It also generates CSV files to allow the use of the data for other purposes and structures.

Since H-Outbreak does not cover all the classes and relations from the data model, HospitalGeneratorRDF completes it by adding Floors, Areas, Corridors, Rooms, Beds, Services (in H-Outbreak they are wards) and Hospitalization Units, and the relations between them. It also creates different subclasses of Events: Hospitalization, Radiology, Surgery and Death.

1. Installation

The source code is currently hosted on github.com/LorenaPujante/HospitalGeneratorRDF.

The program is in Python 3.10, and no external packages are needed.

2. Input

The input for HospitalGeneratorRDF must be:

  • The two files obtained as output from H-Outbreak: movements.csv and patients.csv
  • An additional file with the hospital layout from H-Outbreak: hospital.txt.
    • To get this file, we need to modify the file hospital.py from H-Outbreak by adding the printHospital() function from Modifications/modification.py. Then, call the new function at the end of initialize_hospital(), just before the return L.
      These three files must be in folder Input.

3. Execution and Configuration Params

To run the program, in the terminal, go to the folder containing the program and run: python main.py

The main function receives as parameters the following:

  • index: Index to start numbering (property id) the objects that are created to complete the hospital layout. It is recommended that this index be greater than the last id of the elements in the H-Outrbreak hospital layout.
  • huPerService: Number of HospitalizationUnits to create per Service.
  • nFloors: Number of Floors that the hospital will have. This number must be greater or equal to 2.
  • huPerFloor: Number of HospitalizationUnits that each Floor (except the ground floor) will have.
  • nRows, nColumns: Number of rows and columns that the grill that divides each Floor (except the ground floor) will have.
  • startDateTime: Date and time of the first step from the simulation generated by H-Outbreak. The next steps will be dated from this parameter.
  • optionFloorHU: When it is not possible to create a suitable hospital layout that has the specified number of HospUnits per Floor, with this parameter, we select if we want to keep the number of HospUnits per Floor and modify nFloors (option 1) or to keep the number of Floors and modify huPerFloor (option 2). If this parameter is None, then the option will be asked by terminal.

The main() function also has commented function calls to request these parameters per terminal.

At the end of main.py, before the call to main() function, we have set some example values for the parameters. We have also uploaded three example input files in Input. The output files are also uploaded.

  • In the example, the hospital will have 4 Floors. On the ground floor, there will be 20 Emergency beds, 10 ICU beds, 3 surgery rooms, and 4 radiology rooms with 2 beds each. In the remaining 3 floors, 8 services will be distributed. Each service will have 2 hospitalization units and between 10 and 14 rooms. Each room will have 2 beds. Each floor will have 5 hospitalization units. The 3 upper floors will be organised in a grid of 3 columns by 2 rows. (These 3 last values may change during program execution)
  • The initial date will be 01/01/23 08:00:00

4. Outcomes

After running the program, the following folders are created:

  • OutputCSV: Folder with the nodes and edges of the graph in the form of CSV files.
    • Nodes and edges are in different folders: OutputCSV/Classes (nodes) and OutputCSV/CSV (edges). Each class of nodes and edges is in a separate file.
  • OutputRDF: Folder with the nodes and edges of the RDF knowledge graph in the form of N-Triples files.
    • Nodes and edges are in different folders: OutputRDF/Classes (nodes) and OutputRDF/CSV (edges). Each class of nodes and edges is in a separate file. Inside each folder, there also is a file with the union of all the nodes (OutputRDF/Classes/Classes_complete.nt) and the union of all the edges (OutputRDF/Relations/Relations_complete.nt), respectively. Finally, the file OutputRDF/data_complete.*.nt contains the nodes and edges' union.
  • OutputRDF_star: Folder with the nodes and edges of the RDF* knowledge graph in the form of N-Triples files (nodes) and Turtle files (edges).
    • Nodes and edges are in different folders: OutputRDF_star/Classes (nodes) and OutputRDF_star/CSV (edges). Each class of nodes and edges is in a separate file. Inside each folder, there also is a file with the union of all the nodes (/Classes.*/Classes_complete.nt) and the union of all the edges (OutputRDF_star/Relations.*/Relations_complete.ttl), respectively. Finally, the file OutputRDF_star/data_complete.ttl contains the nodes and edges' union.
  • OutputSummary: Folder with two summary files:
    • EpisodeSummary.txt: This file shows for each patients how many Episodes and Events with their description, id and start and end dates. For Events, it also shows their subclass and to which Bed they are connected.
    • HospitalSummary.txt: This file shows a list with all the Services, HopitalizationUnits and Locations of the hospital. For each element, it presents its id, description and several lists with all the other elements of the spatial dimmension to which it is connected.

Repeated runs will replace existing files.

About

A program to create RDF and RDF* knowledge graphs from the ouput of a simulation model of patients movements inside a hospital. Since the simulation model has an incomplete hospital layout, HospitalGeneratorRDF also creates a complete hospital layout (rooms, corridors, areas, floors, etc.).

Topics

Resources

License

Stars

Watchers

Forks

Languages