Based on your description, I "see" the ceiling cut out, a resin disc screwed to the joist. The disc has two or more empty holes that correspond to the device mounting holes in a standard octagonal junction box. Then there's a length of romex cable just hanging loose to which you're supposed to connect the fan.
If your fan's installation instructions indicate some part of the fan can be used to make connections, such as the ceiling canopy, you may be in luck. Make the connections there. More than likely, they'll assume you are providing a junction box in the ceiling. First ensure the fan's mounting kit is compatible with your resin plate. You'll need to get the wires from the down pipe, through the plate and into a nearby junction box you will install. The fan wires need to be long enough that there's at least 6 extra inches after running into the box. They must not bind against anything.
You'll need an old work box, a blank cover plate, some wire nuts (may be part of the fan kit), a short length of 1/2" flex conduit, a flex to box connector, and a plastic conduit bushing to protect the wire insulation where it goes into the conduit above the fan. You'll also need a romex to box connector if the box does not have them built in. Any wire running in a concealed structural space needs to be in conduit or non-metallic cable (romex), or a few other less common options.
You install an old work box by cutting the proper sized and shaped hole in the ceiling in a place where the box will not hit anything above the ceiling but is close to the resin plate on which the fan will be mounted. Do not install the box at this time, I'm explaining what will happen, but there's other things to do first. You would place the box in the hole, the box's flange keeps it from being pushed through. A couple retaining tabs are turned with a screwdriver so that the box will no longer be able to be pulled out.
If the romex cable is not attached nearby to a joist, you'll need to do so through the box hole. Locate the hole so it's close enough to do this, but not so close the wire is kinked or crimped after the box is installed. Remove an appropriate knock out in the box to connect the conduit. You can cut or drill a hole if need be. After securing the romex, feed it into the box. Feed the attached conduit through the hole and back out through the resin plate. It can be routed next to the plate as long as the fan ceiling canopy fitting will cover it. Or cut a hole in the plate if need be. Install the box and cut the conduit to length at the resin plate. Install the protective bushing. Install the fan on the resin plate. Push the fan wires through the conduit at the resin plate and into the box and make the connections. Install the fan ceiling canopy and box cover plate.
Electrical boxes serve several functions. They protect wiring where insulation has been removed. They prevent inadvertent contact with exposed components. They contain sparks when the worst occurs. And they provide standard mounting points for fixtures.
I'd be inclined to "code things up" with a wraparound box like so:
![enter image description here](https://i.stack.imgur.com/800R7.jpg)
Nonmetallic ceiling joist box for ceiling fans. 4'' diameter x 2 1/8'' deep, 12.0 cu. in. 4 clamps, 2 1/2'' knockouts. Maximum fixture weight is 150 lb., maximum fan weight is 70 lb. Exceeds National Electrical code requirements. Recommended for earthquake areas.
Best Answer
You can notch a joist up to 1/6 the depth of the joist. For example, a 2x10 can be notched 1.54166" deep (9 1/4" / 6). However, you cannot notch a joist within the middle 1/3 of the joists length. The notch can also only be 1/3 the depth of the joist wide. Again with the 2x10 example, that means the notch can only be 3.0833" wide (9 1/4" / 3).
Since ceiling fans tend to be near the middle of the room, it's likely that the intended notch location is within the middle third of the joist. Which means that notching the joist, could be dangerous.
You also cannot notch the joist if it's an engineered joist, without consulting the manufacturer or an engineer first.
For more information on notching and boring joists, please se.e this answer