#Transform python code into an Object oriented one

1 messages · Page 1 of 1 (latest)

cosmic maple
#

Firstly, greetings to everyone. Secondly, I'm currently developing a software that aids the nursing team in referring pregnant women to maternity services. This software will be utilized by the smartH hospital coalition to oversee the allocation of childbirth assistance to specialist doctors, along with their respective hospitals and teams.

The software receives a roster of doctors, detailing each one's relevant attributes for handling childbirth assistance requests at any given moment. It also takes in a schedule of already arranged assistance sessions and a list of pending assistance requests that haven't been assigned to doctors since the last scheduling. Following analysis, the software updates the assistance calendar and the list of doctors, potentially distributing the assistance requests based on their availability and the specific requirements outlined by the nurses.

As for the challenge I'm facing, I've completed the project, but it lacks an object-oriented structure. When seeking guidance from my instructor on how to handle reading the three files and extracting information from them, he proposed incorporating the file reader within designated classes, like placing the doctor file reader within the Doctor class. However, I'm struggling to envision how this can be accomplished without initially defining the class. Any assistance or insights would be immensely appreciated. I'll provide both the code snippet that needs to be integrated into the Doctor class and the structure of the Doctor class itself. Additionally, suggestions regarding the class structure would be beneficial.

#

class Doctors:

def __init__(self,doctors):

    """
    doctors attributes
    """

    for doctor in doctors:

        self._doctor = doctor

        self._docName = doctor[1]

        self._category = doctor[2]

        self._hourFinish = doctor[3]

        self._accumMin = doctor[4]

        self._hAccumRest = doctor[5]


def getDocName(self):

    return self._docName

def getCategory(self):

    return self._category

def getHourFinish(self):

    return self._hourFinish

def getAccumMin(self):

    return self._accumMin

def getHAccumRest(self):

    return self._hAccumRest

def setNewHour(self):

    self._hourFinish = self.getHourFinish() + 30

    self._hAccumRest = self.getHAccumRest() + 30
    
    self._accumMin = self.getAccumMin() + 30
sharp yachtBOT
#

@cosmic maple

File Attachments Not Allowed

For safety reasons we do not allow files with certain file extensions.

Code Formatting

You can share your code using triple backticks like this:
```
YOUR CODE
```

Large Portions of Code

For longer scripts use Hastebin or GitHub Gists and share the link here

Ignored these files due to them having disallowed file extensions
  • message.txt
cosmic maple
sharp yachtBOT
#

@cosmic maple

File Attachments Not Allowed

For safety reasons we do not allow files with certain file extensions.

Code Formatting

You can share your code using triple backticks like this:
```
YOUR CODE
```

Large Portions of Code

For longer scripts use Hastebin or GitHub Gists and share the link here

Ignored these files due to them having disallowed file extensions
  • message.txt
limpid ocean
#

!format

sharp yachtBOT
#
Code Formatting

When sharing code with the community, please use the correct formatting for ease of readability.

Example

```py
YOUR CODE HERE
```

Those are back ticks not single quotes, typically the key above TAB

limpid ocean
#

Use that for sharing python code

#

and remove the py bit for plain text

azure plaza